I am trying to get the instance group for a given container engine cluster. I can successfully get the container cluster object, and it has a property called instanceGroupUrls which is a list of strings where each string is the full URL to an instance group:
In [14]: gke_api = discovery.build('container', 'v1', credentials=credentials)
In [15]: cluster = gke_api.projects().zones().clusters().get(
projectId=project_id, zone=zone, clusterId=cluster_id).execute()
In [16]: cluster['instanceGroupUrls']
Out[16]: ['https://www.googleapis.com/compute/v1/projects/{project-id}/zones/{zone-id}/instanceGroupManagers/{instanceGroupID}']
My question is: How do I get the instance group, given that I only have the full URL to the resource? Now, I could parse that URL and then use the api discovery thing to do instanceGroups.get(project='foo', instanceGroup='bar') but that seems very hacky and prone to breakage.
Does the API client has a way to provide the full URL? I have done much googling and poking around in IPython, but couldn't find much. The closest I got was the HttpRequest class (http://google.github.io/google-api-python-client/docs/epy/googleapiclient.http.HttpRequest-class.html) but I'm not sure what to pass in for the args.
Any help appreciated, Aaron