Ruby Google API 클라이언트를 사용하여 Google Compute Platform (GCP)에 배포를 만들려고합니다. 나는 이것이 gcloud
명령 행 도구를 사용하여 작동하는지 테스트 한배치 관리자 용 Google API를 사용할 때 배치 구성을 어떻게 설정합니까?
resources:
- name: my-vm
type: compute.v1.instance
properties:
zone: europe-west1-b
machineType: zones/europe-west1-b/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: global/images/myvm-1487178154
networkInterfaces:
- network: $(ref.my-subnet.selfLink)
networkIP: 172.31.54.11
# Create the network for the machines
- name: my-subnet
type: compute.v1.network
properties:
IPv4Range: 172.31.54.0/24
:
는 내가 접속과 운전에 대한 YAML 파일이 있습니다.
이제 API를 사용하여 Ruby에서이 작업을 수행하려고합니다. 나는 다음과 같은 코드가 있습니다
require 'google/apis/deploymentmanager_v2'
require 'googleauth'
require 'googleauth/stores/file_token_store'
SCOPE = Google::Apis::DeploymentmanagerV2::AUTH_CLOUD_PLATFORM
PROJECT_ID = "my-project"
ENV['GOOGLE_APPLICATION_CREDENTIALS'] = "./service_account.json"
deployment_manager = Google::Apis::DeploymentmanagerV2::DeploymentManagerService.new
deployment_manager.authorization = Google::Auth.get_application_default([SCOPE])
이 모두는 내가 인증 오전에 노력을하고 내가 작업 할 수 deployment_manager
개체가 있습니다.
#insert_deployment(project, deployment_object = nil, preview: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DeploymentmanagerV2::Operation
deployment_object
유형은 '구글 :: API를 :: DeploymentmanagerV2 :: 배포'입니다 :
나는 다음과 같은 서명이있는 insert_deployment
방법을 사용하고 싶습니다. 이 객체를 만들 수는 있지만 프로그래밍 방식으로 배포를 수행 할 수 있도록 YAML 파일을 가져 오는 방법을 알지 못합니다. --config
그러나 다시 나는이에 파일을로드하거나 다음 insert_deployment
에 대한 올바른 객체로를 설정하는 방법을 모르는를 지정하는 명령 행 옵션과 유사 보인다 ConfigFile
라는 다른 클래스가 있습니다
.