def create_change(original, updated, module): auth = GcpSession(module, 'dns') return return_if_change_object(module, auth.post(collection(module), resource_to_change_request( original, updated, module) ))
def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpProxies/{name}/setUrlMap"]).format(**module.params), {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, )
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 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 quic_override_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride"]).format(**module.params), {u'quicOverride': module.params.get('quic_override')}, )
def create(module, link, kind): auth = GcpSession(module, 'dns') return return_if_object(module, auth.post(link, resource_to_request(module)), kind)
def create(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def create_change(original, updated, module): auth = GcpSession(module, 'dns') return return_if_change_object( module, auth.post(collection(module), resource_to_change_request(original, updated, module)))
def ip_cidr_range_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange"]).format(**module.params), {u'ipCidrRange': module.params.get('ip_cidr_range')}, )
def service_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setBackendService"]).format(**module.params), {u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')}, )
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 proxy_header_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader"]).format(**module.params), {u'proxyHeader': module.params.get('proxy_header')}, )
def stop(self): auth = GcpSession(self.module, 'cloudtasks') return_if_object(self.module, auth.post(self._stop_url()))
def ssl_certificates_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setSslCertificates"]).format(**module.params), {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, )
def remove_instances(self, instances): auth = GcpSession(self.module, 'compute') wait_for_operation(self.module, auth.post(self._remove_instances_url(), self._build_request(instances)))
def create(module, link): auth = GcpSession(module, 'cloudscheduler') return return_if_object(module, auth.post(link, resource_to_request(module)))
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 create(module, link): auth = GcpSession(module, 'spanner') return return_if_object(module, auth.post(link, resource_to_create(module)))
def create(module, link): auth = GcpSession(module, 'filestore') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def create(module, link): auth = GcpSession(module, 'mlengine') return return_if_object(module, auth.post(link, resource_to_request(module)))
def create(module, link): auth = GcpSession(module, 'spanner') return wait_for_operation(module, auth.post(link, resource_to_create(module)))
def create(module, link): auth = GcpSession(module, 'runtimeconfig') return return_if_object(module, auth.post(link, resource_to_request(module)))