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 = base64.b64decode(json_content['privateKeyData']) f.write(private_key_contents)
def fetch_list(module, link): auth = GcpSession(module, 'pubsub') response = auth.get(link) return return_if_object(module, response)
def update(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module)))
def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'spanner') return return_if_object(module, auth.get(link), allow_not_found)
def delete(module, link, kind): auth = GcpSession(module, 'storage') return return_if_object(module, auth.delete(link), kind)
def delete(module, link, kind): auth = GcpSession(module, 'bigquery') return return_if_object(module, auth.delete(link), kind)
def create(module, link): auth = GcpSession(module, 'spanner') return return_if_object(module, auth.post(link, resource_to_request(module)))
def security_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/backendServices/{name}/setSecurityPolicy"]).format(**module.params), {u'securityPolicy': module.params.get('security_policy')}, )
def update(module, link): auth = GcpSession(module, 'cloudbuild') return return_if_object(module, auth.patch(link, resource_to_request(module)))
def create(module, link, kind): auth = GcpSession(module, 'sql') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link, kind, fetch): update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module)))
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 fetch_resource(module): auth = GcpSession(module, 'iam') return return_if_object(module, auth.get(self_link_from_file(module)))
def delete(module): auth = GcpSession(module, 'iam') return return_if_object(module, auth.delete(self_link_from_file(module)))
def delete(module, link): auth = GcpSession(module, 'container') return wait_for_operation(module, auth.delete(link))
def delete(module, link): auth = GcpSession(module, 'cloudbuild') return return_if_object(module, auth.delete(link))
def create(module, link, kind): auth = GcpSession(module, 'bigquery') return return_if_object(module, auth.post(link, resource_to_request(module)), kind)
def fetch_list(module, link, query): auth = GcpSession(module, 'dns') response = auth.get(link, params={'dnsName': query}) return return_if_object(module, response)
def download_file(module): auth = GcpSession(module, 'storage') data = auth.get(media_link(module)) with open(module.params['dest'], 'w') as f: f.write(data.text.encode('utf8')) return fetch_resource(module, self_link(module))
def label_fingerprint_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/setLabels"]).format(**module.params), {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, )
def delete(module, link): auth = GcpSession(module, 'spanner') return return_if_object(module, auth.delete(link))
def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/resize"]).format(**module.params), {u'sizeGb': module.params.get('size_gb')}, )
def update(module, link, kind): auth = GcpSession(module, 'storage') return return_if_object(module, auth.put(link, resource_to_request(module)), kind)
def update(module, link): auth = GcpSession(module, 'resourcemanager') return wait_for_operation(module, auth.put(link, resource_to_request(module)))
def fetch_list(module, link, query): auth = GcpSession(module, 'compute') response = auth.get(link, params={'filter': query}) return return_if_object(module, response)
def delete(module, link): auth = GcpSession(module, 'resourcemanager') return wait_for_operation(module, auth.delete(link))
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 create(module, link): auth = GcpSession(module, 'container') return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link))
def delete(module, link): auth = GcpSession(module, 'pubsub') return return_if_object(module, auth.delete(link))