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)))
예제 #2
0
def delete(module, link):
    auth = GcpSession(module, 'iam')
    return return_if_object(module, auth.delete(link))
예제 #3
0
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)
예제 #4
0
def fetch_resource(module, link, allow_not_found=True):
    auth = GcpSession(module, 'sourcerepo')
    return return_if_object(module, auth.get(link), allow_not_found)
예제 #5
0
def fetch_list(module, link, query):
    auth = GcpSession(module, 'compute')
    response = auth.get(link, params={'filter': query})
    return return_if_object(module, response)
예제 #6
0
def fetch_list(module, link):
    auth = GcpSession(module, 'iam')
    response = auth.get(link)
    return return_if_object(module, response)
예제 #7
0
def create(module, link):
    auth = GcpSession(module, 'sourcerepo')
    return return_if_object(module, auth.post(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}/regions/{region}/disks/{name}/resize"]).format(**module.params),
        {u'sizeGb': module.params.get('size_gb')},
    )
def update(module, link):
    auth = GcpSession(module, 'resourcemanager')
    return wait_for_operation(module,
                              auth.put(link, resource_to_request(module)))
예제 #10
0
def fetch_list(module, link, query):
    auth = GcpSession(module, 'dns')
    response = auth.get(link, params={'dnsName': query})
    return return_if_object(module, response)
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')},
    )
예제 #12
0
def update(module, link):
    auth = GcpSession(module, 'cloudbuild')
    return return_if_object(module,
                            auth.patch(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, 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)))
예제 #15
0
def create(module, link):
    auth = GcpSession(module, 'container')
    return wait_for_operation(module,
                              auth.post(link, resource_to_request(module)))
def delete(module, link):
    auth = GcpSession(module, 'resourcemanager')
    return wait_for_operation(module, auth.delete(link))
예제 #17
0
def delete(module, link):
    auth = GcpSession(module, 'container')
    return wait_for_operation(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 delete(module, link):
    auth = GcpSession(module, 'cloudscheduler')
    return return_if_object(module, auth.delete(link))
def delete(module, link, kind):
    auth = GcpSession(module, 'bigquery')
    return return_if_object(module, auth.delete(link), kind)
예제 #21
0
def delete(module, link):
    auth = GcpSession(module, 'sourcerepo')
    return return_if_object(module, auth.delete(link))
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 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):
    auth = GcpSession(module, 'storage')
    return return_if_object(module,
                            auth.put(link, resource_to_request(module)), kind)
예제 #25
0
def create(module, link):
    auth = GcpSession(module, 'iam')
    return return_if_object(module, auth.post(link,
                                              resource_to_create(module)))
def delete(module, link, kind):
    auth = GcpSession(module, 'storage')
    return return_if_object(module, auth.delete(link), kind)
예제 #27
0
def delete(module, link, kind):
    auth = GcpSession(module, 'compute')
    return wait_for_operation(module, auth.delete(link))
예제 #28
0
def delete(module, link):
    auth = GcpSession(module, 'redis')
    return wait_for_operation(module, auth.delete(link))
def update(module, link, kind):
    auth = GcpSession(module, 'compute')
    return wait_for_operation(module,
                              auth.put(link, resource_to_request(module)))
예제 #30
0
def fetch_resource(module):
    auth = GcpSession(module, 'iam')
    return return_if_object(module, auth.get(self_link_from_file(module)))