gcloud_apis
is an auto-generated command-line interface (CLI) to interact with any Google Cloud Platform REST API.
-
Go: To set up your environment correctly, read How to Write Go Code. Make sure your
GOPATH
environment variable is set.
-
Download and install
gcloud_apis
with the Go tool:$ go get github.com/skelterjohn/gcloud_apis
-
Make sure you have an authenticated user account with
gcloud
:$ gcloud auth login
gcloud_apis
automatically uses gcloud to authenticate requests.
$ gcloud_apis list
autoscaler
autoscaler:v1beta2
bigquery
bigquery:v2
compute
compute:v1
$ gcloud_apis list autoscaler
autoscaler.autoscalers
autoscaler.zoneOperations
autoscaler.zones
$ gcloud_apis list autoscaler.autoscalers
autoscaler.autoscalers.delete
autoscaler.autoscalers.get
autoscaler.autoscalers.insert
autoscaler.autoscalers.list
autoscaler.autoscalers.patch
autoscaler.autoscalers.update
$ gcloud_apis compute.instances.list <YOUR PROJECT>/us-central1-a
{
"id": "projects/<YOUR PROJECT>/zones/us-central1-a/instances",
"kind": "compute#instanceList",
"selfLink": "https://www.googleapis.com/compute/v1/projects/<YOUR PROJECT>/zones/us-central1-a/instances"
}
$ gcloud_apis compute.projects.setCommonInstanceMetadata <YOUR PROJECT> --items[0].key=foo --items[0].value=bar
{
"id": "4687621082493875678",
"insertTime": "2014-11-02T14:03:25.131-08:00",
"kind": "compute#operation",
"name": "operation-1418418066582-29739ad979c21-7e7dac48-b6146833",
"operationType": "setMetadata",
"selfLink": "https://www.googleapis.com/compute/v1/projects/<YOUR PROJECT>/global/operations/operation-1418418066582-29739ad979c21-7e7dac48-b6146833",
"startTime": "2014-11-02T14:03:25.131-08:00",
"status": "PENDING",
"targetId": "14043977863849352249",
"targetLink": "https://www.googleapis.com/compute/v1/projects/<YOUR PROJECT>",
"user": "set
}
$ gcloud_apis compute.projects.get <YOUR PROJECT>
{
"commonInstanceMetadata": {
"fingerprint": "Vm9SEZQeWH0=",
"kind": "compute#metadata"
},
"creationTimestamp": "2014-11-02T14:03:25.131-08:00",
"id": "14043977863193752249",
"kind": "compute#project",
"name": "<YOUR PROJECT>",
"quotas": [],
"selfLink": "https://www.googleapis.com/compute/v1/projects/<YOUR PROJECT>"
}