[colug-432] Google Cloud Compute API
punches.chris at gmail.com
Sun May 27 22:06:21 EDT 2018
Why wouldn't it be by zone? Surely production and preproduction are
separated, among other things, by a zone tag
On Sun, May 27, 2018 at 10:01 PM, Rick Hornsby <richardjhornsby at gmail.com>
> I’m trying to figure out the Google Cloud API, specifically the Python
> I have a shell script that works using `gcloud compute …` commands, but
> I’ve been asked to add some functionality. At this point, I’m going to move
> it to Python for the additional structure/objects/data types etc. (My
> options are shell or Python.)
> With the `gcloud` shell command, specifying a zone is optional. This works
> great for the shell script. I don’t care about the zone, I just need to
> iterate over all the instances in a project. However, it seems that with
> the library/API approach, zone is _not_ optional. This would leave me
> with the very bad position of having to get a list of all zones (that’s
> doable), iterating over each zone looking for instances.
> The python API so far looks to me like a bit of a second class pile of
> nonsense that probably (very) loosely wraps around something else. For
> example, you have to create the resource type objects from two strings,
> like so:
> crm = googleapiclient.discovery.build('cloudresourcemanager', ‘v1')
> compute = googleapiclient.discovery.build('compute', ‘v1’)
> Get the list of projects?
> projects = crm.projects().list().execute()['projects']
> Get the project’s instances?
> Am I missing something, especially w/r/t the zone is optional vs required
> depending on your gcloud vs python lib? Is there a better Python library
> than the one that Google provides?
>  https://cloud.google.com/compute/docs/reference/rest/
> colug-432 mailing list
> colug-432 at colug.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the colug-432