Example #1
0
 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)))
Example #3
0
def target_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/forwardingRules/{name}/setTarget"]).format(**module.params),
        {u'target': module.params.get('target')},
    )
Example #4
0
def tensorflow_version_update(module, request, response):
    auth = GcpSession(module, 'tpu')
    auth.post(
        ''.join(["https://tpu.googleapis.com/v1/", "projects/{project}/locations/{zone}/nodes/{name}:reimage"]).format(**module.params),
        {u'tensorflowVersion': module.params.get('tensorflow_version')},
    )
Example #5
0
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):
    auth = GcpSession(module, 'appengine')
    return return_if_object(module, auth.post(link, resource_to_request(module)))
Example #7
0
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)
Example #8
0
def create(module, link):
    auth = GcpSession(module, 'bigtable')
    return wait_for_operation(module, auth.post(link, resource_to_create(module)))
Example #9
0
def specific_reservation_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/reservations/{name}/resize"]).format(**module.params),
        {u'specificReservation': ReservationSpecificreservation(module.params.get('specific_reservation', {}), module).to_request()},
    )
def url_map_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://compute.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 create(module, link):
    auth = GcpSession(module, 'iam')
    return return_if_object(module, auth.post(link, resource_to_create(module)))
Example #12
0
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')},
    )
Example #13
0
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 create(module, link):
    auth = GcpSession(module, 'serviceusage')
    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 delete(module, link):
    auth = GcpSession(module, 'serviceusage')
    return wait_for_operation(module, auth.post(link))
def size_gb_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params),
        {u'sizeGb': module.params.get('size_gb')},
    )
 def stop(self):
     auth = GcpSession(self.module, 'cloudtasks')
     return_if_object(self.module, auth.post(self._stop_url()))
Example #19
0
def create(module, link):
    auth = GcpSession(module, 'cloudfunctions')
    return wait_for_operation(module,
                              auth.post(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 labels_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/images/{name}/setLabels"]).format(**module.params),
        {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')},
    )
Example #22
0
def create(module, link, kind):
    auth = GcpSession(module, 'compute')
    return wait_for_operation(module,
                              auth.post(link, resource_to_request(module)))
Example #23
0
def node_template_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://compute.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')},
    )