Example #1
0
def private_ip_google_access_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess"]).format(
            **module.params
        ),
        {u'privateIpGoogleAccess': module.params.get('private_ip_google_access')},
    )
Example #2
0
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')},
    )
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')},
    )
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')},
    )
Example #5
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')},
    )
Example #6
0
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 label_fingerprint_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join([
            "https://www.googleapis.com/compute/v1/",
            "projects/{project}/zones/{zone}/disks/{name}/setLabels"
        ]).format(**module.params),
        {
            u'labelFingerprint': response.get('labelFingerprint'),
            u'labels': module.params.get('labels')
        },
    )
Example #8
0
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')
        },
    )
Example #9
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 #10
0
def url_map_update(module, request, response):
    auth = GcpSession(module, 'compute')
    auth.post(
        ''.join([
            "https://www.googleapis.com/compute/v1/",
            "projects/{project}/targetHttpsProxies/{name}/setUrlMap"
        ]).format(**module.params),
        {
            u'urlMap':
            replace_resource_dict(module.params.get(u'url_map', {}),
                                  'selfLink')
        },
    )
    def list_instances(self):
        auth = GcpSession(self.module, 'compute')
        response = return_if_object(
            self.module,
            auth.post(self._list_instances_url(), {'instanceState': 'ALL'}),
            'compute#instanceGroupsListInstances')

        # Transform instance list into a list of selfLinks for diffing with module parameters
        instances = []
        for instance in response.get('items', []):
            instances.append(instance['instance'])
        return instances
Example #12
0
def create(module, link):
    auth = GcpSession(module, 'redis')
    return wait_for_operation(module,
                              auth.post(link, resource_to_request(module)))
def create(module, link, kind):
    auth = GcpSession(module, 'dns')
    return return_if_object(module, auth.post(link, resource_to_request(module)), kind)
Example #14
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 = base64.b64decode(json_content['privateKeyData'])
        f.write(private_key_contents)
Example #15
0
def create(module, link):
    auth = GcpSession(module, 'spanner')
    return wait_for_operation(module,
                              auth.post(link, resource_to_create(module)))
Example #16
0
def create(module, link):
    auth = GcpSession(module, 'iam')
    return return_if_object(module, auth.post(link,
                                              resource_to_create(module)))
Example #17
0
def create(module, link):
    auth = GcpSession(module, 'sourcerepo')
    return return_if_object(module, auth.post(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 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')},
    )
Example #20
0
def create(module, link, kind):
    auth = GcpSession(module, 'compute')
    return wait_for_operation(module,
                              auth.post(link, resource_to_request(module)))
Example #21
0
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')},
    )