def fetch_list(module, link): auth = GcpSession(module, 'cloudfunctions') return auth.list(link, return_if_object, array_name='functions')
def create(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') return return_if_object(module, auth.get(link), kind, allow_not_found)
def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'pubsub') return return_if_object(module, auth.get(link), allow_not_found)
def fetch_list(module, link): auth = GcpSession(module, 'kms') return auth.list(link, return_if_object, array_name='cryptoKeys')
def delete(module): auth = GcpSession(module, 'iam') return return_if_object(module, auth.delete(self_link_from_file(module)))
def create(module, link): auth = GcpSession(module, 'pubsub') return return_if_object(module, auth.put(link, resource_to_request(module)))
def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params), {u'sizeGb': module.params.get('size_gb')}, )
def node_template_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/nodeGroups/{name}/setNodeTemplate"]).format(**module.params), {u'nodeTemplate': replace_resource_dict(module.params.get(u'node_template', {}), 'selfLink')}, )
def fetch_list(module, link): auth = GcpSession(module, 'sql') return auth.list(link, return_if_object, array_name='items')
def fetch_list(module, link): auth = GcpSession(module, 'container') return auth.list(link, return_if_object, array_name='clusters')
def fetch_list(module, link): auth = GcpSession(module, 'sourcerepo') return auth.list(link, return_if_object, array_name='repos')
def fetch_list(module, link): auth = GcpSession(module, 'cloudbuild') return auth.list(link, return_if_object, array_name='triggers')
def target_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params), {u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink')}, )
def delete(module, link): auth = GcpSession(module, 'cloudbuild') return return_if_object(module, auth.delete(link))
def fetch_list(module, link): auth = GcpSession(module, 'appengine') return auth.list(link, return_if_object, array_name='ingressRules')
def create(module): auth = GcpSession(module, 'iam') json_content = return_if_object(module, auth.post(self_link(module), resource_to_request(module))) with open(module.params['path'], 'w') as f: private_key_contents = to_native(base64.b64decode(json_content['privateKeyData'])) f.write(private_key_contents)
def create(module, link): auth = GcpSession(module, 'filestore') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def fetch_resource(module): auth = GcpSession(module, 'iam') return return_if_object(module, auth.get(self_link_from_file(module)))
def delete(module, link): auth = GcpSession(module, 'filestore') return wait_for_operation(module, auth.delete(link))
def delete(module, link): auth = GcpSession(module, 'pubsub') return return_if_object(module, auth.delete(link))
def fetch_list(module, link): auth = GcpSession(module, 'mlengine') return auth.list(link, return_if_object, array_name='versions')
def fetch_list(module, link): auth = GcpSession(module, 'dns') return auth.list(link, return_if_object, array_name='rrsets')
def labels_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/snapshots/{name}/setLabels"]).format(**module.params), {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, )
def fetch_list(module, link, query): auth = GcpSession(module, 'compute') return auth.list(link, return_if_object, array_name='items', params={'filter': query})
def update(module, link): auth = GcpSession(module, 'iam') return return_if_object(module, auth.put(link, resource_to_request(module)))
def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link))
def update(module, link): auth = GcpSession(module, 'cloudbuild') return return_if_object(module, auth.patch(link, resource_to_request(module)))
def create(module, link): auth = GcpSession(module, 'runtimeconfig') return return_if_object(module, auth.post(link, resource_to_request(module)))
def fetch_list(module, link): auth = GcpSession(module, 'spanner') return auth.list(link, return_if_object, array_name='instances')