GCP Bug Fixes (#48276)

* GCP Bug fixes

* added util file changes
This commit is contained in:
Alex Stephen 2018-11-15 05:44:10 -08:00
commit d64785e811
80 changed files with 14198 additions and 13862 deletions

View file

@ -32,51 +32,53 @@ DOCUMENTATION = '''
---
module: gcp_compute_backend_bucket
description:
- Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) load
balancing.
- An HTTP(S) load balancer can direct traffic to specified URLs to a backend bucket
rather than a backend service. It can send requests for static content to a Cloud
Storage bucket and requests for dynamic content a virtual machine instance.
- Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) load
balancing.
- An HTTP(S) load balancer can direct traffic to specified URLs to a backend bucket
rather than a backend service. It can send requests for static content to a Cloud
Storage bucket and requests for dynamic content a virtual machine instance.
short_description: Creates a GCP BackendBucket
version_added: 2.6
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
options:
state:
description:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
bucket_name:
description:
- Cloud Storage bucket name.
required: true
state:
description:
description:
- An optional textual description of the resource; provided by the client when the
resource is created.
required: false
enable_cdn:
description:
- If true, enable Cloud CDN for this BackendBucket.
required: false
type: bool
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
bucket_name:
description:
- Cloud Storage bucket name.
required: true
description:
description:
- An optional textual description of the resource; provided by the client when
the resource is created.
required: false
enable_cdn:
description:
- If true, enable Cloud CDN for this BackendBucket.
required: false
type: bool
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
name must be 1-63 characters long, and comply with RFC1035. Specifically, the
name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/backendBuckets)"
- "Using a Cloud Storage bucket as a load balancer backend: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/backendBuckets)'
- 'Using a Cloud Storage bucket as a load balancer backend: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)'
'''
EXAMPLES = '''
@ -102,42 +104,42 @@ EXAMPLES = '''
'''
RETURN = '''
bucketName:
description:
- Cloud Storage bucket name.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional textual description of the resource; provided by the client when the
resource is created.
returned: success
type: str
enableCdn:
description:
- If true, enable Cloud CDN for this BackendBucket.
returned: success
type: bool
id:
description:
- Unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
returned: success
type: str
bucketName:
description:
- Cloud Storage bucket name.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional textual description of the resource; provided by the client when the
resource is created.
returned: success
type: str
enableCdn:
description:
- If true, enable Cloud CDN for this BackendBucket.
returned: success
type: bool
id:
description:
- Unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
name must be 1-63 characters long, and comply with RFC1035. Specifically, the
name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
returned: success
type: str
'''
################################################################################
@ -317,8 +319,6 @@ def wait_for_completion(status, op_result, module):
while status != 'DONE':
raise_if_errors(op_result, ['error', 'errors'], 'message')
time.sleep(1.0)
if status not in ['PENDING', 'RUNNING', 'DONE']:
module.fail_json(msg="Invalid result %s" % status)
op_result = fetch_resource(module, op_uri, 'compute#operation')
status = navigate_hash(op_result, ['status'])
return op_result