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,85 +32,92 @@ DOCUMENTATION = '''
---
module: gcp_compute_address
description:
- Represents an Address resource.
- Each virtual machine instance has an ephemeral internal IP address and, optionally,
an external IP address. To communicate between instances on the same network, you
can use an instance's internal IP address. To communicate with the Internet and
instances outside of the same network, you must specify the instance's external
IP address.
- Internal IP addresses are ephemeral and only belong to an instance for the lifetime
of the instance; if the instance is deleted and recreated, the instance is assigned
a new internal IP address, either by Compute Engine or by you. External IP addresses
can be either ephemeral or static.
- Represents an Address resource.
- Each virtual machine instance has an ephemeral internal IP address and, optionally,
an external IP address. To communicate between instances on the same network, you
can use an instance's internal IP address. To communicate with the Internet and
instances outside of the same network, you must specify the instance's external
IP address.
- Internal IP addresses are ephemeral and only belong to an instance for the lifetime
of the instance; if the instance is deleted and recreated, the instance is assigned
a new internal IP address, either by Compute Engine or by you. External IP addresses
can be either ephemeral or static.
short_description: Creates a GCP Address
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'
address:
description:
- The static external IP address represented by this resource. Only IPv4 is supported.
An address may only be specified for INTERNAL address types. The IP address must
be inside the specified subnetwork, if any.
required: false
address_type:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
required: false
default: EXTERNAL
version_added: 2.7
choices: ['INTERNAL', 'EXTERNAL']
state:
description:
description:
- An optional description of this resource.
required: false
name:
description:
- Name of the resource. 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
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
required: false
version_added: 2.8
choices: ['PREMIUM', 'STANDARD']
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,
it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the value
is the selfLink of your Subnetwork.'
required: false
version_added: 2.7
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
address:
description:
- The static external IP address represented by this resource. Only IPv4 is supported.
An address may only be specified for INTERNAL address types. The IP address
must be inside the specified subnetwork, if any.
required: false
address_type:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
required: false
default: EXTERNAL
version_added: 2.7
choices:
- INTERNAL
- EXTERNAL
description:
description:
- An optional description of this resource.
required: false
name:
description:
- Name of the resource. 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
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take
the following values: PREMIUM or STANDARD. If this field is not specified, it
is assumed to be PREMIUM.'
required: false
version_added: 2.8
choices:
- PREMIUM
- STANDARD
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address
is specified, it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the
value is the selfLink of your Subnetwork'
required: false
version_added: 2.7
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/beta/addresses)"
- "Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/instances-and-network)"
- "Reserving a Static Internal IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/beta/addresses)'
- 'Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/instances-and-network)'
- 'Reserving a Static Internal IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address)'
'''
EXAMPLES = '''
@ -125,68 +132,69 @@ EXAMPLES = '''
'''
RETURN = '''
address:
description:
- The static external IP address represented by this resource. Only IPv4 is supported.
An address may only be specified for INTERNAL address types. The IP address must
be inside the specified subnetwork, if any.
returned: success
type: str
addressType:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. 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
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,
it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes.
returned: success
type: dict
users:
description:
- The URLs of the resources that are using this address.
returned: success
type: list
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
returned: success
type: str
address:
description:
- The static external IP address represented by this resource. Only IPv4 is supported.
An address may only be specified for INTERNAL address types. The IP address must
be inside the specified subnetwork, if any.
returned: success
type: str
addressType:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. 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
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is
specified, it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
returned: success
type: dict
users:
description:
- The URLs of the resources that are using this address.
returned: success
type: list
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
returned: success
type: str
'''
################################################################################
@ -373,8 +381,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

View file

@ -32,26 +32,25 @@ DOCUMENTATION = '''
---
module: gcp_compute_address_facts
description:
- Gather facts for GCP Address
- Gather facts for GCP Address
short_description: Gather facts for GCP Address
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
required: true
extends_documentation_fragment: gcp
'''
@ -68,72 +67,73 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
address:
description:
- The static external IP address represented by this resource. Only IPv4 is supported.
An address may only be specified for INTERNAL address types. The IP address must
be inside the specified subnetwork, if any.
returned: success
type: str
addressType:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. 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
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,
it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes.
returned: success
type: dict
users:
description:
- The URLs of the resources that are using this address.
returned: success
type: list
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
address:
description:
- The static external IP address represented by this resource. Only IPv4 is
supported. An address may only be specified for INTERNAL address types. The
IP address must be inside the specified subnetwork, if any.
returned: success
type: str
addressType:
description:
- The type of address to reserve, either INTERNAL or EXTERNAL.
- If unspecified, defaults to EXTERNAL.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
name:
description:
- Name of the resource. 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
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take
the following values: PREMIUM or STANDARD. If this field is not specified,
it is assumed to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address
is specified, it must be within the subnetwork's IP range.
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
returned: success
type: dict
users:
description:
- The URLs of the resources that are using this address.
returned: success
type: list
region:
description:
- URL of the region where the regional address resides.
- This field is not applicable to global addresses.
returned: success
type: str
'''
################################################################################
@ -155,7 +155,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_backend_bucket_facts
description:
- Gather facts for GCP BackendBucket
- Gather facts for GCP BackendBucket
short_description: Gather facts for GCP BackendBucket
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,46 +61,46 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
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
description: List of items
returned: always
type: complex
contains:
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
'''
################################################################################
@ -122,7 +121,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

File diff suppressed because it is too large Load diff

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_backend_service_facts
description:
- Gather facts for GCP BackendService
- Gather facts for GCP BackendService
short_description: Gather facts for GCP BackendService
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,265 +61,272 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
affinityCookieTtlSec:
description:
- Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to
0, the cookie is non-persistent and lasts only until the end of the browser session
(or equivalent). The maximum allowed value for TTL is one day.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: int
backends:
description:
- The list of backends that serve this BackendService.
returned: success
type: complex
contains:
balancingMode:
description:
- Specifies the balancing mode for this backend.
- For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid
values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL).
- This cannot be used for internal load balancing.
returned: success
type: str
capacityScaler:
description:
- A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION,
RATE or CONNECTION).
- Default value is 1, which means the group will serve up to 100% of its configured
capacity (depending on balancingMode). A setting of 0 means the group is completely
drained, offering 0% of its available Capacity. Valid range is [0.0,1.0].
- This cannot be used for internal load balancing.
returned: success
type: str
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
group:
description:
- This instance group defines the list of instances that serve traffic. Member virtual
machine instances from each instance group must live in the same zone as the instance
group itself.
- No two backends in a backend service are allowed to use same Instance Group resource.
- When the BackendService has load balancing scheme INTERNAL, the instance group must
be in a zone within the same region as the BackendService.
returned: success
type: dict
maxConnections:
description:
- The max number of simultaneous connections for the group. Can be used with either
CONNECTION or UTILIZATION balancing modes.
- For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be
set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxConnectionsPerInstance:
description:
- The max number of simultaneous connections that a single backend instance can handle.
This is used to calculate the capacity of the group. Can be used in either CONNECTION
or UTILIZATION balancing modes.
- For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be
set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxRate:
description:
- The max requests per second (RPS) of the group.
- Can be used with either RATE or UTILIZATION balancing modes, but required if RATE
mode. For RATE mode, either maxRate or maxRatePerInstance must be set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxRatePerInstance:
description:
- The max requests per second (RPS) that a single backend instance can handle. This
is used to calculate the capacity of the group. Can be used in either balancing
mode. For RATE mode, either maxRate or maxRatePerInstance must be set.
- This cannot be used for internal load balancing.
returned: success
type: str
maxUtilization:
description:
- Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target
for the group. The default is 0.8. Valid range is [0.0, 1.0].
- This cannot be used for internal load balancing.
returned: success
type: str
cdnPolicy:
description:
- Cloud CDN configuration for this BackendService.
returned: success
type: complex
contains:
cacheKeyPolicy:
description:
- The CacheKeyPolicy for this CdnPolicy.
returned: success
type: complex
contains:
includeHost:
description:
- If true requests to different hosts will be cached separately.
returned: success
type: bool
includeProtocol:
description:
- If true, http and https requests will be cached separately.
returned: success
type: bool
includeQueryString:
description:
- If true, include query string parameters in the cache key according to query_string_whitelist
and query_string_blacklist. If neither is set, the entire query string will be included.
- If false, the query string will be excluded from the cache key entirely.
returned: success
type: bool
queryStringBlacklist:
description:
- Names of query string parameters to exclude in cache keys.
- All other parameters will be included. Either specify query_string_whitelist or
query_string_blacklist, not both.
- "'&' and '=' will be percent encoded and not treated as delimiters."
returned: success
type: list
queryStringWhitelist:
description:
- Names of query string parameters to include in cache keys.
- All other parameters will be excluded. Either specify query_string_whitelist or
query_string_blacklist, not both.
- "'&' and '=' will be percent encoded and not treated as delimiters."
returned: success
type: list
connectionDraining:
description:
- Settings for connection draining.
returned: success
type: complex
contains:
drainingTimeoutSec:
description:
- Time for which instance will be drained (not accept new connections, but still work
to finish started).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
affinityCookieTtlSec:
description:
- Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If
set to 0, the cookie is non-persistent and lasts only until the end of the
browser session (or equivalent). The maximum allowed value for TTL is one
day.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: int
backends:
description:
- The list of backends that serve this BackendService.
returned: success
type: complex
contains:
balancingMode:
description:
- Specifies the balancing mode for this backend.
- For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION.
Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL).
- This cannot be used for internal load balancing.
returned: success
type: str
capacityScaler:
description:
- A multiplier applied to the group's maximum servicing capacity (based
on UTILIZATION, RATE or CONNECTION).
- Default value is 1, which means the group will serve up to 100% of its
configured capacity (depending on balancingMode). A setting of 0 means
the group is completely drained, offering 0% of its available Capacity.
Valid range is [0.0,1.0].
- This cannot be used for internal load balancing.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
enableCDN:
description:
- If true, enable Cloud CDN for this BackendService.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: bool
healthChecks:
description:
- The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health
checking this BackendService. Currently at most one health check can be specified,
and a health check is required.
- For internal load balancing, a URL to a HealthCheck resource must be specified instead.
returned: success
type: list
id:
description:
- The unique identifier for the resource.
returned: success
type: int
iap:
description:
- Settings for enabling Cloud Identity Aware Proxy.
returned: success
type: complex
contains:
enabled:
description:
- Enables IAP.
returned: success
type: bool
oauth2ClientId:
description:
- OAuth2 Client ID for IAP.
returned: success
type: str
oauth2ClientSecret:
description:
- OAuth2 Client Secret for IAP.
returned: success
type: str
oauth2ClientSecretSha256:
description:
- OAuth2 Client Secret SHA-256 for IAP.
returned: success
type: str
loadBalancingScheme:
description:
- Indicates whether the backend service will be used with internal or external load
balancing. A backend service created for one type of load balancing cannot be used
with the other.
returned: success
type: str
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
portName:
description:
- Name of backend port. The same name should appear in the instance groups referenced
by this service. Required when the load balancing scheme is EXTERNAL.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: str
protocol:
description:
- The protocol this BackendService uses to communicate with backends.
- Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP.
- For internal load balancing, the possible values are TCP and UDP, and the default
is TCP.
returned: success
type: str
region:
description:
- The region where the regional backend service resides.
- This field is not applicable to global backend services.
returned: success
type: str
sessionAffinity:
description:
- Type of session affinity to use. The default is NONE.
- When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE.
- When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO,
or CLIENT_IP_PORT_PROTO.
- When the protocol is UDP, this field is not used.
returned: success
type: str
timeoutSec:
description:
- How many seconds to wait for the backend before considering it a failed request.
Default is 30 seconds. Valid range is [1, 86400].
returned: success
type: int
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
group:
description:
- This instance group defines the list of instances that serve traffic.
Member virtual machine instances from each instance group must live in
the same zone as the instance group itself.
- No two backends in a backend service are allowed to use same Instance
Group resource.
- When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService.
returned: success
type: dict
maxConnections:
description:
- The max number of simultaneous connections for the group. Can be used
with either CONNECTION or UTILIZATION balancing modes.
- For CONNECTION mode, either maxConnections or maxConnectionsPerInstance
must be set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxConnectionsPerInstance:
description:
- The max number of simultaneous connections that a single backend instance
can handle. This is used to calculate the capacity of the group. Can be
used in either CONNECTION or UTILIZATION balancing modes.
- For CONNECTION mode, either maxConnections or maxConnectionsPerInstance
must be set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxRate:
description:
- The max requests per second (RPS) of the group.
- Can be used with either RATE or UTILIZATION balancing modes, but required
if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must
be set.
- This cannot be used for internal load balancing.
returned: success
type: int
maxRatePerInstance:
description:
- The max requests per second (RPS) that a single backend instance can handle.
This is used to calculate the capacity of the group. Can be used in either
balancing mode. For RATE mode, either maxRate or maxRatePerInstance must
be set.
- This cannot be used for internal load balancing.
returned: success
type: str
maxUtilization:
description:
- Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization
target for the group. The default is 0.8. Valid range is [0.0, 1.0].
- This cannot be used for internal load balancing.
returned: success
type: str
cdnPolicy:
description:
- Cloud CDN configuration for this BackendService.
returned: success
type: complex
contains:
cacheKeyPolicy:
description:
- The CacheKeyPolicy for this CdnPolicy.
returned: success
type: complex
contains:
includeHost:
description:
- If true requests to different hosts will be cached separately.
returned: success
type: bool
includeProtocol:
description:
- If true, http and https requests will be cached separately.
returned: success
type: bool
includeQueryString:
description:
- If true, include query string parameters in the cache key according
to query_string_whitelist and query_string_blacklist. If neither is
set, the entire query string will be included.
- If false, the query string will be excluded from the cache key entirely.
returned: success
type: bool
queryStringBlacklist:
description:
- Names of query string parameters to exclude in cache keys.
- All other parameters will be included. Either specify query_string_whitelist
or query_string_blacklist, not both.
- "'&' and '=' will be percent encoded and not treated as delimiters."
returned: success
type: list
queryStringWhitelist:
description:
- Names of query string parameters to include in cache keys.
- All other parameters will be excluded. Either specify query_string_whitelist
or query_string_blacklist, not both.
- "'&' and '=' will be percent encoded and not treated as delimiters."
returned: success
type: list
connectionDraining:
description:
- Settings for connection draining.
returned: success
type: complex
contains:
drainingTimeoutSec:
description:
- Time for which instance will be drained (not accept new connections, but
still work to finish started).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
enableCDN:
description:
- If true, enable Cloud CDN for this BackendService.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: bool
healthChecks:
description:
- The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health
checking this BackendService. Currently at most one health check can be specified,
and a health check is required.
- For internal load balancing, a URL to a HealthCheck resource must be specified
instead.
returned: success
type: list
id:
description:
- The unique identifier for the resource.
returned: success
type: int
iap:
description:
- Settings for enabling Cloud Identity Aware Proxy.
returned: success
type: complex
contains:
enabled:
description:
- Enables IAP.
returned: success
type: bool
oauth2ClientId:
description:
- OAuth2 Client ID for IAP.
returned: success
type: str
oauth2ClientSecret:
description:
- OAuth2 Client Secret for IAP.
returned: success
type: str
oauth2ClientSecretSha256:
description:
- OAuth2 Client Secret SHA-256 for IAP.
returned: success
type: str
loadBalancingScheme:
description:
- Indicates whether the backend service will be used with internal or external
load balancing. A backend service created for one type of load balancing cannot
be used with the other.
returned: success
type: str
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
portName:
description:
- Name of backend port. The same name should appear in the instance groups referenced
by this service. Required when the load balancing scheme is EXTERNAL.
- When the load balancing scheme is INTERNAL, this field is not used.
returned: success
type: str
protocol:
description:
- The protocol this BackendService uses to communicate with backends.
- Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP.
- For internal load balancing, the possible values are TCP and UDP, and the
default is TCP.
returned: success
type: str
region:
description:
- The region where the regional backend service resides.
- This field is not applicable to global backend services.
returned: success
type: str
sessionAffinity:
description:
- Type of session affinity to use. The default is NONE.
- When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE.
- When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO,
or CLIENT_IP_PORT_PROTO.
- When the protocol is UDP, this field is not used.
returned: success
type: str
timeoutSec:
description:
- How many seconds to wait for the backend before considering it a failed request.
Default is 30 seconds. Valid range is [1, 86400].
returned: success
type: int
'''
################################################################################
@ -341,7 +347,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,155 +32,156 @@ DOCUMENTATION = '''
---
module: gcp_compute_disk
description:
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
short_description: Creates a GCP Disk
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
required: false
version_added: 2.7
licenses:
description:
- Any applicable publicly visible licenses.
required: false
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
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
required: false
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
required: false
version_added: 2.7
source_image:
description:
- The source image used to create this disk. If the source image is deleted, this
field will not be set.
- 'To create a disk with one of the public operating system images, specify the
image by its family name. For example, specify family/debian-8 to use the latest
Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively,
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD
To create a disk with a private image that you created, specify the image name
in the following format: global/images/my-private-image You can also specify
a private image by its image family, which returns the latest version of the
image in that family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
required: false
zone:
description:
- A reference to the zone where the disk resides.
required: true
source_image_encryption_key:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
labels:
sha256:
description:
- Labels to apply to this disk. A list of key->value pairs.
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
version_added: 2.7
licenses:
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
required: false
suboptions:
raw_key:
description:
- Any applicable publicly visible licenses.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
name:
sha256:
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
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
type:
source_snapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively,
you can set this source_snapshot to a dictionary with the selfLink key where
the value is the selfLink of your Snapshot'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
version_added: 2.7
source_image:
sha256:
description:
- The source image used to create this disk. If the source image is deleted, this
field will not be set.
- 'To create a disk with one of the public operating system images, specify the image
by its family name. For example, specify family/debian-8 to use the latest Debian
8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use
a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To
create a disk with a private image that you created, specify the image name in the
following format: global/images/my-private-image You can also specify a private
image by its image family, which returns the latest version of the image in that
family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
zone:
description:
- A reference to the zone where the disk resides.
required: true
source_image_encryption_key:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
source_snapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively,
you can set this source_snapshot to a dictionary with the selfLink key where the
value is the selfLink of your Snapshot.'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)"
- "Adding a persistent disk: U(https://cloud.google.com/compute/docs/disks/add-persistent-disk)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)'
- 'Adding a persistent disk: U(https://cloud.google.com/compute/docs/disks/add-persistent-disk)'
'''
EXAMPLES = '''
@ -198,188 +199,187 @@ EXAMPLES = '''
'''
RETURN = '''
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
sourceImage:
description:
- The source image used to create this disk. If the source image is deleted, this
field will not be set.
- 'To create a disk with one of the public operating system images, specify the image
by its family name. For example, specify family/debian-8 to use the latest Debian
8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use
a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To
create a disk with a private image that you created, specify the image name in the
following format: global/images/my-private-image You can also specify a private
image by its image family, which returns the latest version of the image in that
family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
returned: success
type: str
zone:
description:
- A reference to the zone where the disk resides.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceImageId:
description:
- The ID value of the image used to create this disk. This value identifies the exact
image that was used to create this persistent disk. For example, if you created
the persistent disk from an image that was later deleted and recreated under the
same name, the source image ID would identify the exact version of the image that
was used.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
returned: success
type: str
sourceImage:
description:
- The source image used to create this disk. If the source image is deleted, this
field will not be set.
- 'To create a disk with one of the public operating system images, specify the
image by its family name. For example, specify family/debian-8 to use the latest
Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively,
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD
To create a disk with a private image that you created, specify the image name
in the following format: global/images/my-private-image You can also specify a
private image by its image family, which returns the latest version of the image
in that family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
returned: success
type: str
zone:
description:
- A reference to the zone where the disk resides.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceImageId:
description:
- The ID value of the image used to create this disk. This value identifies the
exact image that was used to create this persistent disk. For example, if you
created the persistent disk from an image that was later deleted and recreated
under the same name, the source image ID would identify the exact version of the
image that was used.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or
to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted and
recreated under the same name, the source snapshot ID would identify the exact
version of the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -510,9 +510,9 @@ def delete(module, link, kind):
def resource_to_request(module):
request = {
u'kind': 'compute#disk',
u'sourceImageEncryptionKey': DiskSourceImageEncryptionKey(module.params.get('source_image_encryption_key', {}), module).to_request(),
u'diskEncryptionKey': DiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': DiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'sourceImageEncryptionKey': DiskSourceimageencryptionkey(module.params.get('source_image_encryption_key', {}), module).to_request(),
u'diskEncryptionKey': DiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': DiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'description': module.params.get('description'),
u'labels': module.params.get('labels'),
u'licenses': module.params.get('licenses'),
@ -634,8 +634,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
@ -647,7 +645,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class DiskSourceImageEncryptionKey(object):
class DiskSourceimageencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -668,7 +666,7 @@ class DiskSourceImageEncryptionKey(object):
})
class DiskDiskEncryptionKey(object):
class DiskDiskencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -689,7 +687,7 @@ class DiskDiskEncryptionKey(object):
})
class DiskSourceSnapshotEncryptionKey(object):
class DiskSourcesnapshotencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_disk_facts
description:
- Gather facts for GCP Disk
- Gather facts for GCP Disk
short_description: Gather facts for GCP Disk
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
zone:
description:
- A reference to the zone where the disk resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
zone:
description:
- A reference to the zone where the disk resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,192 +66,193 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
sourceImage:
description:
- The source image used to create this disk. If the source image is deleted, this
field will not be set.
- 'To create a disk with one of the public operating system images, specify the image
by its family name. For example, specify family/debian-8 to use the latest Debian
8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use
a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To
create a disk with a private image that you created, specify the image name in the
following format: global/images/my-private-image You can also specify a private
image by its image family, which returns the latest version of the image in that
family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
returned: success
type: str
zone:
description:
- A reference to the zone where the disk resides.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceImageId:
description:
- The ID value of the image used to create this disk. This value identifies the exact
image that was used to create this persistent disk. For example, if you created
the persistent disk from an image that was later deleted and recreated under the
same name, the source image ID would identify the exact version of the image that
was used.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of
the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create
the disk. Provide this when creating the disk.
returned: success
type: str
sourceImage:
description:
- The source image used to create this disk. If the source image is deleted,
this field will not be set.
- 'To create a disk with one of the public operating system images, specify
the image by its family name. For example, specify family/debian-8 to use
the latest Debian 8 image: projects/debian-cloud/global/images/family/debian-8
Alternatively, use a specific version of a public operating system image:
projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To create a
disk with a private image that you created, specify the image name in the
following format: global/images/my-private-image You can also specify a private
image by its image family, which returns the latest version of the image in
that family. Replace the image name with family/family-name: global/images/family/my-private-family
.'
returned: success
type: str
zone:
description:
- A reference to the zone where the disk resides.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the
source image is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceImageId:
description:
- The ID value of the image used to create this disk. This value identifies
the exact image that was used to create this persistent disk. For example,
if you created the persistent disk from an image that was later deleted and
recreated under the same name, the source image ID would identify the exact
version of the image that was used.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the
disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need
to provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted
and recreated under the same name, the source snapshot ID would identify the
exact version of the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -274,7 +274,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,182 +32,190 @@ DOCUMENTATION = '''
---
module: gcp_compute_firewall
description:
- Each network has its own firewall controlling access to and from the instances.
- All traffic to instances, even from other instances, is blocked by the firewall
unless firewall rules are created to allow it.
- The default network has automatically created firewall rules that are shown in default
firewall rules. No manually created network has automatically created firewall rules
except for a default "allow" rule for outgoing traffic and a default "deny" for
incoming traffic. For all networks except the default network, you must create any
firewall rules you need.
- Each network has its own firewall controlling access to and from the instances.
- All traffic to instances, even from other instances, is blocked by the firewall
unless firewall rules are created to allow it.
- The default network has automatically created firewall rules that are shown in default
firewall rules. No manually created network has automatically created firewall rules
except for a default "allow" rule for outgoing traffic and a default "deny" for
incoming traffic. For all networks except the default network, you must create any
firewall rules you need.
short_description: Creates a GCP Firewall
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'
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a permitted connection.
required: false
suboptions:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
required: true
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
required: false
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
required: false
version_added: 2.8
suboptions:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
required: true
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
required: false
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a permitted connection.
required: false
suboptions:
ip_protocol:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
destination_ranges:
description:
- If destination ranges are specified, the firewall will apply only to traffic that
has destination IP address in these ranges. These ranges must be expressed in CIDR
format. Only IPv4 is supported.
required: false
version_added: 2.8
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS. Note:
For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
required: false
version_added: 2.8
choices: ['INGRESS', 'EGRESS']
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
required: false
type: bool
version_added: 2.8
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.
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol
number.
required: true
network:
ports:
description:
- 'URL of the network resource for this firewall rule. If not specified when creating
a firewall rule, the default network is used: global/networks/default If you choose to
specify this property, you can specify the network as a full or partial URL. For
example, the following are all valid URLs:
U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network
global/networks/default .'
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
- An optional list of ports to which this rule applies. This field is only
applicable for UDP or TCP protocol. Each entry must be either an integer
or a range. If not specified, this rule applies to connections through any
port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
required: false
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
required: false
version_added: 2.8
suboptions:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol
number.
required: true
priority:
ports:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine precedence
of conflicting rules. Lower value of priority implies higher precedence (eg, a rule
with priority 0 has higher precedence than a rule with priority 1). DENY rules take
precedence over ALLOW rules having equal priority.
required: false
default: 1000
version_added: 2.8
source_ranges:
description:
- If source ranges are specified, the firewall will apply only to traffic that has
source IP address in these ranges. These ranges must be expressed in CIDR format.
One or both of sourceRanges and sourceTags may be set. If both properties are set,
the firewall will apply to traffic that has source IP address within sourceRanges
OR the source IP that belongs to a tag listed in the sourceTags property. The connection
does not need to match both properties for the firewall to apply. Only IPv4 is supported.
required: false
source_service_accounts:
description:
- If source service accounts are specified, the firewall will apply only to traffic
originating from an instance with a service account in this list. Source service
accounts cannot be used to control traffic to an instance's external IP address
because service accounts are associated with an instance, not an IP address. sourceRanges
can be set at the same time as sourceServiceAccounts. If both are set, the firewall
will apply to traffic that has source IP address within sourceRanges OR the source
IP belongs to an instance with service account listed in sourceServiceAccount. The
connection does not need to match both properties for the firewall to apply. sourceServiceAccounts
cannot be used at the same time as sourceTags or targetTags.
required: false
version_added: 2.8
source_tags:
description:
- If source tags are specified, the firewall will apply only to traffic with source
IP that belongs to a tag listed in source tags. Source tags cannot be used to control
traffic to an instance's external IP address. Because tags are associated with an
instance, not an IP address. One or both of sourceRanges and sourceTags may be set.
If both properties are set, the firewall will apply to traffic that has source IP
address within sourceRanges OR the source IP that belongs to a tag listed in the
sourceTags property. The connection does not need to match both properties for the
firewall to apply.
required: false
target_service_accounts:
description:
- A list of service accounts indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall rule
applies to all instances on the specified network.
required: false
version_added: 2.8
target_tags:
description:
- A list of instance tags indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances on the
specified network.
- An optional list of ports to which this rule applies. This field is only
applicable for UDP or TCP protocol. Each entry must be either an integer
or a range. If not specified, this rule applies to connections through any
port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
required: false
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
destination_ranges:
description:
- If destination ranges are specified, the firewall will apply only to traffic
that has destination IP address in these ranges. These ranges must be expressed
in CIDR format. Only IPv4 is supported.
required: false
version_added: 2.8
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS. Note:
For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
required: false
version_added: 2.8
choices:
- INGRESS
- EGRESS
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network
it is associated with. When set to true, the firewall rule is not enforced and
the network behaves as if it did not exist. If this is unspecified, the firewall
rule will be enabled.
required: false
type: bool
version_added: 2.8
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
network:
description:
- 'URL of the network resource for this firewall rule. If not specified when creating
a firewall rule, the default network is used: global/networks/default If you
choose to specify this property, you can specify the network as a full or partial
URL. For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: true
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine
precedence of conflicting rules. Lower value of priority implies higher precedence
(eg, a rule with priority 0 has higher precedence than a rule with priority
1). DENY rules take precedence over ALLOW rules having equal priority.
required: false
default: '1000'
version_added: 2.8
source_ranges:
description:
- If source ranges are specified, the firewall will apply only to traffic that
has source IP address in these ranges. These ranges must be expressed in CIDR
format. One or both of sourceRanges and sourceTags may be set. If both properties
are set, the firewall will apply to traffic that has source IP address within
sourceRanges OR the source IP that belongs to a tag listed in the sourceTags
property. The connection does not need to match both properties for the firewall
to apply. Only IPv4 is supported.
required: false
source_service_accounts:
description:
- If source service accounts are specified, the firewall will apply only to traffic
originating from an instance with a service account in this list. Source service
accounts cannot be used to control traffic to an instance's external IP address
because service accounts are associated with an instance, not an IP address.
sourceRanges can be set at the same time as sourceServiceAccounts. If both are
set, the firewall will apply to traffic that has source IP address within sourceRanges
OR the source IP belongs to an instance with service account listed in sourceServiceAccount.
The connection does not need to match both properties for the firewall to apply.
sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags.
required: false
version_added: 2.8
source_tags:
description:
- If source tags are specified, the firewall will apply only to traffic with source
IP that belongs to a tag listed in source tags. Source tags cannot be used to
control traffic to an instance's external IP address. Because tags are associated
with an instance, not an IP address. One or both of sourceRanges and sourceTags
may be set. If both properties are set, the firewall will apply to traffic that
has source IP address within sourceRanges OR the source IP that belongs to a
tag listed in the sourceTags property. The connection does not need to match
both properties for the firewall to apply.
required: false
target_service_accounts:
description:
- A list of service accounts indicating sets of instances located in the network
that may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall
rule applies to all instances on the specified network.
required: false
version_added: 2.8
target_tags:
description:
- A list of instance tags indicating sets of instances located in the network
that may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances on
the specified network.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)"
- "Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)'
- 'Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)'
'''
EXAMPLES = '''
@ -230,170 +238,172 @@ EXAMPLES = '''
'''
RETURN = '''
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a permitted connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
destinationRanges:
description:
- If destination ranges are specified, the firewall will apply only to traffic that
has destination IP address in these ranges. These ranges must be expressed in CIDR
format. Only IPv4 is supported.
returned: success
type: list
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS. Note:
For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
returned: success
type: bool
id:
description:
- The 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
network:
description:
- 'URL of the network resource for this firewall rule. If not specified when creating
a firewall rule, the default network is used: global/networks/default If you choose to
specify this property, you can specify the network as a full or partial URL. For
example, the following are all valid URLs:
U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network
global/networks/default .'
returned: success
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine precedence
of conflicting rules. Lower value of priority implies higher precedence (eg, a rule
with priority 0 has higher precedence than a rule with priority 1). DENY rules take
precedence over ALLOW rules having equal priority.
returned: success
type: int
sourceRanges:
description:
- If source ranges are specified, the firewall will apply only to traffic that has
source IP address in these ranges. These ranges must be expressed in CIDR format.
One or both of sourceRanges and sourceTags may be set. If both properties are set,
the firewall will apply to traffic that has source IP address within sourceRanges
OR the source IP that belongs to a tag listed in the sourceTags property. The connection
does not need to match both properties for the firewall to apply. Only IPv4 is supported.
returned: success
type: list
sourceServiceAccounts:
description:
- If source service accounts are specified, the firewall will apply only to traffic
originating from an instance with a service account in this list. Source service
accounts cannot be used to control traffic to an instance's external IP address
because service accounts are associated with an instance, not an IP address. sourceRanges
can be set at the same time as sourceServiceAccounts. If both are set, the firewall
will apply to traffic that has source IP address within sourceRanges OR the source
IP belongs to an instance with service account listed in sourceServiceAccount. The
connection does not need to match both properties for the firewall to apply. sourceServiceAccounts
cannot be used at the same time as sourceTags or targetTags.
returned: success
type: list
sourceTags:
description:
- If source tags are specified, the firewall will apply only to traffic with source
IP that belongs to a tag listed in source tags. Source tags cannot be used to control
traffic to an instance's external IP address. Because tags are associated with an
instance, not an IP address. One or both of sourceRanges and sourceTags may be set.
If both properties are set, the firewall will apply to traffic that has source IP
address within sourceRanges OR the source IP that belongs to a tag listed in the
sourceTags property. The connection does not need to match both properties for the
firewall to apply.
returned: success
type: list
targetServiceAccounts:
description:
- A list of service accounts indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall rule
applies to all instances on the specified network.
returned: success
type: list
targetTags:
description:
- A list of instance tags indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances on the
specified network.
returned: success
type: list
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a permitted connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol
number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range.
If not specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol
number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range.
If not specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
destinationRanges:
description:
- If destination ranges are specified, the firewall will apply only to traffic that
has destination IP address in these ranges. These ranges must be expressed in
CIDR format. Only IPv4 is supported.
returned: success
type: list
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS. Note:
For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network
it is associated with. When set to true, the firewall rule is not enforced and
the network behaves as if it did not exist. If this is unspecified, the firewall
rule will be enabled.
returned: success
type: bool
id:
description:
- The 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
network:
description:
- 'URL of the network resource for this firewall rule. If not specified when creating
a firewall rule, the default network is used: global/networks/default If you choose
to specify this property, you can specify the network as a full or partial URL.
For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
returned: success
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine precedence
of conflicting rules. Lower value of priority implies higher precedence (eg, a
rule with priority 0 has higher precedence than a rule with priority 1). DENY
rules take precedence over ALLOW rules having equal priority.
returned: success
type: int
sourceRanges:
description:
- If source ranges are specified, the firewall will apply only to traffic that has
source IP address in these ranges. These ranges must be expressed in CIDR format.
One or both of sourceRanges and sourceTags may be set. If both properties are
set, the firewall will apply to traffic that has source IP address within sourceRanges
OR the source IP that belongs to a tag listed in the sourceTags property. The
connection does not need to match both properties for the firewall to apply. Only
IPv4 is supported.
returned: success
type: list
sourceServiceAccounts:
description:
- If source service accounts are specified, the firewall will apply only to traffic
originating from an instance with a service account in this list. Source service
accounts cannot be used to control traffic to an instance's external IP address
because service accounts are associated with an instance, not an IP address. sourceRanges
can be set at the same time as sourceServiceAccounts. If both are set, the firewall
will apply to traffic that has source IP address within sourceRanges OR the source
IP belongs to an instance with service account listed in sourceServiceAccount.
The connection does not need to match both properties for the firewall to apply.
sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags.
returned: success
type: list
sourceTags:
description:
- If source tags are specified, the firewall will apply only to traffic with source
IP that belongs to a tag listed in source tags. Source tags cannot be used to
control traffic to an instance's external IP address. Because tags are associated
with an instance, not an IP address. One or both of sourceRanges and sourceTags
may be set. If both properties are set, the firewall will apply to traffic that
has source IP address within sourceRanges OR the source IP that belongs to a tag
listed in the sourceTags property. The connection does not need to match both
properties for the firewall to apply.
returned: success
type: list
targetServiceAccounts:
description:
- A list of service accounts indicating sets of instances located in the network
that may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall rule
applies to all instances on the specified network.
returned: success
type: list
targetTags:
description:
- A list of instance tags indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances on
the specified network.
returned: success
type: list
'''
################################################################################
@ -609,8 +619,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_firewall_facts
description:
- Gather facts for GCP Firewall
- Gather facts for GCP Firewall
short_description: Gather facts for GCP Firewall
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,174 +61,179 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a permitted connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required when creating
a firewall rule. This value can either be one of the following well known protocol
strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only applicable
for UDP or TCP protocol. Each entry must be either an integer or a range. If not
specified, this rule applies to connections through any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
destinationRanges:
description:
- If destination ranges are specified, the firewall will apply only to traffic that
has destination IP address in these ranges. These ranges must be expressed in CIDR
format. Only IPv4 is supported.
returned: success
type: list
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS. Note:
For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
returned: success
type: bool
id:
description:
- The 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
network:
description:
- 'URL of the network resource for this firewall rule. If not specified when
creating a firewall rule, the default network is used: global/networks/default If
you choose to specify this property, you can specify the network as a full or
partial URL. For example, the following are all valid URLs:
U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network
global/networks/default .'
returned: success
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine precedence
of conflicting rules. Lower value of priority implies higher precedence (eg, a rule
with priority 0 has higher precedence than a rule with priority 1). DENY rules take
precedence over ALLOW rules having equal priority.
returned: success
type: int
sourceRanges:
description:
- If source ranges are specified, the firewall will apply only to traffic that has
source IP address in these ranges. These ranges must be expressed in CIDR format.
One or both of sourceRanges and sourceTags may be set. If both properties are set,
the firewall will apply to traffic that has source IP address within sourceRanges
OR the source IP that belongs to a tag listed in the sourceTags property. The connection
does not need to match both properties for the firewall to apply. Only IPv4 is supported.
returned: success
type: list
sourceServiceAccounts:
description:
- If source service accounts are specified, the firewall will apply only to traffic
originating from an instance with a service account in this list. Source service
accounts cannot be used to control traffic to an instance's external IP address
because service accounts are associated with an instance, not an IP address. sourceRanges
can be set at the same time as sourceServiceAccounts. If both are set, the firewall
will apply to traffic that has source IP address within sourceRanges OR the source
IP belongs to an instance with service account listed in sourceServiceAccount. The
connection does not need to match both properties for the firewall to apply. sourceServiceAccounts
cannot be used at the same time as sourceTags or targetTags.
returned: success
type: list
sourceTags:
description:
- If source tags are specified, the firewall will apply only to traffic with source
IP that belongs to a tag listed in source tags. Source tags cannot be used to control
traffic to an instance's external IP address. Because tags are associated with an
instance, not an IP address. One or both of sourceRanges and sourceTags may be set.
If both properties are set, the firewall will apply to traffic that has source IP
address within sourceRanges OR the source IP that belongs to a tag listed in the
sourceTags property. The connection does not need to match both properties for the
firewall to apply.
returned: success
type: list
targetServiceAccounts:
description:
- A list of service accounts indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall rule
applies to all instances on the specified network.
returned: success
type: list
targetTags:
description:
- A list of instance tags indicating sets of instances located in the network that
may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances on the
specified network.
returned: success
type: list
description: List of items
returned: always
type: complex
contains:
allowed:
description:
- The list of ALLOW rules specified by this firewall. Each rule specifies a
protocol and port-range tuple that describes a permitted connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP
protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only
applicable for UDP or TCP protocol. Each entry must be either an integer
or a range. If not specified, this rule applies to connections through
any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
denied:
description:
- The list of DENY rules specified by this firewall. Each rule specifies a protocol
and port-range tuple that describes a denied connection.
returned: success
type: complex
contains:
ip_protocol:
description:
- The IP protocol to which this rule applies. The protocol type is required
when creating a firewall rule. This value can either be one of the following
well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP
protocol number.
returned: success
type: str
ports:
description:
- An optional list of ports to which this rule applies. This field is only
applicable for UDP or TCP protocol. Each entry must be either an integer
or a range. If not specified, this rule applies to connections through
any port.
- 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].'
returned: success
type: list
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
destinationRanges:
description:
- If destination ranges are specified, the firewall will apply only to traffic
that has destination IP address in these ranges. These ranges must be expressed
in CIDR format. Only IPv4 is supported.
returned: success
type: list
direction:
description:
- 'Direction of traffic to which this firewall applies; default is INGRESS.
Note: For INGRESS traffic, it is NOT supported to specify destinationRanges;
For EGRESS traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network
it is associated with. When set to true, the firewall rule is not enforced
and the network behaves as if it did not exist. If this is unspecified, the
firewall rule will be enabled.
returned: success
type: bool
id:
description:
- The 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
network:
description:
- 'URL of the network resource for this firewall rule. If not specified when
creating a firewall rule, the default network is used: global/networks/default
If you choose to specify this property, you can specify the network as a full
or partial URL. For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/)
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
returned: success
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
When not specified, the value assumed is 1000. Relative priorities determine
precedence of conflicting rules. Lower value of priority implies higher precedence
(eg, a rule with priority 0 has higher precedence than a rule with priority
1). DENY rules take precedence over ALLOW rules having equal priority.
returned: success
type: int
sourceRanges:
description:
- If source ranges are specified, the firewall will apply only to traffic that
has source IP address in these ranges. These ranges must be expressed in CIDR
format. One or both of sourceRanges and sourceTags may be set. If both properties
are set, the firewall will apply to traffic that has source IP address within
sourceRanges OR the source IP that belongs to a tag listed in the sourceTags
property. The connection does not need to match both properties for the firewall
to apply. Only IPv4 is supported.
returned: success
type: list
sourceServiceAccounts:
description:
- If source service accounts are specified, the firewall will apply only to
traffic originating from an instance with a service account in this list.
Source service accounts cannot be used to control traffic to an instance's
external IP address because service accounts are associated with an instance,
not an IP address. sourceRanges can be set at the same time as sourceServiceAccounts.
If both are set, the firewall will apply to traffic that has source IP address
within sourceRanges OR the source IP belongs to an instance with service account
listed in sourceServiceAccount. The connection does not need to match both
properties for the firewall to apply. sourceServiceAccounts cannot be used
at the same time as sourceTags or targetTags.
returned: success
type: list
sourceTags:
description:
- If source tags are specified, the firewall will apply only to traffic with
source IP that belongs to a tag listed in source tags. Source tags cannot
be used to control traffic to an instance's external IP address. Because tags
are associated with an instance, not an IP address. One or both of sourceRanges
and sourceTags may be set. If both properties are set, the firewall will apply
to traffic that has source IP address within sourceRanges OR the source IP
that belongs to a tag listed in the sourceTags property. The connection does
not need to match both properties for the firewall to apply.
returned: success
type: list
targetServiceAccounts:
description:
- A list of service accounts indicating sets of instances located in the network
that may make network connections as specified in allowed[].
- targetServiceAccounts cannot be used at the same time as targetTags or sourceTags.
If neither targetServiceAccounts nor targetTags are specified, the firewall
rule applies to all instances on the specified network.
returned: success
type: list
targetTags:
description:
- A list of instance tags indicating sets of instances located in the network
that may make network connections as specified in allowed[].
- If no targetTags are specified, the firewall rule applies to all instances
on the specified network.
returned: success
type: list
'''
################################################################################
@ -250,7 +254,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,168 +32,185 @@ DOCUMENTATION = '''
---
module: gcp_compute_forwarding_rule
description:
- A ForwardingRule resource. A ForwardingRule resource specifies which pool of target
virtual machines to forward a packet to if it matches the given [IPAddress, IPProtocol,
portRange] tuple.
- A ForwardingRule resource. A ForwardingRule resource specifies which pool of target
virtual machines to forward a packet to if it matches the given [IPAddress, IPProtocol,
portRange] tuple.
short_description: Creates a GCP ForwardingRule
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'
state:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ip_address:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
required: false
ip_protocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
required: false
choices: ['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']
backend_service:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively,
you can set this backend_service to a dictionary with the selfLink key where the
value is the selfLink of your BackendService.'
required: false
ip_version:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
required: false
choices: ['IPV4', 'IPV6']
load_balancing_scheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
required: false
choices: ['INTERNAL', 'EXTERNAL']
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: false
port_range:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
required: false
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
required: false
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the value
is the selfLink of your Subnetwork.'
required: false
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the forwarding
rule. For global forwarding rules, this target must be a global load balancing resource.
The forwarded traffic must be of a type appropriate to the target object.
- This field is not used for internal load balancing.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this target field to "{{ name-of-resource }}" Alternatively, you
can set this target to a dictionary with the selfLink key where the value is the
selfLink of your TargetPool.'
required: false
version_added: 2.7
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
required: false
version_added: 2.8
choices: ['PREMIUM', 'STANDARD']
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ip_address:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the
address must be a global IP, and for regional forwarding rules, the address
must live in the same region as the forwarding rule. If this field is empty,
an ephemeral IPv4 address from the same scope (global or regional) will be assigned.
A regional forwarding rule supports IPv4 only. A global forwarding rule supports
either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP
address belonging to the network/subnet configured for the forwarding rule.
By default, if this field is empty, an ephemeral internal IP address will be
automatically allocated from the IP range of the subnet or network configured
for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
required: false
ip_protocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
required: false
choices:
- TCP
- UDP
- ESP
- AH
- SCTP
- ICMP
backend_service:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively,
you can set this backend_service to a dictionary with the selfLink key where
the value is the selfLink of your BackendService'
required: false
ip_version:
description:
- The IP Version that will be used by this forwarding rule. Valid options are
IPV4 or IPV6. This can only be specified for a global forwarding rule.
required: false
choices:
- IPV4
- IPV6
load_balancing_scheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
means that this will be used for External Load Balancing (HTTP(S) LB, External
TCP/UDP LB, SSL Proxy) .'
required: false
choices:
- INTERNAL
- EXTERNAL
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
network:
description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: false
port_range:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed
to ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: *
TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43,
110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25,
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
required: false
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
required: false
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the
value is the selfLink of your Subnetwork'
required: false
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the
forwarding rule. For global forwarding rules, this target must be a global load
balancing resource. The forwarded traffic must be of a type appropriate to the
target object.
- This field is not used for internal load balancing.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this target field to "{{ name-of-resource }}" Alternatively,
you can set this target to a dictionary with the selfLink key where the value
is the selfLink of your TargetPool'
required: false
version_added: 2.7
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take
the following values: PREMIUM or STANDARD. If this field is not specified, it
is assumed to be PREMIUM.'
required: false
version_added: 2.8
choices:
- PREMIUM
- STANDARD
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/forwardingRule)"
- "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/forwardingRule)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules)'
'''
EXAMPLES = '''
@ -232,152 +249,148 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the forwarding
rule. For global forwarding rules, this target must be a global load balancing resource.
The forwarded traffic must be of a type appropriate to the target object.
- This field is not used for internal load balancing.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live
in the same region as the forwarding rule. If this field is empty, an ephemeral
IPv4 address from the same scope (global or regional) will be assigned. A regional
forwarding rule supports IPv4 only. A global forwarding rule supports either IPv4
or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically
allocated from the IP range of the subnet or network configured for this forwarding
rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
means that this will be used for External Load Balancing (HTTP(S) LB, External
TCP/UDP LB, SSL Proxy) .'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified,
the default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443,
465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, 143, 195, 443,
465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will be
forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the
forwarding rule. For global forwarding rules, this target must be a global load
balancing resource. The forwarded traffic must be of a type appropriate to the
target object.
- This field is not used for internal load balancing.
returned: success
type: dict
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
'''
################################################################################
@ -476,19 +489,6 @@ def target_update(module, request, 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}/forwardingRules/{name}/setLabels"
]).format(**module.params),
{
u'labelFingerprint': response.get('labelFingerprint')
}
)
def delete(module, link, kind):
auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.delete(link))
@ -589,7 +589,6 @@ def response_to_hash(module, response):
u'ports': response.get(u'ports'),
u'subnetwork': response.get(u'subnetwork'),
u'target': response.get(u'target'),
u'labelFingerprint': response.get(u'labelFingerprint'),
u'networkTier': module.params.get('network_tier')
}
@ -618,8 +617,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

View file

@ -32,26 +32,25 @@ DOCUMENTATION = '''
---
module: gcp_compute_forwarding_rule_facts
description:
- Gather facts for GCP ForwardingRule
- Gather facts for GCP ForwardingRule
short_description: Gather facts for GCP ForwardingRule
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
required: true
extends_documentation_fragment: gcp
'''
@ -68,156 +67,154 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the forwarding
rule. For global forwarding rules, this target must be a global load balancing resource.
The forwarded traffic must be of a type appropriate to the target object.
- This field is not used for internal load balancing.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the
address must be a global IP, and for regional forwarding rules, the address
must live in the same region as the forwarding rule. If this field is empty,
an ephemeral IPv4 address from the same scope (global or regional) will be
assigned. A regional forwarding rule supports IPv4 only. A global forwarding
rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP
address belonging to the network/subnet configured for the forwarding rule.
By default, if this field is empty, an ephemeral internal IP address will
be automatically allocated from the IP range of the subnet or network configured
for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are
IPV4 or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take
the following values: INTERNAL, EXTERNAL The value of INTERNAL means that
this will be used for Internal Network Load Balancing (TCP, UDP). The value
of EXTERNAL means that this will be used for External Load Balancing (HTTP(S)
LB, External TCP/UDP LB, SSL Proxy) .'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed
to ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports:
* TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25,
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy:
25, 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load
balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the
load balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as
the forwarding rule. For global forwarding rules, this target must be a global
load balancing resource. The forwarded traffic must be of a type appropriate
to the target object.
- This field is not used for internal load balancing.
returned: success
type: dict
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take
the following values: PREMIUM or STANDARD. If this field is not specified,
it is assumed to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
'''
################################################################################
@ -239,7 +236,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,54 +32,60 @@ DOCUMENTATION = '''
---
module: gcp_compute_global_address
description:
- Represents a Global Address resource. Global addresses are used for HTTP(S) load
balancing.
- Represents a Global Address resource. Global addresses are used for HTTP(S) load
balancing.
short_description: Creates a GCP GlobalAddress
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'
state:
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
required: false
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
ip_version:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or IPV6.
The default value is IPV4.
required: false
choices: ['IPV4', 'IPV6']
address_type:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
required: false
default: EXTERNAL
version_added: 2.8
choices: ['EXTERNAL', 'INTERNAL']
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
required: false
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
ip_version:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or
IPV6. The default value is IPV4.
required: false
choices:
- IPV4
- IPV6
address_type:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
required: false
default: EXTERNAL
version_added: 2.8
choices:
- EXTERNAL
- INTERNAL
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)"
- "Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)'
- 'Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)'
'''
EXAMPLES = '''
@ -93,61 +99,55 @@ EXAMPLES = '''
'''
RETURN = '''
address:
description:
- The static external IP address represented by this resource.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
ipVersion:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or IPV6.
The default value is IPV4.
returned: success
type: str
region:
description:
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
address:
description:
- The static external IP address represented by this resource.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
ipVersion:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or IPV6.
The default value is IPV4.
returned: success
type: str
region:
description:
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
'''
################################################################################
@ -189,7 +189,7 @@ def main():
if fetch:
if state == 'present':
if is_different(module, fetch):
update(module, self_link(module), kind, fetch)
update(module, self_link(module), kind)
fetch = fetch_resource(module, self_link(module), kind)
changed = True
else:
@ -213,27 +213,8 @@ def create(module, link, kind):
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))
return fetch_resource(module, self_link(module), kind)
def update_fields(module, request, response):
pass
def label_fingerprint_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/addresses/{name}/setLabels"
]).format(**module.params),
{
u'labelFingerprint': response.get('labelFingerprint')
}
)
def update(module, link, kind):
module.fail_json(msg="GlobalAddress cannot be edited")
def delete(module, link, kind):
@ -318,7 +299,6 @@ def response_to_hash(module, response):
u'description': response.get(u'description'),
u'id': response.get(u'id'),
u'name': response.get(u'name'),
u'labelFingerprint': response.get(u'labelFingerprint'),
u'ipVersion': response.get(u'ipVersion'),
u'region': response.get(u'region'),
u'addressType': response.get(u'addressType')
@ -358,8 +338,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_global_address_facts
description:
- Gather facts for GCP GlobalAddress
- Gather facts for GCP GlobalAddress
short_description: Gather facts for GCP GlobalAddress
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,65 +61,60 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
address:
description:
- The static external IP address represented by this resource.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
ipVersion:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or IPV6.
The default value is IPV4.
returned: success
type: str
region:
description:
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
address:
description:
- The static external IP address represented by this resource.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
- Provide this property when you create the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
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
ipVersion:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or
IPV6. The default value is IPV4.
returned: success
type: str
region:
description:
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
'''
################################################################################
@ -141,7 +135,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,145 +32,159 @@ DOCUMENTATION = '''
---
module: gcp_compute_global_forwarding_rule
description:
- Represents a GlobalForwardingRule resource. Global forwarding rules are used to
forward traffic to the correct load balancer for HTTP load balancing. Global forwarding
rules can only be used for HTTP load balancing.
- For more information, see U(https://cloud.google.com/compute/docs/load-balancing/http/)
.
- Represents a GlobalForwardingRule resource. Global forwarding rules are used to
forward traffic to the correct load balancer for HTTP load balancing. Global forwarding
rules can only be used for HTTP load balancing.
- For more information, see U(https://cloud.google.com/compute/docs/load-balancing/http/)
.
short_description: Creates a GCP GlobalForwardingRule
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'
state:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ip_address:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
required: false
ip_protocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
required: false
choices: ['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']
backend_service:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively,
you can set this backend_service to a dictionary with the selfLink key where the
value is the selfLink of your BackendService.'
required: false
ip_version:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
required: false
choices: ['IPV4', 'IPV6']
load_balancing_scheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
required: false
choices: ['INTERNAL', 'EXTERNAL']
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: false
port_range:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
required: false
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
required: false
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the value
is the selfLink of your Subnetwork.'
required: false
target:
description:
- This target must be a global load balancing resource. The forwarded traffic must
be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ip_address:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the
address must be a global IP, and for regional forwarding rules, the address
must live in the same region as the forwarding rule. If this field is empty,
an ephemeral IPv4 address from the same scope (global or regional) will be assigned.
A regional forwarding rule supports IPv4 only. A global forwarding rule supports
either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP
address belonging to the network/subnet configured for the forwarding rule.
By default, if this field is empty, an ephemeral internal IP address will be
automatically allocated from the IP range of the subnet or network configured
for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
required: false
ip_protocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
required: false
choices:
- TCP
- UDP
- ESP
- AH
- SCTP
- ICMP
backend_service:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively,
you can set this backend_service to a dictionary with the selfLink key where
the value is the selfLink of your BackendService'
required: false
ip_version:
description:
- The IP Version that will be used by this forwarding rule. Valid options are
IPV4 or IPV6. This can only be specified for a global forwarding rule.
required: false
choices:
- IPV4
- IPV6
load_balancing_scheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
means that this will be used for External Load Balancing (HTTP(S) LB, External
TCP/UDP LB, SSL Proxy) .'
required: false
choices:
- INTERNAL
- EXTERNAL
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
network:
description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: false
port_range:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed
to ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: *
TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43,
110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25,
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
required: false
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
required: false
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the
value is the selfLink of your Subnetwork'
required: false
target:
description:
- This target must be a global load balancing resource. The forwarded traffic
must be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
required: false
extends_documentation_fragment: gcp
'''
@ -255,137 +269,138 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target:
description:
- This target must be a global load balancing resource. The forwarded traffic must
be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live
in the same region as the forwarding rule. If this field is empty, an ephemeral
IPv4 address from the same scope (global or regional) will be assigned. A regional
forwarding rule supports IPv4 only. A global forwarding rule supports either IPv4
or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically
allocated from the IP range of the subnet or network configured for this forwarding
rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
means that this will be used for External Load Balancing (HTTP(S) LB, External
TCP/UDP LB, SSL Proxy) .'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified,
the default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443,
465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, 143, 195, 443,
465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will be
forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target:
description:
- This target must be a global load balancing resource. The forwarded traffic must
be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success
type: str
'''
################################################################################
@ -590,8 +605,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_global_forwarding_rule_facts
description:
- Gather facts for GCP GlobalForwardingRule
- Gather facts for GCP GlobalForwardingRule
short_description: Gather facts for GCP GlobalForwardingRule
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,141 +61,144 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL
or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the address
must be a global IP, and for regional forwarding rules, the address must live in
the same region as the forwarding rule. If this field is empty, an ephemeral IPv4
address from the same scope (global or regional) will be assigned. A regional forwarding
rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address
belonging to the network/subnet configured for the forwarding rule. By default,
if this field is empty, an ephemeral internal IP address will be automatically allocated
from the IP range of the subnet or network configured for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference to
an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take the following
values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for
Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this
will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
.'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, the
default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to
ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port
ranges.
- 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy:
80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465,
587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110,
143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated list
of ports can be configured. Only packets addressed to these ports will be forwarded
to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target:
description:
- This target must be a global load balancing resource. The forwarded traffic must
be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
IPAddress:
description:
- The IP address that this forwarding rule is serving on behalf of.
- Addresses are restricted based on the forwarding rule's load balancing scheme
(EXTERNAL or INTERNAL) and scope (global or regional).
- When the load balancing scheme is EXTERNAL, for global forwarding rules, the
address must be a global IP, and for regional forwarding rules, the address
must live in the same region as the forwarding rule. If this field is empty,
an ephemeral IPv4 address from the same scope (global or regional) will be
assigned. A regional forwarding rule supports IPv4 only. A global forwarding
rule supports either IPv4 or IPv6.
- When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP
address belonging to the network/subnet configured for the forwarding rule.
By default, if this field is empty, an ephemeral internal IP address will
be automatically allocated from the IP range of the subnet or network configured
for this forwarding rule.
- 'An address can be specified either by a literal IP address or a URL reference
to an existing Address resource. The following examples are all valid: * 100.1.2.3
* U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address)
* projects/project/regions/region/addresses/address * regions/region/addresses/address
* global/addresses/address * address .'
returned: success
type: str
IPProtocol:
description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP.
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
returned: success
type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are
IPV4 or IPV6. This can only be specified for a global forwarding rule.
returned: success
type: str
loadBalancingScheme:
description:
- 'This signifies what the ForwardingRule will be used for and can only take
the following values: INTERNAL, EXTERNAL The value of INTERNAL means that
this will be used for Internal Network Load Balancing (TCP, UDP). The value
of EXTERNAL means that this will be used for External Load Balancing (HTTP(S)
LB, External TCP/UDP LB, SSL Proxy) .'
returned: success
type: str
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
network:
description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing.
returned: success
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance.
- Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed
to ports in the specified range will be forwarded to target.
- Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint
port ranges.
- 'Some types of forwarding target have constraints on the acceptable ports:
* TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25,
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy:
25, 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .'
returned: success
type: str
ports:
description:
- This field is used along with the backend_service field for internal load
balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the
load balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target:
description:
- This target must be a global load balancing resource. The forwarded traffic
must be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success
type: str
'''
################################################################################
@ -217,7 +219,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,214 +32,229 @@ DOCUMENTATION = '''
---
module: gcp_compute_health_check
description:
- Health Checks determine whether instances are responsive and able to do work.
- They are an important part of a comprehensive load balancing configuration, as they
enable monitoring instances behind load balancers.
- Health Checks poll instances at a specified interval. Instances that do not respond
successfully to some number of probes in a row are marked as unhealthy. No new connections
are sent to unhealthy instances, though existing connections will continue. The
health check will continue to poll unhealthy instances. If an instance later responds
successfully to some number of consecutive probes, it is marked healthy again and
can receive new connections.
- Health Checks determine whether instances are responsive and able to do work.
- They are an important part of a comprehensive load balancing configuration, as they
enable monitoring instances behind load balancers.
- Health Checks poll instances at a specified interval. Instances that do not respond
successfully to some number of probes in a row are marked as unhealthy. No new connections
are sent to unhealthy instances, though existing connections will continue. The
health check will continue to poll unhealthy instances. If an instance later responds
successfully to some number of consecutive probes, it is marked healthy again and
can receive new connections.
short_description: Creates a GCP HealthCheck
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'
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
default: 5
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
default: '5'
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
healthy_threshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
required: false
default: '2'
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
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
required: false
default: '5'
aliases:
- timeout_seconds
unhealthy_threshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
required: false
default: '2'
type:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not
specified, the default is TCP. Exactly one of the protocol-specific health check
field must be specified, which must match type field.
required: false
choices:
- TCP
- SSL
- HTTP
- HTTPS
http_health_check:
description:
- A nested object resource.
required: false
suboptions:
host:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
required: false
healthy_threshold:
request_path:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
- The request path of the HTTP health check request.
- The default value is /.
required: false
default: 2
name:
default: "/"
port:
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
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
- The TCP port number for the HTTP health check request.
- The default value is 80.
required: false
default: 5
aliases: [timeout_seconds]
unhealthy_threshold:
port_name:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
default: 2
type:
proxy_header:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified,
the default is TCP. Exactly one of the protocol-specific health check field must
be specified, which must match type field.
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
required: false
choices: ['TCP', 'SSL', 'HTTP', 'HTTPS']
http_health_check:
default: NONE
choices:
- NONE
- PROXY_V1
https_health_check:
description:
- A nested object resource.
required: false
suboptions:
host:
description:
- A nested object resource.
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
required: false
suboptions:
host:
description:
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
required: false
request_path:
description:
- The request path of the HTTP health check request.
- The default value is /.
required: false
default: /
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices: ['NONE', 'PROXY_V1']
https_health_check:
request_path:
description:
- A nested object resource.
- The request path of the HTTPS health check request.
- The default value is /.
required: false
suboptions:
host:
description:
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
required: false
request_path:
description:
- The request path of the HTTPS health check request.
- The default value is /.
required: false
default: /
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 443.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices: ['NONE', 'PROXY_V1']
tcp_health_check:
default: "/"
port:
description:
- A nested object resource.
- The TCP port number for the HTTPS health check request.
- The default value is 443.
required: false
suboptions:
request:
description:
- The application data to send once the TCP connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
required: false
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
required: false
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices: ['NONE', 'PROXY_V1']
ssl_health_check:
port_name:
description:
- A nested object resource.
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
suboptions:
request:
description:
- The application data to send once the SSL connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
required: false
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
required: false
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices: ['NONE', 'PROXY_V1']
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices:
- NONE
- PROXY_V1
tcp_health_check:
description:
- A nested object resource.
required: false
suboptions:
request:
description:
- The application data to send once the TCP connection has been established
(default value is empty). If both request and response are empty, the connection
establishment alone will indicate health. The request data can only be ASCII.
required: false
response:
description:
- The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
required: false
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices:
- NONE
- PROXY_V1
ssl_health_check:
description:
- A nested object resource.
required: false
suboptions:
request:
description:
- The application data to send once the SSL connection has been established
(default value is empty). If both request and response are empty, the connection
establishment alone will indicate health. The request data can only be ASCII.
required: false
response:
description:
- The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
required: false
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
required: false
port_name:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
required: false
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
required: false
default: NONE
choices:
- NONE
- PROXY_V1
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)"
- "Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)'
- 'Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)'
'''
EXAMPLES = '''
@ -261,213 +276,213 @@ EXAMPLES = '''
'''
RETURN = '''
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
type:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified,
the default is TCP. Exactly one of the protocol-specific health check field must
be specified, which must match type field.
returned: success
type: str
httpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
httpsHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
tcpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the TCP connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
sslHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the SSL connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
type:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not
specified, the default is TCP. Exactly one of the protocol-specific health check
field must be specified, which must match type field.
returned: success
type: str
httpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
httpsHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
tcpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the TCP connection has been established
(default value is empty). If both request and response are empty, the connection
establishment alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
sslHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the SSL connection has been established
(default value is empty). If both request and response are empty, the connection
establishment alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty
(the default value), any response will indicate health. The response data
can only be ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
'''
################################################################################
@ -583,10 +598,10 @@ def resource_to_request(module):
u'timeoutSec': module.params.get('timeout_sec'),
u'unhealthyThreshold': module.params.get('unhealthy_threshold'),
u'type': module.params.get('type'),
u'httpHealthCheck': HealthCheckHttpHealthCheck(module.params.get('http_health_check', {}), module).to_request(),
u'httpsHealthCheck': HealthCheckHttpsHealthCheck(module.params.get('https_health_check', {}), module).to_request(),
u'tcpHealthCheck': HealthCheckTcpHealthCheck(module.params.get('tcp_health_check', {}), module).to_request(),
u'sslHealthCheck': HealthCheckSslHealthCheck(module.params.get('ssl_health_check', {}), module).to_request()
u'httpHealthCheck': HealthCheckHttphealthcheck(module.params.get('http_health_check', {}), module).to_request(),
u'httpsHealthCheck': HealthCheckHttpshealthcheck(module.params.get('https_health_check', {}), module).to_request(),
u'tcpHealthCheck': HealthCheckTcphealthcheck(module.params.get('tcp_health_check', {}), module).to_request(),
u'sslHealthCheck': HealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request()
}
return_vals = {}
for k, v in request.items():
@ -661,10 +676,10 @@ def response_to_hash(module, response):
u'timeoutSec': response.get(u'timeoutSec'),
u'unhealthyThreshold': response.get(u'unhealthyThreshold'),
u'type': response.get(u'type'),
u'httpHealthCheck': HealthCheckHttpHealthCheck(response.get(u'httpHealthCheck', {}), module).from_response(),
u'httpsHealthCheck': HealthCheckHttpsHealthCheck(response.get(u'httpsHealthCheck', {}), module).from_response(),
u'tcpHealthCheck': HealthCheckTcpHealthCheck(response.get(u'tcpHealthCheck', {}), module).from_response(),
u'sslHealthCheck': HealthCheckSslHealthCheck(response.get(u'sslHealthCheck', {}), module).from_response()
u'httpHealthCheck': HealthCheckHttphealthcheck(response.get(u'httpHealthCheck', {}), module).from_response(),
u'httpsHealthCheck': HealthCheckHttpshealthcheck(response.get(u'httpsHealthCheck', {}), module).from_response(),
u'tcpHealthCheck': HealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(),
u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response()
}
@ -692,8 +707,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
@ -705,7 +718,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class HealthCheckHttpHealthCheck(object):
class HealthCheckHttphealthcheck(object):
def __init__(self, request, module):
self.module = module
if request:
@ -732,7 +745,7 @@ class HealthCheckHttpHealthCheck(object):
})
class HealthCheckHttpsHealthCheck(object):
class HealthCheckHttpshealthcheck(object):
def __init__(self, request, module):
self.module = module
if request:
@ -759,7 +772,7 @@ class HealthCheckHttpsHealthCheck(object):
})
class HealthCheckTcpHealthCheck(object):
class HealthCheckTcphealthcheck(object):
def __init__(self, request, module):
self.module = module
if request:
@ -786,7 +799,7 @@ class HealthCheckTcpHealthCheck(object):
})
class HealthCheckSslHealthCheck(object):
class HealthCheckSslhealthcheck(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_health_check_facts
description:
- Gather facts for GCP HealthCheck
- Gather facts for GCP HealthCheck
short_description: Gather facts for GCP HealthCheck
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,217 +61,220 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
type:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified,
the default is TCP. Exactly one of the protocol-specific health check field must
be specified, which must match type field.
returned: success
type: str
httpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
httpsHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health check
is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
tcpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the TCP connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
sslHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the SSL connection has been established (default
value is empty). If both request and response are empty, the connection establishment
alone will indicate health. The request data can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left empty (the
default value), any response will indicate health. The response data can only be
ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
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
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
type:
description:
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If
not specified, the default is TCP. Exactly one of the protocol-specific health
check field must be specified, which must match type field.
returned: success
type: str
httpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTP health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and
port_name are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
httpsHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
host:
description:
- The value of the host header in the HTTPS health check request.
- If left empty (default value), the public IP on behalf of which this health
check is performed will be used.
returned: success
type: str
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and
port_name are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
tcpHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the TCP connection has been established
(default value is empty). If both request and response are empty, the
connection establishment alone will indicate health. The request data
can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left
empty (the default value), any response will indicate health. The response
data can only be ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the TCP health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and
port_name are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
sslHealthCheck:
description:
- A nested object resource.
returned: success
type: complex
contains:
request:
description:
- The application data to send once the SSL connection has been established
(default value is empty). If both request and response are empty, the
connection establishment alone will indicate health. The request data
can only be ASCII.
returned: success
type: str
response:
description:
- The bytes to match against the beginning of the response data. If left
empty (the default value), any response will indicate health. The response
data can only be ASCII.
returned: success
type: str
port:
description:
- The TCP port number for the SSL health check request.
- The default value is 443.
returned: success
type: int
portName:
description:
- Port name as defined in InstanceGroup#NamedPort#name. If both port and
port_name are defined, port takes precedence.
returned: success
type: str
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the
backend, either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
'''
################################################################################
@ -293,7 +295,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,78 +32,82 @@ DOCUMENTATION = '''
---
module: gcp_compute_http_health_check
description:
- An HttpHealthCheck resource. This resource defines a template for how individual
VMs should be checked for health, via HTTP.
- An HttpHealthCheck resource. This resource defines a template for how individual
VMs should be checked for health, via HTTP.
short_description: Creates a GCP HttpHealthCheck
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'
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
default: 5
aliases: [check_interval_seconds]
state:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
healthy_threshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
required: false
host:
description:
- The value of the host header in the HTTP health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
required: false
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
required: false
request_path:
description:
- The request path of the HTTP health check request.
- The default value is /.
required: false
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
required: false
aliases: [timeout_seconds]
unhealthy_threshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
default: '5'
aliases:
- check_interval_seconds
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
healthy_threshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
required: false
host:
description:
- The value of the host header in the HTTP health check request. If left empty
(default value), the public IP on behalf of which this health check is performed
will be used.
required: false
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
required: false
request_path:
description:
- The request path of the HTTP health check request.
- The default value is /.
required: false
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
required: false
aliases:
- timeout_seconds
unhealthy_threshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)"
- "Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)'
- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)'
'''
EXAMPLES = '''
@ -121,75 +125,75 @@ EXAMPLES = '''
'''
RETURN = '''
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTP health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTP health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
'''
################################################################################
@ -384,8 +388,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_http_health_check_facts
description:
- Gather facts for GCP HttpHealthCheck
- Gather facts for GCP HttpHealthCheck
short_description: Gather facts for GCP HttpHealthCheck
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,79 +61,80 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTP health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTP health check request. If left empty
(default value), the public IP on behalf of which this health check is performed
will be used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
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
port:
description:
- The TCP port number for the HTTP health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTP health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
'''
################################################################################
@ -155,7 +155,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,76 +32,79 @@ DOCUMENTATION = '''
---
module: gcp_compute_https_health_check
description:
- An HttpsHealthCheck resource. This resource defines a template for how individual
VMs should be checked for health, via HTTPS.
- An HttpsHealthCheck resource. This resource defines a template for how individual
VMs should be checked for health, via HTTPS.
short_description: Creates a GCP HttpsHealthCheck
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'
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
state:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
healthy_threshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
required: false
host:
description:
- The value of the host header in the HTTPS health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
required: false
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
required: false
request_path:
description:
- The request path of the HTTPS health check request.
- The default value is /.
required: false
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
required: false
aliases: [timeout_seconds]
unhealthy_threshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
check_interval_sec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
required: false
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
healthy_threshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
required: false
host:
description:
- The value of the host header in the HTTPS health check request. If left empty
(default value), the public IP on behalf of which this health check is performed
will be used.
required: false
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
required: false
request_path:
description:
- The request path of the HTTPS health check request.
- The default value is /.
required: false
timeout_sec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
required: false
aliases:
- timeout_seconds
unhealthy_threshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)"
- "Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)'
- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)'
'''
EXAMPLES = '''
@ -119,75 +122,75 @@ EXAMPLES = '''
'''
RETURN = '''
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTPS health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTPS health check request. If left empty
(default value), the public IP on behalf of which this health check is performed
will be used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
'''
################################################################################
@ -382,8 +385,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_https_health_check_facts
description:
- Gather facts for GCP HttpsHealthCheck
- Gather facts for GCP HttpsHealthCheck
short_description: Gather facts for GCP HttpsHealthCheck
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,79 +61,80 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes.
The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTPS health check request. If left empty (default
value), the public IP on behalf of which this health check is performed will be
used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater value
than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures.
The default value is 2.
returned: success
type: int
description: List of items
returned: always
type: complex
contains:
checkIntervalSec:
description:
- How often (in seconds) to send a health check. The default value is 5 seconds.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
healthyThreshold:
description:
- A so-far unhealthy instance will be marked healthy after this many consecutive
successes. The default value is 2.
returned: success
type: int
host:
description:
- The value of the host header in the HTTPS health check request. If left empty
(default value), the public IP on behalf of which this health check is performed
will be used.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
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
port:
description:
- The TCP port number for the HTTPS health check request.
- The default value is 80.
returned: success
type: int
requestPath:
description:
- The request path of the HTTPS health check request.
- The default value is /.
returned: success
type: str
timeoutSec:
description:
- How long (in seconds) to wait before claiming failure.
- The default value is 5 seconds. It is invalid for timeoutSec to have greater
value than checkIntervalSec.
returned: success
type: int
unhealthyThreshold:
description:
- A so-far healthy instance will be marked unhealthy after this many consecutive
failures. The default value is 2.
returned: success
type: int
'''
################################################################################
@ -155,7 +155,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,156 +32,161 @@ DOCUMENTATION = '''
---
module: gcp_compute_image
description:
- Represents an Image resource.
- Google Compute Engine uses operating system images to create the root persistent
disks for your instances. You specify an image when you create an instance. Images
contain a boot loader, an operating system, and a root file system. Linux operating
system images are also capable of running containers on Compute Engine.
- Images can be either public or custom.
- Public images are provided and maintained by Google, open-source communities, and
third-party vendors. By default, all projects have access to these images and can
use them to create instances. Custom images are available only to your project.
You can create a custom image from root persistent disks and other images. Then,
use the custom image to create an instance.
- Represents an Image resource.
- Google Compute Engine uses operating system images to create the root persistent
disks for your instances. You specify an image when you create an instance. Images
contain a boot loader, an operating system, and a root file system. Linux operating
system images are also capable of running containers on Compute Engine.
- Images can be either public or custom.
- Public images are provided and maintained by Google, open-source communities, and
third-party vendors. By default, all projects have access to these images and can
use them to create instances. Custom images are available only to your project.
You can create a custom image from root persistent disks and other images. Then,
use the custom image to create an instance.
short_description: Creates a GCP Image
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
disk_size_gb:
description:
- Size of the image when restored onto a persistent disk (in GB).
required: false
family:
description:
- The name of the image family to which this image belongs. You can create disks
by specifying an image family instead of a specific image name. The image family
always returns its latest image that is not deprecated. The name of the image
family must comply with RFC1035.
required: false
guest_os_features:
description:
- A list of features to enable on the guest OS. Applicable for bootable images
only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which
allows each virtual CPU to have its own queue. For Windows images, you can only
enable VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher.
Linux images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the value
WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
required: false
suboptions:
type:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported.
For newer Windows images, the server might also populate this property with
the value WINDOWS to indicate that this is a Windows image. This value is
purely informational and does not enable or disable any features.
required: false
disk_size_gb:
choices:
- VIRTIO_SCSI_MULTIQUEUE
image_encryption_key:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide the
same key if you use the image later (e.g. to create a disk from the image) .
required: false
suboptions:
raw_key:
description:
- Size of the image when restored onto a persistent disk (in GB).
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
family:
sha256:
description:
- The name of the image family to which this image belongs. You can create disks by
specifying an image family instead of a specific image name. The image family always
returns its latest image that is not deprecated. The name of the image family must
comply with RFC1035.
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
guest_os_features:
licenses:
description:
- Any applicable license URI.
required: false
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
raw_disk:
description:
- The parameters of the raw disk image.
required: false
suboptions:
container_type:
description:
- A list of features to enable on the guest OS. Applicable for bootable images only.
Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows
each virtual CPU to have its own queue. For Windows images, you can only enable
VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux
images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the value
WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
- The format used to encode and transmit the block device, which should be
TAR. This is just a container and transmission format and not a runtime
format. Provided by the client when the disk image is created.
required: false
suboptions:
type:
description:
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported.
For newer Windows images, the server might also populate this property with the
value WINDOWS to indicate that this is a Windows image. This value is purely informational
and does not enable or disable any features.
required: false
choices: ['VIRTIO_SCSI_MULTIQUEUE']
image_encryption_key:
choices:
- TAR
sha1_checksum:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide the same
key if you use the image later (e.g. to create a disk from the image) .
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
licenses:
source:
description:
- Any applicable license URI.
- The full Google Cloud Storage URL where disk storage is stored You must
provide either this property or the sourceDisk property but not both.
required: false
name:
source_disk:
description:
- Refers to a gcompute_disk object You must provide either this property or the
rawDisk.source property but not both to create an image.
- 'This field represents a link to a Disk resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_disk
task and then set this source_disk field to "{{ name-of-resource }}" Alternatively,
you can set this source_disk to a dictionary with the selfLink key where the
value is the selfLink of your Disk'
required: false
source_disk_encryption_key:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
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
raw_disk:
description:
- The parameters of the raw disk image.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
suboptions:
container_type:
description:
- The format used to encode and transmit the block device, which should be TAR. This
is just a container and transmission format and not a runtime format. Provided by
the client when the disk image is created.
required: false
choices: ['TAR']
sha1_checksum:
description:
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
required: false
source:
description:
- The full Google Cloud Storage URL where disk storage is stored You must provide
either this property or the sourceDisk property but not both.
required: false
source_disk:
sha256:
description:
- Refers to a gcompute_disk object You must provide either this property or the rawDisk.source
property but not both to create an image.
- 'This field represents a link to a Disk resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and
then set this source_disk field to "{{ name-of-resource }}" Alternatively, you can
set this source_disk to a dictionary with the selfLink key where the value is the
selfLink of your Disk.'
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
source_disk_encryption_key:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
source_disk_id:
description:
- The ID value of the disk used to create this image. This value may be used to determine
whether the image was taken from the current or a previous instance of a given disk
name.
required: false
source_type:
description:
- The type of the image used to create this disk. The default and only value is RAW
.
required: false
choices: ['RAW']
source_disk_id:
description:
- The ID value of the disk used to create this image. This value may be used to
determine whether the image was taken from the current or a previous instance
of a given disk name.
required: false
source_type:
description:
- The type of the image used to create this disk. The default and only value is
RAW .
required: false
choices:
- RAW
extends_documentation_fragment: gcp
'''
@ -207,202 +212,202 @@ EXAMPLES = '''
'''
RETURN = '''
archiveSizeBytes:
description:
- Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
archiveSizeBytes:
description:
- Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
deprecated:
description:
- The deprecation status associated with this image.
returned: success
type: complex
contains:
deleted:
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to DELETED. This is only informational and the status
will not change unless the client explicitly changes it.
returned: success
type: str
deprecated:
description:
- The deprecation status associated with this image.
returned: success
type: complex
contains:
deleted:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to DELETED. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
deprecated:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to DEPRECATED. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
obsolete:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to OBSOLETE. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
replacement:
description:
- The URL of the suggested replacement for a deprecated resource.
- The suggested replacement resource must be the same kind of resource as the deprecated
resource.
returned: success
type: str
state:
description:
- The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED.
Operations which create a new resource using a DEPRECATED resource will return successfully,
but with a warning indicating the deprecated resource and recommending its replacement.
Operations which use OBSOLETE or DELETED resources will be rejected and result in
an error.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
diskSizeGb:
description:
- Size of the image when restored onto a persistent disk (in GB).
returned: success
type: int
family:
description:
- The name of the image family to which this image belongs. You can create disks by
specifying an image family instead of a specific image name. The image family always
returns its latest image that is not deprecated. The name of the image family must
comply with RFC1035.
returned: success
type: str
guestOsFeatures:
description:
- A list of features to enable on the guest OS. Applicable for bootable images only.
Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows
each virtual CPU to have its own queue. For Windows images, you can only enable
VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux
images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the value
WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
returned: success
type: complex
contains:
type:
description:
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported.
For newer Windows images, the server might also populate this property with the
value WINDOWS to indicate that this is a Windows image. This value is purely informational
and does not enable or disable any features.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
returned: success
type: int
imageEncryptionKey:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide the same
key if you use the image later (e.g. to create a disk from the image) .
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
licenses:
description:
- Any applicable license URI.
returned: success
type: list
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
rawDisk:
description:
- The parameters of the raw disk image.
returned: success
type: complex
contains:
containerType:
description:
- The format used to encode and transmit the block device, which should be TAR. This
is just a container and transmission format and not a runtime format. Provided by
the client when the disk image is created.
returned: success
type: str
sha1Checksum:
description:
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
returned: success
type: str
source:
description:
- The full Google Cloud Storage URL where disk storage is stored You must provide
either this property or the sourceDisk property but not both.
returned: success
type: str
sourceDisk:
description:
- Refers to a gcompute_disk object You must provide either this property or the rawDisk.source
property but not both to create an image.
returned: success
type: dict
sourceDiskEncryptionKey:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceDiskId:
description:
- The ID value of the disk used to create this image. This value may be used to determine
whether the image was taken from the current or a previous instance of a given disk
name.
returned: success
type: str
sourceType:
description:
- The type of the image used to create this disk. The default and only value is RAW
.
returned: success
type: str
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to DEPRECATED. This is only informational and the status
will not change unless the client explicitly changes it.
returned: success
type: str
obsolete:
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to OBSOLETE. This is only informational and the status
will not change unless the client explicitly changes it.
returned: success
type: str
replacement:
description:
- The URL of the suggested replacement for a deprecated resource.
- The suggested replacement resource must be the same kind of resource as the
deprecated resource.
returned: success
type: str
state:
description:
- The deprecation state of this resource. This can be DEPRECATED, OBSOLETE,
or DELETED. Operations which create a new resource using a DEPRECATED resource
will return successfully, but with a warning indicating the deprecated resource
and recommending its replacement. Operations which use OBSOLETE or DELETED
resources will be rejected and result in an error.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
diskSizeGb:
description:
- Size of the image when restored onto a persistent disk (in GB).
returned: success
type: int
family:
description:
- The name of the image family to which this image belongs. You can create disks
by specifying an image family instead of a specific image name. The image family
always returns its latest image that is not deprecated. The name of the image
family must comply with RFC1035.
returned: success
type: str
guestOsFeatures:
description:
- A list of features to enable on the guest OS. Applicable for bootable images only.
Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows
each virtual CPU to have its own queue. For Windows images, you can only enable
VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux
images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the value
WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
returned: success
type: complex
contains:
type:
description:
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported.
For newer Windows images, the server might also populate this property with
the value WINDOWS to indicate that this is a Windows image. This value is
purely informational and does not enable or disable any features.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
returned: success
type: int
imageEncryptionKey:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide the
same key if you use the image later (e.g. to create a disk from the image) .
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
licenses:
description:
- Any applicable license URI.
returned: success
type: list
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
rawDisk:
description:
- The parameters of the raw disk image.
returned: success
type: complex
contains:
containerType:
description:
- The format used to encode and transmit the block device, which should be TAR.
This is just a container and transmission format and not a runtime format.
Provided by the client when the disk image is created.
returned: success
type: str
sha1Checksum:
description:
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
returned: success
type: str
source:
description:
- The full Google Cloud Storage URL where disk storage is stored You must provide
either this property or the sourceDisk property but not both.
returned: success
type: str
sourceDisk:
description:
- Refers to a gcompute_disk object You must provide either this property or the
rawDisk.source property but not both to create an image.
returned: success
type: dict
sourceDiskEncryptionKey:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceDiskId:
description:
- The ID value of the disk used to create this image. This value may be used to
determine whether the image was taken from the current or a previous instance
of a given disk name.
returned: success
type: str
sourceType:
description:
- The type of the image used to create this disk. The default and only value is
RAW .
returned: success
type: str
'''
################################################################################
@ -503,13 +508,13 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'diskSizeGb': module.params.get('disk_size_gb'),
u'family': module.params.get('family'),
u'guestOsFeatures': ImageGuestOsFeaturesArray(module.params.get('guest_os_features', []), module).to_request(),
u'imageEncryptionKey': ImageImageEncryptionKey(module.params.get('image_encryption_key', {}), module).to_request(),
u'guestOsFeatures': ImageGuestosfeaturesArray(module.params.get('guest_os_features', []), module).to_request(),
u'imageEncryptionKey': ImageImageencryptionkey(module.params.get('image_encryption_key', {}), module).to_request(),
u'licenses': module.params.get('licenses'),
u'name': module.params.get('name'),
u'rawDisk': ImageRawDisk(module.params.get('raw_disk', {}), module).to_request(),
u'rawDisk': ImageRawdisk(module.params.get('raw_disk', {}), module).to_request(),
u'sourceDisk': replace_resource_dict(module.params.get(u'source_disk', {}), 'selfLink'),
u'sourceDiskEncryptionKey': ImageSourceDiskEncryptionKey(module.params.get('source_disk_encryption_key', {}), module).to_request(),
u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(module.params.get('source_disk_encryption_key', {}), module).to_request(),
u'sourceDiskId': module.params.get('source_disk_id'),
u'sourceType': module.params.get('source_type')
}
@ -583,14 +588,14 @@ def response_to_hash(module, response):
u'description': response.get(u'description'),
u'diskSizeGb': response.get(u'diskSizeGb'),
u'family': response.get(u'family'),
u'guestOsFeatures': ImageGuestOsFeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(),
u'guestOsFeatures': ImageGuestosfeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(),
u'id': response.get(u'id'),
u'imageEncryptionKey': ImageImageEncryptionKey(response.get(u'imageEncryptionKey', {}), module).from_response(),
u'imageEncryptionKey': ImageImageencryptionkey(response.get(u'imageEncryptionKey', {}), module).from_response(),
u'licenses': response.get(u'licenses'),
u'name': response.get(u'name'),
u'rawDisk': ImageRawDisk(response.get(u'rawDisk', {}), module).from_response(),
u'rawDisk': ImageRawdisk(response.get(u'rawDisk', {}), module).from_response(),
u'sourceDisk': response.get(u'sourceDisk'),
u'sourceDiskEncryptionKey': ImageSourceDiskEncryptionKey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(),
u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(),
u'sourceDiskId': response.get(u'sourceDiskId'),
u'sourceType': response.get(u'sourceType')
}
@ -620,8 +625,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
@ -660,7 +663,7 @@ class ImageDeprecated(object):
})
class ImageGuestOsFeaturesArray(object):
class ImageGuestosfeaturesArray(object):
def __init__(self, request, module):
self.module = module
if request:
@ -691,7 +694,7 @@ class ImageGuestOsFeaturesArray(object):
})
class ImageImageEncryptionKey(object):
class ImageImageencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -712,7 +715,7 @@ class ImageImageEncryptionKey(object):
})
class ImageRawDisk(object):
class ImageRawdisk(object):
def __init__(self, request, module):
self.module = module
if request:
@ -735,7 +738,7 @@ class ImageRawDisk(object):
})
class ImageSourceDiskEncryptionKey(object):
class ImageSourcediskencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_image_facts
description:
- Gather facts for GCP Image
- Gather facts for GCP Image
short_description: Gather facts for GCP Image
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,206 +61,210 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
archiveSizeBytes:
description:
- Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
archiveSizeBytes:
description:
- Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
deprecated:
description:
- The deprecation status associated with this image.
returned: success
type: complex
contains:
deleted:
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to DELETED. This is only informational and the status
will not change unless the client explicitly changes it.
returned: success
type: str
deprecated:
description:
- The deprecation status associated with this image.
returned: success
type: complex
contains:
deleted:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to DELETED. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
deprecated:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to DEPRECATED. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
obsolete:
description:
- An optional RFC3339 timestamp on or after which the state of this resource is intended
to change to OBSOLETE. This is only informational and the status will not change
unless the client explicitly changes it.
returned: success
type: str
replacement:
description:
- The URL of the suggested replacement for a deprecated resource.
- The suggested replacement resource must be the same kind of resource as the deprecated
resource.
returned: success
type: str
state:
description:
- The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED.
Operations which create a new resource using a DEPRECATED resource will return successfully,
but with a warning indicating the deprecated resource and recommending its replacement.
Operations which use OBSOLETE or DELETED resources will be rejected and result in
an error.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
diskSizeGb:
description:
- Size of the image when restored onto a persistent disk (in GB).
returned: success
type: int
family:
description:
- The name of the image family to which this image belongs. You can create disks by
specifying an image family instead of a specific image name. The image family always
returns its latest image that is not deprecated. The name of the image family must
comply with RFC1035.
returned: success
type: str
guestOsFeatures:
description:
- A list of features to enable on the guest OS. Applicable for bootable images only.
Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows
each virtual CPU to have its own queue. For Windows images, you can only enable
VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux
images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the value
WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
returned: success
type: complex
contains:
type:
description:
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported.
For newer Windows images, the server might also populate this property with the
value WINDOWS to indicate that this is a Windows image. This value is purely informational
and does not enable or disable any features.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
returned: success
type: int
imageEncryptionKey:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide the same
key if you use the image later (e.g. to create a disk from the image) .
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
licenses:
description:
- Any applicable license URI.
returned: success
type: list
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
rawDisk:
description:
- The parameters of the raw disk image.
returned: success
type: complex
contains:
containerType:
description:
- The format used to encode and transmit the block device, which should be TAR. This
is just a container and transmission format and not a runtime format. Provided by
the client when the disk image is created.
returned: success
type: str
sha1Checksum:
description:
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
returned: success
type: str
source:
description:
- The full Google Cloud Storage URL where disk storage is stored You must provide
either this property or the sourceDisk property but not both.
returned: success
type: str
sourceDisk:
description:
- Refers to a gcompute_disk object You must provide either this property or the rawDisk.source
property but not both to create an image.
returned: success
type: dict
sourceDiskEncryptionKey:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceDiskId:
description:
- The ID value of the disk used to create this image. This value may be used to determine
whether the image was taken from the current or a previous instance of a given disk
name.
returned: success
type: str
sourceType:
description:
- The type of the image used to create this disk. The default and only value is RAW
.
returned: success
type: str
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to DEPRECATED. This is only informational and the
status will not change unless the client explicitly changes it.
returned: success
type: str
obsolete:
description:
- An optional RFC3339 timestamp on or after which the state of this resource
is intended to change to OBSOLETE. This is only informational and the
status will not change unless the client explicitly changes it.
returned: success
type: str
replacement:
description:
- The URL of the suggested replacement for a deprecated resource.
- The suggested replacement resource must be the same kind of resource as
the deprecated resource.
returned: success
type: str
state:
description:
- The deprecation state of this resource. This can be DEPRECATED, OBSOLETE,
or DELETED. Operations which create a new resource using a DEPRECATED
resource will return successfully, but with a warning indicating the deprecated
resource and recommending its replacement. Operations which use OBSOLETE
or DELETED resources will be rejected and result in an error.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
diskSizeGb:
description:
- Size of the image when restored onto a persistent disk (in GB).
returned: success
type: int
family:
description:
- The name of the image family to which this image belongs. You can create disks
by specifying an image family instead of a specific image name. The image
family always returns its latest image that is not deprecated. The name of
the image family must comply with RFC1035.
returned: success
type: str
guestOsFeatures:
description:
- A list of features to enable on the guest OS. Applicable for bootable images
only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE,
which allows each virtual CPU to have its own queue. For Windows images, you
can only enable VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621
or higher. Linux images with kernel versions 3.17 and higher will support
VIRTIO_SCSI_MULTIQUEUE.
- For new Windows images, the server might also populate this field with the
value WINDOWS, to indicate that this is a Windows image.
- This value is purely informational and does not enable or disable any features.
returned: success
type: complex
contains:
type:
description:
- The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is
supported. For newer Windows images, the server might also populate this
property with the value WINDOWS to indicate that this is a Windows image.
This value is purely informational and does not enable or disable any
features.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
returned: success
type: int
imageEncryptionKey:
description:
- Encrypts the image using a customer-supplied encryption key.
- After you encrypt an image with a customer-supplied key, you must provide
the same key if you use the image later (e.g. to create a disk from the image)
.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
licenses:
description:
- Any applicable license URI.
returned: success
type: list
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
rawDisk:
description:
- The parameters of the raw disk image.
returned: success
type: complex
contains:
containerType:
description:
- The format used to encode and transmit the block device, which should
be TAR. This is just a container and transmission format and not a runtime
format. Provided by the client when the disk image is created.
returned: success
type: str
sha1Checksum:
description:
- An optional SHA1 checksum of the disk image before unpackaging.
- This is provided by the client when the disk image is created.
returned: success
type: str
source:
description:
- The full Google Cloud Storage URL where disk storage is stored You must
provide either this property or the sourceDisk property but not both.
returned: success
type: str
sourceDisk:
description:
- Refers to a gcompute_disk object You must provide either this property or
the rawDisk.source property but not both to create an image.
returned: success
type: dict
sourceDiskEncryptionKey:
description:
- The customer-supplied encryption key of the source disk. Required if the source
disk is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceDiskId:
description:
- The ID value of the disk used to create this image. This value may be used
to determine whether the image was taken from the current or a previous instance
of a given disk name.
returned: success
type: str
sourceType:
description:
- The type of the image used to create this disk. The default and only value
is RAW .
returned: success
type: str
'''
################################################################################
@ -282,7 +285,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

File diff suppressed because it is too large Load diff

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_facts
description:
- Gather facts for GCP Instance
- Gather facts for GCP Instance
short_description: Gather facts for GCP Instance
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
zone:
description:
- A reference to the zone where the machine resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
zone:
description:
- A reference to the zone where the machine resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,397 +66,408 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
canIpForward:
description:
- Allows this instance to send and receive packets with non-matching destination or
source IPs. This is required if you plan to use this instance to forward routes.
returned: success
type: bool
cpuPlatform:
description:
- The CPU platform used by this instance.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
disks:
description:
- An array of disks that are associated with the instances that are created from this
template.
returned: success
type: complex
contains:
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance is deleted (but
not when the disk is detached from the instance).
- 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left
behind on machine deletion.'
returned: success
type: bool
boot:
description:
- Indicates that this is a boot disk. The virtual machine will use the first partition
of the disk for its root filesystem.
returned: success
type: bool
deviceName:
description:
- Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-*
tree of a Linux operating system running within the instance. This name can be used
to reference the device for mounting, resizing, and so on, from within the instance.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts or decrypts a disk using a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
rsaEncryptedKey:
description:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption
key to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
index:
description:
- Assigns a zero-based index to this disk, where 0 is reserved for the boot disk.
For example, if you have many disks attached to an instance, each disk would have
a unique index number. If not specified, the server will choose an appropriate value.
returned: success
type: int
initializeParams:
description:
- Specifies the parameters for a new disk that will be created alongside the new instance.
Use initialization parameters to create boot disks or local SSDs attached to the
new instance.
returned: success
type: complex
contains:
diskName:
description:
- Specifies the disk name. If not specified, the default is to use the name of the
instance.
returned: success
type: str
diskSizeGb:
description:
- Specifies the size of the disk in base-2 GB.
returned: success
type: int
diskType:
description:
- Reference to a gcompute_disk_type resource.
- Specifies the disk type to use to create the instance.
- If not specified, the default is pd-standard.
returned: success
type: str
sourceImage:
description:
- The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage
or disks.source is required. To create a disk with one of the public operating
system images, specify the image by its family name.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
- Instance templates do not store customer-supplied encryption keys, so you cannot
create disks for instances in a managed instance group if the source images are
encrypted with your own keys.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
interface:
description:
- Specifies the disk interface to use for attaching this disk, which is either SCSI
or NVME. The default is SCSI.
- Persistent disks must always use SCSI and the request will fail if you attempt to
attach a persistent disk in any other format than SCSI.
returned: success
type: str
mode:
description:
- The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified,
the default is to attach the disk in READ_WRITE mode.
returned: success
type: str
source:
description:
- Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage
or disks.source is required.
- If desired, you can also attach existing non-root persistent disks using this property.
This field is only applicable for persistent disks.
returned: success
type: dict
type:
description:
- Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified,
the default is PERSISTENT.
returned: success
type: str
guestAccelerators:
description:
- List of the type and count of accelerator cards attached to the instance .
returned: success
type: complex
contains:
acceleratorCount:
description:
- The number of the guest accelerator cards exposed to this instance.
returned: success
type: int
acceleratorType:
description:
- Full or partial URL of the accelerator type resource to expose to this instance.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
returned: success
type: int
labelFingerprint:
description:
- A fingerprint for this request, which is essentially a hash of the metadata's contents
and used for optimistic locking. The fingerprint is initially generated by Compute
Engine and changes after every request to modify or update metadata. You must always
provide an up-to-date fingerprint hash in order to update or change metadata.
returned: success
type: str
metadata:
description:
- The metadata key/value pairs to assign to instances that are created from this template.
These pairs can consist of custom metadata or predefined keys.
returned: success
type: dict
machineType:
description:
- A reference to a machine type which defines VM kind.
returned: success
type: str
minCpuPlatform:
description:
- Specifies a minimum CPU platform for the VM instance. Applicable values are the
friendly names of CPU platforms .
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
canIpForward:
description:
- Allows this instance to send and receive packets with non-matching destination
or source IPs. This is required if you plan to use this instance to forward
routes.
returned: success
type: bool
cpuPlatform:
description:
- The CPU platform used by this instance.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
disks:
description:
- An array of disks that are associated with the instances that are created
from this template.
returned: success
type: complex
contains:
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance is deleted
(but not when the disk is detached from the instance).
- 'Tip: Disks should be set to autoDelete=true so that leftover disks are
not left behind on machine deletion.'
returned: success
type: bool
boot:
description:
- Indicates that this is a boot disk. The virtual machine will use the first
partition of the disk for its root filesystem.
returned: success
type: bool
deviceName:
description:
- Specifies a unique device name of your choice that is reflected into the
/dev/disk/by-id/google-* tree of a Linux operating system running within
the instance. This name can be used to reference the device for mounting,
resizing, and so on, from within the instance.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts or decrypts a disk using a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC
4648 base64 to either encrypt or decrypt this resource.
returned: success
type: str
rsaEncryptedKey:
description:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied
encryption key to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
returned: success
type: str
index:
description:
- Assigns a zero-based index to this disk, where 0 is reserved for the boot
disk. For example, if you have many disks attached to an instance, each
disk would have a unique index number. If not specified, the server will
choose an appropriate value.
returned: success
type: int
initializeParams:
description:
- Specifies the parameters for a new disk that will be created alongside
the new instance. Use initialization parameters to create boot disks or
local SSDs attached to the new instance.
returned: success
type: complex
contains:
diskName:
description:
- Specifies the disk name. If not specified, the default is to use the
name of the instance.
returned: success
type: str
diskSizeGb:
description:
- Specifies the size of the disk in base-2 GB.
returned: success
type: int
diskType:
description:
- Reference to a gcompute_disk_type resource.
- Specifies the disk type to use to create the instance.
- If not specified, the default is pd-standard.
returned: success
type: str
sourceImage:
description:
- The source image to create this disk. When creating a new instance,
one of initializeParams.sourceImage or disks.source is required. To
create a disk with one of the public operating system images, specify
the image by its family name.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required
if the source image is protected by a customer-supplied encryption
key.
- Instance templates do not store customer-supplied encryption keys,
so you cannot create disks for instances in a managed instance group
if the source images are encrypted with your own keys.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded
in RFC 4648 base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
returned: success
type: str
interface:
description:
- Specifies the disk interface to use for attaching this disk, which is
either SCSI or NVME. The default is SCSI.
- Persistent disks must always use SCSI and the request will fail if you
attempt to attach a persistent disk in any other format than SCSI.
returned: success
type: str
mode:
description:
- The mode in which to attach this disk, either READ_WRITE or READ_ONLY.
If not specified, the default is to attach the disk in READ_WRITE mode.
returned: success
type: str
source:
description:
- Reference to a gcompute_disk resource. When creating a new instance, one
of initializeParams.sourceImage or disks.source is required.
- If desired, you can also attach existing non-root persistent disks using
this property. This field is only applicable for persistent disks.
returned: success
type: dict
type:
description:
- Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified,
the default is PERSISTENT.
returned: success
type: str
guestAccelerators:
description:
- List of the type and count of accelerator cards attached to the instance .
returned: success
type: complex
contains:
acceleratorCount:
description:
- The number of the guest accelerator cards exposed to this instance.
returned: success
type: int
acceleratorType:
description:
- Full or partial URL of the accelerator type resource to expose to this
instance.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
returned: success
type: int
labelFingerprint:
description:
- A fingerprint for this request, which is essentially a hash of the metadata's
contents and used for optimistic locking. The fingerprint is initially generated
by Compute Engine and changes after every request to modify or update metadata.
You must always provide an up-to-date fingerprint hash in order to update
or change metadata.
returned: success
type: str
metadata:
description:
- The metadata key/value pairs to assign to instances that are created from
this template. These pairs can consist of custom metadata or predefined keys.
returned: success
type: dict
machineType:
description:
- A reference to a machine type which defines VM kind.
returned: success
type: str
minCpuPlatform:
description:
- Specifies a minimum CPU platform for the VM instance. Applicable values are
the friendly names of CPU platforms .
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the
resource. The resource 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
networkInterfaces:
description:
- An array of configurations for this interface. This specifies how this interface
is configured to interact with other network services, such as connecting
to the internet. Only one network interface is supported per instance.
returned: success
type: complex
contains:
accessConfigs:
description:
- An array of configurations for this interface. Currently, only one access
config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified,
then this instance will have no external internet access.
returned: success
type: complex
contains:
name:
description:
- The name of this access configuration. The default and recommended
name is External NAT but you can use any arbitrary string you would
like. For example, My external IP or Network Access.
returned: success
type: str
natIP:
description:
- Specifies the title of a gcompute_address.
- An external IP address associated with this instance.
- Specify an unused static external IP address available to the project
or leave this field undefined to use an IP from a shared ephemeral
IP address pool. If you specify a static external IP address, it must
live in the same region as the zone of the instance.
returned: success
type: dict
type:
description:
- The type of configuration. The default and only option is ONE_TO_ONE_NAT.
returned: success
type: str
aliasIpRanges:
description:
- An array of alias IP ranges for this network interface. Can only be specified
for network interfaces on subnet-mode networks.
returned: success
type: complex
contains:
ipCidrRange:
description:
- The IP CIDR range represented by this alias IP range.
- This IP CIDR range must belong to the specified subnetwork and cannot
contain IP addresses reserved by system or used by other network interfaces.
This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g.
/24) or a CIDR format string (e.g. 10.1.2.0/24).
returned: success
type: str
subnetworkRangeName:
description:
- Optional subnetwork secondary range name specifying the secondary
range from which to allocate the IP CIDR range for this alias IP range.
If left unspecified, the primary range of the subnetwork will be used.
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the resource.
The resource 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
networkInterfaces:
description:
- An array of configurations for this interface. This specifies how this interface
is configured to interact with other network services, such as connecting to the
internet. Only one network interface is supported per instance.
returned: success
type: complex
contains:
accessConfigs:
description:
- An array of configurations for this interface. Currently, only one access config,
ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this
instance will have no external internet access.
returned: success
type: complex
contains:
name:
description:
- The name of this access configuration. The default and recommended name is External
NAT but you can use any arbitrary string you would like. For example, My external
IP or Network Access.
returned: success
type: str
natIP:
description:
- Specifies the title of a gcompute_address.
- An external IP address associated with this instance.
- Specify an unused static external IP address available to the project or leave this
field undefined to use an IP from a shared ephemeral IP address pool. If you specify
a static external IP address, it must live in the same region as the zone of the
instance.
returned: success
type: dict
type:
description:
- The type of configuration. The default and only option is ONE_TO_ONE_NAT.
returned: success
type: str
aliasIpRanges:
description:
- An array of alias IP ranges for this network interface. Can only be specified for
network interfaces on subnet-mode networks.
returned: success
type: complex
contains:
ipCidrRange:
description:
- The IP CIDR range represented by this alias IP range.
- This IP CIDR range must belong to the specified subnetwork and cannot contain IP
addresses reserved by system or used by other network interfaces. This range may
be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string
(e.g. 10.1.2.0/24).
returned: success
type: str
subnetworkRangeName:
description:
- Optional subnetwork secondary range name specifying the secondary range from which
to allocate the IP CIDR range for this alias IP range. If left unspecified, the
primary range of the subnetwork will be used.
returned: success
type: str
name:
description:
- The name of the network interface, generated by the server. For network devices,
these are eth0, eth1, etc .
returned: success
type: str
network:
description:
- Specifies the title of an existing gcompute_network. When creating an instance,
if neither the network nor the subnetwork is specified, the default network global/networks/default
is used; if the network is not specified but the subnetwork is specified, the network
is inferred.
returned: success
type: dict
networkIP:
description:
- An IPv4 internal network address to assign to the instance for this network interface.
If not specified by the user, an unused internal IP is assigned by the system.
returned: success
type: str
subnetwork:
description:
- Reference to a gcompute_subnetwork resource.
- If the network resource is in legacy mode, do not provide this property. If the
network is in auto subnet mode, providing the subnetwork is optional. If the network
is in custom subnet mode, then this field should be specified.
returned: success
type: dict
scheduling:
description:
- Sets the scheduling options for this instance.
returned: success
type: complex
contains:
automaticRestart:
description:
- Specifies whether the instance should be automatically restarted if it is terminated
by Compute Engine (not terminated by a user).
- You can only set the automatic restart option for standard instances. Preemptible
instances cannot be automatically restarted.
returned: success
type: bool
onHostMaintenance:
description:
- Defines the maintenance behavior for this instance. For standard instances, the
default behavior is MIGRATE. For preemptible instances, the default and only possible
behavior is TERMINATE.
- For more information, see Setting Instance Scheduling Options.
returned: success
type: str
preemptible:
description:
- Defines whether the instance is preemptible. This can only be set during instance
creation, it cannot be set or changed after the instance has been created.
returned: success
type: bool
serviceAccounts:
description:
- A list of service accounts, with their specified scopes, authorized for this instance.
Only one service account per VM instance is supported.
returned: success
type: complex
contains:
email:
description:
- Email address of the service account.
returned: success
type: str
scopes:
description:
- The list of scopes to be made available for this service account.
returned: success
type: list
status:
description:
- 'The status of the instance. One of the following values: PROVISIONING, STAGING,
RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.'
returned: success
type: str
statusMessage:
description:
- An optional, human-readable explanation of the status.
returned: success
type: str
tags:
description:
- A list of tags to apply to this instance. Tags are used to identify valid sources
or targets for network firewalls and are specified by the client during instance
creation. The tags can be later modified by the setTags method. Each tag within
the list must comply with RFC1035.
returned: success
type: complex
contains:
fingerprint:
description:
- Specifies a fingerprint for this request, which is essentially a hash of the metadata's
contents and used for optimistic locking.
- The fingerprint is initially generated by Compute Engine and changes after every
request to modify or update metadata. You must always provide an up-to-date fingerprint
hash in order to update or change metadata.
returned: success
type: str
items:
description:
- An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035.
returned: success
type: list
zone:
description:
- A reference to the zone where the machine resides.
returned: success
type: str
description:
- The name of the network interface, generated by the server. For network
devices, these are eth0, eth1, etc .
returned: success
type: str
network:
description:
- Specifies the title of an existing gcompute_network. When creating an
instance, if neither the network nor the subnetwork is specified, the
default network global/networks/default is used; if the network is not
specified but the subnetwork is specified, the network is inferred.
returned: success
type: dict
networkIP:
description:
- An IPv4 internal network address to assign to the instance for this network
interface. If not specified by the user, an unused internal IP is assigned
by the system.
returned: success
type: str
subnetwork:
description:
- Reference to a gcompute_subnetwork resource.
- If the network resource is in legacy mode, do not provide this property.
If the network is in auto subnet mode, providing the subnetwork is optional.
If the network is in custom subnet mode, then this field should be specified.
returned: success
type: dict
scheduling:
description:
- Sets the scheduling options for this instance.
returned: success
type: complex
contains:
automaticRestart:
description:
- Specifies whether the instance should be automatically restarted if it
is terminated by Compute Engine (not terminated by a user).
- You can only set the automatic restart option for standard instances.
Preemptible instances cannot be automatically restarted.
returned: success
type: bool
onHostMaintenance:
description:
- Defines the maintenance behavior for this instance. For standard instances,
the default behavior is MIGRATE. For preemptible instances, the default
and only possible behavior is TERMINATE.
- For more information, see Setting Instance Scheduling Options.
returned: success
type: str
preemptible:
description:
- Defines whether the instance is preemptible. This can only be set during
instance creation, it cannot be set or changed after the instance has
been created.
returned: success
type: bool
serviceAccounts:
description:
- A list of service accounts, with their specified scopes, authorized for this
instance. Only one service account per VM instance is supported.
returned: success
type: complex
contains:
email:
description:
- Email address of the service account.
returned: success
type: str
scopes:
description:
- The list of scopes to be made available for this service account.
returned: success
type: list
status:
description:
- 'The status of the instance. One of the following values: PROVISIONING, STAGING,
RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.'
returned: success
type: str
statusMessage:
description:
- An optional, human-readable explanation of the status.
returned: success
type: str
tags:
description:
- A list of tags to apply to this instance. Tags are used to identify valid
sources or targets for network firewalls and are specified by the client during
instance creation. The tags can be later modified by the setTags method. Each
tag within the list must comply with RFC1035.
returned: success
type: complex
contains:
fingerprint:
description:
- Specifies a fingerprint for this request, which is essentially a hash
of the metadata's contents and used for optimistic locking.
- The fingerprint is initially generated by Compute Engine and changes after
every request to modify or update metadata. You must always provide an
up-to-date fingerprint hash in order to update or change metadata.
returned: success
type: str
items:
description:
- An array of tags. Each tag must be 1-63 characters long, and comply with
RFC1035.
returned: success
type: list
zone:
description:
- A reference to the zone where the machine resides.
returned: success
type: str
'''
################################################################################
@ -479,7 +489,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,87 +32,89 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_group
description:
- Represents an Instance Group resource. Instance groups are self-managed and can
contain identical or different instances. Instance groups do not use an instance
template. Unlike managed instance groups, you must create and add instances to an
instance group manually.
- Represents an Instance Group resource. Instance groups are self-managed and can
contain identical or different instances. Instance groups do not use an instance
template. Unlike managed instance groups, you must create and add instances to an
instance group manually.
short_description: Creates a GCP InstanceGroup
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
name:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
required: false
named_ports:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of a
port number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports
apply to all instances in this instance group.'
required: false
suboptions:
name:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
required: false
name:
port:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
- The port number, which can be a value between 1 and 65535.
required: false
named_ports:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of a port
number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports
apply to all instances in this instance group.'
required: false
suboptions:
name:
description:
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
required: false
port:
description:
- The port number, which can be a value between 1 and 65535.
required: false
network:
description:
- The network to which all instances in the instance group belong.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: false
region:
description:
- The region where the instance group is located (for regional resources).
required: false
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the value
is the selfLink of your Subnetwork.'
required: false
zone:
description:
- A reference to the zone where the instance group resides.
required: true
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and will not
be deleted.
- Only the full identifier of the instance will be returned.
required: false
version_added: 2.8
network:
description:
- The network to which all instances in the instance group belong.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: false
region:
description:
- The region where the instance group is located (for regional resources).
required: false
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively,
you can set this subnetwork to a dictionary with the selfLink key where the
value is the selfLink of your Subnetwork'
required: false
zone:
description:
- A reference to the zone where the instance group resides.
required: true
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and will
not be deleted.
- Only the full identifier of the instance will be returned.
required: false
version_added: 2.8
extends_documentation_fragment: gcp
'''
@ -141,79 +143,79 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this instance group.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this instance group.
returned: success
type: int
name:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of a port
number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports
apply to all instances in this instance group.'
returned: success
type: complex
contains:
name:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of a port
number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports
apply to all instances in this instance group.'
returned: success
type: complex
contains:
name:
description:
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
network:
description:
- The network to which all instances in the instance group belong.
returned: success
type: dict
region:
description:
- The region where the instance group is located (for regional resources).
returned: success
type: str
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
returned: success
type: dict
zone:
description:
- A reference to the zone where the instance group resides.
returned: success
type: str
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and will not
be deleted.
- Only the full identifier of the instance will be returned.
returned: success
type: list
description:
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
network:
description:
- The network to which all instances in the instance group belong.
returned: success
type: dict
region:
description:
- The region where the instance group is located (for regional resources).
returned: success
type: str
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
returned: success
type: dict
zone:
description:
- A reference to the zone where the instance group resides.
returned: success
type: str
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and will
not be deleted.
- Only the full identifier of the instance will be returned.
returned: success
type: list
'''
################################################################################
@ -305,7 +307,7 @@ def resource_to_request(module):
u'kind': 'compute#instanceGroup',
u'description': module.params.get('description'),
u'name': module.params.get('name'),
u'namedPorts': InstanceGroupNamedPortsArray(module.params.get('named_ports', []), module).to_request(),
u'namedPorts': InstanceGroupNamedportsArray(module.params.get('named_ports', []), module).to_request(),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'region': region_selflink(module.params.get('region'), module.params),
u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink')
@ -378,7 +380,7 @@ def response_to_hash(module, response):
u'description': response.get(u'description'),
u'id': response.get(u'id'),
u'name': response.get(u'name'),
u'namedPorts': InstanceGroupNamedPortsArray(response.get(u'namedPorts', []), module).from_response(),
u'namedPorts': InstanceGroupNamedportsArray(response.get(u'namedPorts', []), module).from_response(),
u'network': response.get(u'network'),
u'region': response.get(u'region'),
u'subnetwork': response.get(u'subnetwork')
@ -418,8 +420,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
@ -491,7 +491,7 @@ class InstanceLogic(object):
return request
class InstanceGroupNamedPortsArray(object):
class InstanceGroupNamedportsArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_group_facts
description:
- Gather facts for GCP InstanceGroup
- Gather facts for GCP InstanceGroup
short_description: Gather facts for GCP InstanceGroup
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
zone:
description:
- A reference to the zone where the instance group resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
zone:
description:
- A reference to the zone where the instance group resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,83 +66,83 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this instance group.
returned: success
type: int
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this instance group.
returned: success
type: int
name:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of
a port number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named
ports apply to all instances in this instance group.'
returned: success
type: complex
contains:
name:
description:
- The name of the instance group.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Assigns a name to a port number.
- 'For example: {name: "http", port: 80}.'
- This allows the system to reference ports by the assigned name instead of a port
number. Named ports can also contain multiple ports.
- 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports
apply to all instances in this instance group.'
returned: success
type: complex
contains:
name:
description:
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
network:
description:
- The network to which all instances in the instance group belong.
returned: success
type: dict
region:
description:
- The region where the instance group is located (for regional resources).
returned: success
type: str
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
returned: success
type: dict
zone:
description:
- A reference to the zone where the instance group resides.
returned: success
type: str
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and will not
be deleted.
- Only the full identifier of the instance will be returned.
returned: success
type: list
description:
- The name for this named port.
- The name must be 1-63 characters long, and comply with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
network:
description:
- The network to which all instances in the instance group belong.
returned: success
type: dict
region:
description:
- The region where the instance group is located (for regional resources).
returned: success
type: str
subnetwork:
description:
- The subnetwork to which all instances in the instance group belong.
returned: success
type: dict
zone:
description:
- A reference to the zone where the instance group resides.
returned: success
type: str
instances:
description:
- The list of instances associated with this InstanceGroup.
- All instances must be created before being added to an InstanceGroup.
- All instances not in this list will be removed from the InstanceGroup and
will not be deleted.
- Only the full identifier of the instance will be returned.
returned: success
type: list
'''
################################################################################
@ -165,7 +164,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,82 +32,86 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_group_manager
description:
- Creates a managed instance group using the information that you specify in the request.
After the group is created, it schedules an action to create instances in the group
using the specified instance template. This operation is marked as DONE when the
group is created even if the instances in the group have not yet been created. You
must separately verify the status of the individual instances.
- A managed instance group can have up to 1000 VM instances per group.
- Creates a managed instance group using the information that you specify in the request.
After the group is created, it schedules an action to create instances in the group
using the specified instance template. This operation is marked as DONE when the
group is created even if the instances in the group have not yet been created. You
must separately verify the status of the individual instances.
- A managed instance group can have up to 1000 VM instances per group.
short_description: Creates a GCP InstanceGroupManager
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'
base_instance_name:
description:
- The base instance name to use for instances in this group. The value must be 1-58
characters long. Instances are named by appending a hyphen and a random four-character
string to the base instance name.
- The base instance name must comply with RFC1035.
required: true
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
base_instance_name:
description:
- The base instance name to use for instances in this group. The value must be
1-58 characters long. Instances are named by appending a hyphen and a random
four-character string to the base instance name.
- The base instance name must comply with RFC1035.
required: true
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
instance_template:
description:
- The instance template that is specified for this managed instance group. The
group uses this template to create all new instances in the managed instance
group.
- 'This field represents a link to a InstanceTemplate resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template
task and then set this instance_template field to "{{ name-of-resource }}" Alternatively,
you can set this instance_template to a dictionary with the selfLink key where
the value is the selfLink of your InstanceTemplate'
required: true
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long,
and comply with RFC1035.
required: true
named_ports:
description:
- Named ports configured for the Instance Groups complementary to this Instance
Group Manager.
required: false
suboptions:
name:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- The name for this named port. The name must be 1-63 characters long, and
comply with RFC1035.
required: false
instance_template:
port:
description:
- The instance template that is specified for this managed instance group. The group
uses this template to create all new instances in the managed instance group.
- 'This field represents a link to a InstanceTemplate resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template
task and then set this instance_template field to "{{ name-of-resource }}" Alternatively,
you can set this instance_template to a dictionary with the selfLink key where the
value is the selfLink of your InstanceTemplate.'
required: true
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long, and
comply with RFC1035.
required: true
named_ports:
description:
- Named ports configured for the Instance Groups complementary to this Instance Group
Manager.
- The port number, which can be a value between 1 and 65535.
required: false
suboptions:
name:
description:
- The name for this named port. The name must be 1-63 characters long, and comply
with RFC1035.
required: false
port:
description:
- The port number, which can be a value between 1 and 65535.
required: false
target_pools:
description:
- TargetPool resources to which instances in the instanceGroup field are added. The
target pools automatically apply to all of the instances in the managed instance
group.
required: false
target_size:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this number.
required: false
zone:
description:
- The zone the managed instance group resides.
required: true
target_pools:
description:
- TargetPool resources to which instances in the instanceGroup field are added.
The target pools automatically apply to all of the instances in the managed
instance group.
required: false
target_size:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this
number.
required: false
zone:
description:
- The zone the managed instance group resides.
required: true
extends_documentation_fragment: gcp
'''
@ -167,151 +171,151 @@ EXAMPLES = '''
'''
RETURN = '''
baseInstanceName:
description:
- The base instance name to use for instances in this group. The value must be 1-58
characters long. Instances are named by appending a hyphen and a random four-character
string to the base instance name.
- The base instance name must comply with RFC1035.
returned: success
type: str
creationTimestamp:
description:
- The creation timestamp for this managed instance group in RFC3339 text format.
returned: success
type: str
currentActions:
description:
- The list of instance actions and the number of instances in this managed instance
group that are scheduled for each of those actions.
returned: success
type: complex
contains:
abandoning:
description:
- The total number of instances in the managed instance group that are scheduled to
be abandoned. Abandoning an instance removes it from the managed instance group
without deleting it.
returned: success
type: int
creating:
description:
- The number of instances in the managed instance group that are scheduled to be created
or are currently being created. If the group fails to create any of these instances,
it tries again until it creates the instance successfully.
- If you have disabled creation retries, this field will not be populated; instead,
the creatingWithoutRetries field will be populated.
returned: success
type: int
creatingWithoutRetries:
description:
- The number of instances that the managed instance group will attempt to create.
The group attempts to create each instance only once. If the group fails to create
any of these instances, it decreases the group's targetSize value accordingly.
returned: success
type: int
deleting:
description:
- The number of instances in the managed instance group that are scheduled to be deleted
or are currently being deleted.
returned: success
type: int
none:
description:
- The number of instances in the managed instance group that are running and have
no scheduled actions.
returned: success
type: int
recreating:
description:
- The number of instances in the managed instance group that are scheduled to be recreated
or are currently being being recreated.
- Recreating an instance deletes the existing root persistent disk and creates a new
disk from the image that is defined in the instance template.
returned: success
type: int
refreshing:
description:
- The number of instances in the managed instance group that are being reconfigured
with properties that do not require a restart or a recreate action. For example,
setting or removing target pools for the instance.
returned: success
type: int
restarting:
description:
- The number of instances in the managed instance group that are scheduled to be restarted
or are currently being restarted.
returned: success
type: int
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this resource.
returned: success
type: int
instanceGroup:
description:
- The instance group being managed.
returned: success
type: dict
instanceTemplate:
description:
- The instance template that is specified for this managed instance group. The group
uses this template to create all new instances in the managed instance group.
returned: success
type: dict
baseInstanceName:
description:
- The base instance name to use for instances in this group. The value must be 1-58
characters long. Instances are named by appending a hyphen and a random four-character
string to the base instance name.
- The base instance name must comply with RFC1035.
returned: success
type: str
creationTimestamp:
description:
- The creation timestamp for this managed instance group in RFC3339 text format.
returned: success
type: str
currentActions:
description:
- The list of instance actions and the number of instances in this managed instance
group that are scheduled for each of those actions.
returned: success
type: complex
contains:
abandoning:
description:
- The total number of instances in the managed instance group that are scheduled
to be abandoned. Abandoning an instance removes it from the managed instance
group without deleting it.
returned: success
type: int
creating:
description:
- The number of instances in the managed instance group that are scheduled to
be created or are currently being created. If the group fails to create any
of these instances, it tries again until it creates the instance successfully.
- If you have disabled creation retries, this field will not be populated; instead,
the creatingWithoutRetries field will be populated.
returned: success
type: int
creatingWithoutRetries:
description:
- The number of instances that the managed instance group will attempt to create.
The group attempts to create each instance only once. If the group fails to
create any of these instances, it decreases the group's targetSize value accordingly.
returned: success
type: int
deleting:
description:
- The number of instances in the managed instance group that are scheduled to
be deleted or are currently being deleted.
returned: success
type: int
none:
description:
- The number of instances in the managed instance group that are running and
have no scheduled actions.
returned: success
type: int
recreating:
description:
- The number of instances in the managed instance group that are scheduled to
be recreated or are currently being being recreated.
- Recreating an instance deletes the existing root persistent disk and creates
a new disk from the image that is defined in the instance template.
returned: success
type: int
refreshing:
description:
- The number of instances in the managed instance group that are being reconfigured
with properties that do not require a restart or a recreate action. For example,
setting or removing target pools for the instance.
returned: success
type: int
restarting:
description:
- The number of instances in the managed instance group that are scheduled to
be restarted or are currently being restarted.
returned: success
type: int
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this resource.
returned: success
type: int
instanceGroup:
description:
- The instance group being managed.
returned: success
type: dict
instanceTemplate:
description:
- The instance template that is specified for this managed instance group. The group
uses this template to create all new instances in the managed instance group.
returned: success
type: dict
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long,
and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Named ports configured for the Instance Groups complementary to this Instance
Group Manager.
returned: success
type: complex
contains:
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long, and
comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Named ports configured for the Instance Groups complementary to this Instance Group
Manager.
returned: success
type: complex
contains:
name:
description:
- The name for this named port. The name must be 1-63 characters long, and comply
with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
region:
description:
- The region this managed instance group resides (for regional resources).
returned: success
type: str
targetPools:
description:
- TargetPool resources to which instances in the instanceGroup field are added. The
target pools automatically apply to all of the instances in the managed instance
group.
returned: success
type: list
targetSize:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this number.
returned: success
type: int
zone:
description:
- The zone the managed instance group resides.
returned: success
type: str
description:
- The name for this named port. The name must be 1-63 characters long, and comply
with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
region:
description:
- The region this managed instance group resides (for regional resources).
returned: success
type: str
targetPools:
description:
- TargetPool resources to which instances in the instanceGroup field are added.
The target pools automatically apply to all of the instances in the managed instance
group.
returned: success
type: list
targetSize:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this number.
returned: success
type: int
zone:
description:
- The zone the managed instance group resides.
returned: success
type: str
'''
################################################################################
@ -401,7 +405,7 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'instanceTemplate': replace_resource_dict(module.params.get(u'instance_template', {}), 'selfLink'),
u'name': module.params.get('name'),
u'namedPorts': InstanceGroupManagerNamedPortsArray(module.params.get('named_ports', []), module).to_request(),
u'namedPorts': InstanceGroupManagerNamedportsArray(module.params.get('named_ports', []), module).to_request(),
u'targetPools': replace_resource_dict(module.params.get('target_pools', []), 'selfLink'),
u'targetSize': module.params.get('target_size')
}
@ -471,13 +475,13 @@ def response_to_hash(module, response):
return {
u'baseInstanceName': response.get(u'baseInstanceName'),
u'creationTimestamp': response.get(u'creationTimestamp'),
u'currentActions': InstanceGroupManagerCurrentActions(response.get(u'currentActions', {}), module).from_response(),
u'currentActions': InstanceGroupManagerCurrentactions(response.get(u'currentActions', {}), module).from_response(),
u'description': module.params.get('description'),
u'id': response.get(u'id'),
u'instanceGroup': response.get(u'instanceGroup'),
u'instanceTemplate': response.get(u'instanceTemplate'),
u'name': response.get(u'name'),
u'namedPorts': InstanceGroupManagerNamedPortsArray(response.get(u'namedPorts', []), module).from_response(),
u'namedPorts': InstanceGroupManagerNamedportsArray(response.get(u'namedPorts', []), module).from_response(),
u'region': response.get(u'region'),
u'targetPools': response.get(u'targetPools'),
u'targetSize': response.get(u'targetSize')
@ -517,8 +521,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
@ -530,7 +532,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class InstanceGroupManagerCurrentActions(object):
class InstanceGroupManagerCurrentactions(object):
def __init__(self, request, module):
self.module = module
if request:
@ -563,7 +565,7 @@ class InstanceGroupManagerCurrentActions(object):
})
class InstanceGroupManagerNamedPortsArray(object):
class InstanceGroupManagerNamedportsArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_group_manager_facts
description:
- Gather facts for GCP InstanceGroupManager
- Gather facts for GCP InstanceGroupManager
short_description: Gather facts for GCP InstanceGroupManager
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
zone:
description:
- The zone the managed instance group resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
zone:
description:
- The zone the managed instance group resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,155 +66,158 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
baseInstanceName:
description:
- The base instance name to use for instances in this group. The value must be 1-58
characters long. Instances are named by appending a hyphen and a random four-character
string to the base instance name.
- The base instance name must comply with RFC1035.
returned: success
type: str
creationTimestamp:
description:
- The creation timestamp for this managed instance group in RFC3339 text format.
returned: success
type: str
currentActions:
description:
- The list of instance actions and the number of instances in this managed instance
group that are scheduled for each of those actions.
returned: success
type: complex
contains:
abandoning:
description:
- The total number of instances in the managed instance group that are scheduled to
be abandoned. Abandoning an instance removes it from the managed instance group
without deleting it.
returned: success
type: int
creating:
description:
- The number of instances in the managed instance group that are scheduled to be created
or are currently being created. If the group fails to create any of these instances,
it tries again until it creates the instance successfully.
- If you have disabled creation retries, this field will not be populated; instead,
the creatingWithoutRetries field will be populated.
returned: success
type: int
creatingWithoutRetries:
description:
- The number of instances that the managed instance group will attempt to create.
The group attempts to create each instance only once. If the group fails to create
any of these instances, it decreases the group's targetSize value accordingly.
returned: success
type: int
deleting:
description:
- The number of instances in the managed instance group that are scheduled to be deleted
or are currently being deleted.
returned: success
type: int
none:
description:
- The number of instances in the managed instance group that are running and have
no scheduled actions.
returned: success
type: int
recreating:
description:
- The number of instances in the managed instance group that are scheduled to be recreated
or are currently being being recreated.
- Recreating an instance deletes the existing root persistent disk and creates a new
disk from the image that is defined in the instance template.
returned: success
type: int
refreshing:
description:
- The number of instances in the managed instance group that are being reconfigured
with properties that do not require a restart or a recreate action. For example,
setting or removing target pools for the instance.
returned: success
type: int
restarting:
description:
- The number of instances in the managed instance group that are scheduled to be restarted
or are currently being restarted.
returned: success
type: int
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this resource.
returned: success
type: int
instanceGroup:
description:
- The instance group being managed.
returned: success
type: dict
instanceTemplate:
description:
- The instance template that is specified for this managed instance group. The group
uses this template to create all new instances in the managed instance group.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
baseInstanceName:
description:
- The base instance name to use for instances in this group. The value must
be 1-58 characters long. Instances are named by appending a hyphen and a random
four-character string to the base instance name.
- The base instance name must comply with RFC1035.
returned: success
type: str
creationTimestamp:
description:
- The creation timestamp for this managed instance group in RFC3339 text format.
returned: success
type: str
currentActions:
description:
- The list of instance actions and the number of instances in this managed instance
group that are scheduled for each of those actions.
returned: success
type: complex
contains:
abandoning:
description:
- The total number of instances in the managed instance group that are scheduled
to be abandoned. Abandoning an instance removes it from the managed instance
group without deleting it.
returned: success
type: int
creating:
description:
- The number of instances in the managed instance group that are scheduled
to be created or are currently being created. If the group fails to create
any of these instances, it tries again until it creates the instance successfully.
- If you have disabled creation retries, this field will not be populated;
instead, the creatingWithoutRetries field will be populated.
returned: success
type: int
creatingWithoutRetries:
description:
- The number of instances that the managed instance group will attempt to
create. The group attempts to create each instance only once. If the group
fails to create any of these instances, it decreases the group's targetSize
value accordingly.
returned: success
type: int
deleting:
description:
- The number of instances in the managed instance group that are scheduled
to be deleted or are currently being deleted.
returned: success
type: int
none:
description:
- The number of instances in the managed instance group that are running
and have no scheduled actions.
returned: success
type: int
recreating:
description:
- The number of instances in the managed instance group that are scheduled
to be recreated or are currently being being recreated.
- Recreating an instance deletes the existing root persistent disk and creates
a new disk from the image that is defined in the instance template.
returned: success
type: int
refreshing:
description:
- The number of instances in the managed instance group that are being reconfigured
with properties that do not require a restart or a recreate action. For
example, setting or removing target pools for the instance.
returned: success
type: int
restarting:
description:
- The number of instances in the managed instance group that are scheduled
to be restarted or are currently being restarted.
returned: success
type: int
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- A unique identifier for this resource.
returned: success
type: int
instanceGroup:
description:
- The instance group being managed.
returned: success
type: dict
instanceTemplate:
description:
- The instance template that is specified for this managed instance group. The
group uses this template to create all new instances in the managed instance
group.
returned: success
type: dict
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long,
and comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Named ports configured for the Instance Groups complementary to this Instance
Group Manager.
returned: success
type: complex
contains:
name:
description:
- The name of the managed instance group. The name must be 1-63 characters long, and
comply with RFC1035.
returned: success
type: str
namedPorts:
description:
- Named ports configured for the Instance Groups complementary to this Instance Group
Manager.
returned: success
type: complex
contains:
name:
description:
- The name for this named port. The name must be 1-63 characters long, and comply
with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
region:
description:
- The region this managed instance group resides (for regional resources).
returned: success
type: str
targetPools:
description:
- TargetPool resources to which instances in the instanceGroup field are added. The
target pools automatically apply to all of the instances in the managed instance
group.
returned: success
type: list
targetSize:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this number.
returned: success
type: int
zone:
description:
- The zone the managed instance group resides.
returned: success
type: str
description:
- The name for this named port. The name must be 1-63 characters long, and
comply with RFC1035.
returned: success
type: str
port:
description:
- The port number, which can be a value between 1 and 65535.
returned: success
type: int
region:
description:
- The region this managed instance group resides (for regional resources).
returned: success
type: str
targetPools:
description:
- TargetPool resources to which instances in the instanceGroup field are added.
The target pools automatically apply to all of the instances in the managed
instance group.
returned: success
type: list
targetSize:
description:
- The target number of running instances for this managed instance group. Deleting
or abandoning instances reduces this number. Resizing the group changes this
number.
returned: success
type: int
zone:
description:
- The zone the managed instance group resides.
returned: success
type: str
'''
################################################################################
@ -237,7 +239,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

File diff suppressed because it is too large Load diff

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_instance_template_facts
description:
- Gather facts for GCP InstanceTemplate
- Gather facts for GCP InstanceTemplate
short_description: Gather facts for GCP InstanceTemplate
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,379 +61,404 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the
server.
returned: success
type: int
name:
description:
- Name of the resource. The name is 1-63 characters long and complies with RFC1035.
returned: success
type: str
properties:
description:
- The instance properties for this instance template.
returned: success
type: complex
contains:
canIpForward:
description:
- Enables instances created based on this template to send packets with
source IP addresses other than their own and receive packets with destination
IP addresses other than their own. If these instances will be used as
an IP gateway or it will be set as the next-hop in a Route resource, specify
true. If unsure, leave this set to false.
returned: success
type: bool
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource. This identifier is defined by the server.
returned: success
type: int
name:
description:
- Name of the resource. The name is 1-63 characters long and complies with RFC1035.
returned: success
type: str
properties:
description:
- The instance properties for this instance template.
returned: success
type: complex
contains:
canIpForward:
description:
- Enables instances created based on this template to send packets with source IP
addresses other than their own and receive packets with destination IP addresses
other than their own. If these instances will be used as an IP gateway or it will
be set as the next-hop in a Route resource, specify true. If unsure, leave this
set to false.
returned: success
type: bool
description:
description:
- An optional text description for the instances that are created from this instance
template.
returned: success
type: str
disks:
description:
- An array of disks that are associated with the instances that are created from this
template.
returned: success
type: complex
contains:
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance is deleted (but
not when the disk is detached from the instance).
- 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left
behind on machine deletion.'
returned: success
type: bool
boot:
description:
- Indicates that this is a boot disk. The virtual machine will use the first partition
of the disk for its root filesystem.
returned: success
type: bool
deviceName:
description:
- Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-*
tree of a Linux operating system running within the instance. This name can be used
to reference the device for mounting, resizing, and so on, from within the instance.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts or decrypts a disk using a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
rsaEncryptedKey:
description:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption
key to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
index:
description:
- Assigns a zero-based index to this disk, where 0 is reserved for the boot disk.
For example, if you have many disks attached to an instance, each disk would have
a unique index number. If not specified, the server will choose an appropriate value.
returned: success
type: int
initializeParams:
description:
- Specifies the parameters for a new disk that will be created alongside the new instance.
Use initialization parameters to create boot disks or local SSDs attached to the
new instance.
returned: success
type: complex
contains:
diskName:
description:
- Specifies the disk name. If not specified, the default is to use the name of the
instance.
returned: success
type: str
diskSizeGb:
description:
- Specifies the size of the disk in base-2 GB.
returned: success
type: int
diskType:
description:
- Reference to a gcompute_disk_type resource.
- Specifies the disk type to use to create the instance.
- If not specified, the default is pd-standard.
returned: success
type: str
sourceImage:
description:
- The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage
or disks.source is required. To create a disk with one of the public operating
system images, specify the image by its family name.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required if the source
image is protected by a customer-supplied encryption key.
- Instance templates do not store customer-supplied encryption keys, so you cannot
create disks for instances in a managed instance group if the source images are
encrypted with your own keys.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
interface:
description:
- Specifies the disk interface to use for attaching this disk, which is either SCSI
or NVME. The default is SCSI.
- Persistent disks must always use SCSI and the request will fail if you attempt to
attach a persistent disk in any other format than SCSI.
returned: success
type: str
mode:
description:
- The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified,
the default is to attach the disk in READ_WRITE mode.
returned: success
type: str
source:
description:
- Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage
or disks.source is required.
- If desired, you can also attach existing non-root persistent disks using this property.
This field is only applicable for persistent disks.
- Note that for InstanceTemplate, specify the disk name, not the URL for the disk.
returned: success
type: dict
type:
description:
- Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified,
the default is PERSISTENT.
returned: success
type: str
machineType:
description:
- Reference to a gcompute_machine_type resource.
returned: success
type: str
metadata:
description:
- The metadata key/value pairs to assign to instances that are created from this template.
These pairs can consist of custom metadata or predefined keys.
returned: success
type: dict
guestAccelerators:
description:
- List of the type and count of accelerator cards attached to the instance .
returned: success
type: complex
contains:
acceleratorCount:
description:
- The number of the guest accelerator cards exposed to this instance.
returned: success
type: int
acceleratorType:
description:
- Full or partial URL of the accelerator type resource to expose to this instance.
returned: success
type: str
networkInterfaces:
description:
- An array of configurations for this interface. This specifies how this interface
is configured to interact with other network services, such as connecting to the
internet. Only one network interface is supported per instance.
returned: success
type: complex
contains:
accessConfigs:
description:
- An array of configurations for this interface. Currently, only one access config,
ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this
instance will have no external internet access.
returned: success
type: complex
contains:
name:
description:
- The name of this access configuration. The default and recommended name is External
NAT but you can use any arbitrary string you would like. For example, My external
IP or Network Access.
returned: success
type: str
natIP:
description:
- Specifies the title of a gcompute_address.
- An external IP address associated with this instance.
- Specify an unused static external IP address available to the project or leave this
field undefined to use an IP from a shared ephemeral IP address pool. If you specify
a static external IP address, it must live in the same region as the zone of the
instance.
returned: success
type: dict
type:
description:
- The type of configuration. The default and only option is ONE_TO_ONE_NAT.
returned: success
type: str
aliasIpRanges:
description:
- An array of alias IP ranges for this network interface. Can only be specified for
network interfaces on subnet-mode networks.
returned: success
type: complex
contains:
ipCidrRange:
description:
- The IP CIDR range represented by this alias IP range.
- This IP CIDR range must belong to the specified subnetwork and cannot contain IP
addresses reserved by system or used by other network interfaces. This range may
be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string
(e.g. 10.1.2.0/24).
returned: success
type: str
subnetworkRangeName:
description:
- Optional subnetwork secondary range name specifying the secondary range from which
to allocate the IP CIDR range for this alias IP range. If left unspecified, the
primary range of the subnetwork will be used.
returned: success
type: str
name:
description:
- The name of the network interface, generated by the server. For network devices,
these are eth0, eth1, etc .
returned: success
type: str
network:
description:
- Specifies the title of an existing gcompute_network. When creating an instance,
if neither the network nor the subnetwork is specified, the default network global/networks/default
is used; if the network is not specified but the subnetwork is specified, the network
is inferred.
returned: success
type: dict
networkIP:
description:
- An IPv4 internal network address to assign to the instance for this network interface.
If not specified by the user, an unused internal IP is assigned by the system.
returned: success
type: str
subnetwork:
description:
- Reference to a gcompute_subnetwork resource.
- If the network resource is in legacy mode, do not provide this property. If the
network is in auto subnet mode, providing the subnetwork is optional. If the network
is in custom subnet mode, then this field should be specified.
returned: success
type: dict
scheduling:
description:
- Sets the scheduling options for this instance.
returned: success
type: complex
contains:
automaticRestart:
description:
- Specifies whether the instance should be automatically restarted if it is terminated
by Compute Engine (not terminated by a user).
- You can only set the automatic restart option for standard instances. Preemptible
instances cannot be automatically restarted.
returned: success
type: bool
onHostMaintenance:
description:
- Defines the maintenance behavior for this instance. For standard instances, the
default behavior is MIGRATE. For preemptible instances, the default and only possible
behavior is TERMINATE.
- For more information, see Setting Instance Scheduling Options.
returned: success
type: str
preemptible:
description:
- Defines whether the instance is preemptible. This can only be set during instance
creation, it cannot be set or changed after the instance has been created.
returned: success
type: bool
serviceAccounts:
description:
- A list of service accounts, with their specified scopes, authorized for this instance.
Only one service account per VM instance is supported.
returned: success
type: complex
contains:
email:
description:
- Email address of the service account.
returned: success
type: str
scopes:
description:
- The list of scopes to be made available for this service account.
returned: success
type: list
tags:
description:
- A list of tags to apply to this instance. Tags are used to identify valid sources
or targets for network firewalls and are specified by the client during instance
creation. The tags can be later modified by the setTags method. Each tag within
the list must comply with RFC1035.
returned: success
type: complex
contains:
fingerprint:
description:
- Specifies a fingerprint for this request, which is essentially a hash of the metadata's
contents and used for optimistic locking.
- The fingerprint is initially generated by Compute Engine and changes after every
request to modify or update metadata. You must always provide an up-to-date fingerprint
hash in order to update or change metadata.
returned: success
type: str
items:
description:
- An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035.
returned: success
type: list
description:
- An optional text description for the instances that are created from this
instance template.
returned: success
type: str
disks:
description:
- An array of disks that are associated with the instances that are created
from this template.
returned: success
type: complex
contains:
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance
is deleted (but not when the disk is detached from the instance).
- 'Tip: Disks should be set to autoDelete=true so that leftover disks
are not left behind on machine deletion.'
returned: success
type: bool
boot:
description:
- Indicates that this is a boot disk. The virtual machine will use the
first partition of the disk for its root filesystem.
returned: success
type: bool
deviceName:
description:
- Specifies a unique device name of your choice that is reflected into
the /dev/disk/by-id/google-* tree of a Linux operating system running
within the instance. This name can be used to reference the device
for mounting, resizing, and so on, from within the instance.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts or decrypts a disk using a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded
in RFC 4648 base64 to either encrypt or decrypt this resource.
returned: success
type: str
rsaEncryptedKey:
description:
- Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied
encryption key to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
returned: success
type: str
index:
description:
- Assigns a zero-based index to this disk, where 0 is reserved for the
boot disk. For example, if you have many disks attached to an instance,
each disk would have a unique index number. If not specified, the
server will choose an appropriate value.
returned: success
type: int
initializeParams:
description:
- Specifies the parameters for a new disk that will be created alongside
the new instance. Use initialization parameters to create boot disks
or local SSDs attached to the new instance.
returned: success
type: complex
contains:
diskName:
description:
- Specifies the disk name. If not specified, the default is to use
the name of the instance.
returned: success
type: str
diskSizeGb:
description:
- Specifies the size of the disk in base-2 GB.
returned: success
type: int
diskType:
description:
- Reference to a gcompute_disk_type resource.
- Specifies the disk type to use to create the instance.
- If not specified, the default is pd-standard.
returned: success
type: str
sourceImage:
description:
- The source image to create this disk. When creating a new instance,
one of initializeParams.sourceImage or disks.source is required.
To create a disk with one of the public operating system images,
specify the image by its family name.
returned: success
type: str
sourceImageEncryptionKey:
description:
- The customer-supplied encryption key of the source image. Required
if the source image is protected by a customer-supplied encryption
key.
- Instance templates do not store customer-supplied encryption keys,
so you cannot create disks for instances in a managed instance
group if the source images are encrypted with your own keys.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded
in RFC 4648 base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
encryption key that protects this resource.
returned: success
type: str
interface:
description:
- Specifies the disk interface to use for attaching this disk, which
is either SCSI or NVME. The default is SCSI.
- Persistent disks must always use SCSI and the request will fail if
you attempt to attach a persistent disk in any other format than SCSI.
returned: success
type: str
mode:
description:
- The mode in which to attach this disk, either READ_WRITE or READ_ONLY.
If not specified, the default is to attach the disk in READ_WRITE
mode.
returned: success
type: str
source:
description:
- Reference to a gcompute_disk resource. When creating a new instance,
one of initializeParams.sourceImage or disks.source is required.
- If desired, you can also attach existing non-root persistent disks
using this property. This field is only applicable for persistent
disks.
- Note that for InstanceTemplate, specify the disk name, not the URL
for the disk.
returned: success
type: dict
type:
description:
- Specifies the type of the disk, either SCRATCH or PERSISTENT. If not
specified, the default is PERSISTENT.
returned: success
type: str
machineType:
description:
- Reference to a gcompute_machine_type resource.
returned: success
type: str
minCpuPlatform:
description:
- Specifies a minimum CPU platform for the VM instance. Applicable values
are the friendly names of CPU platforms .
returned: success
type: str
metadata:
description:
- The metadata key/value pairs to assign to instances that are created from
this template. These pairs can consist of custom metadata or predefined
keys.
returned: success
type: dict
guestAccelerators:
description:
- List of the type and count of accelerator cards attached to the instance
.
returned: success
type: complex
contains:
acceleratorCount:
description:
- The number of the guest accelerator cards exposed to this instance.
returned: success
type: int
acceleratorType:
description:
- Full or partial URL of the accelerator type resource to expose to
this instance.
returned: success
type: str
networkInterfaces:
description:
- An array of configurations for this interface. This specifies how this
interface is configured to interact with other network services, such
as connecting to the internet. Only one network interface is supported
per instance.
returned: success
type: complex
contains:
accessConfigs:
description:
- An array of configurations for this interface. Currently, only one
access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs
specified, then this instance will have no external internet access.
returned: success
type: complex
contains:
name:
description:
- The name of this access configuration. The default and recommended
name is External NAT but you can use any arbitrary string you
would like. For example, My external IP or Network Access.
returned: success
type: str
natIP:
description:
- Specifies the title of a gcompute_address.
- An external IP address associated with this instance.
- Specify an unused static external IP address available to the
project or leave this field undefined to use an IP from a shared
ephemeral IP address pool. If you specify a static external IP
address, it must live in the same region as the zone of the instance.
returned: success
type: dict
type:
description:
- The type of configuration. The default and only option is ONE_TO_ONE_NAT.
returned: success
type: str
aliasIpRanges:
description:
- An array of alias IP ranges for this network interface. Can only be
specified for network interfaces on subnet-mode networks.
returned: success
type: complex
contains:
ipCidrRange:
description:
- The IP CIDR range represented by this alias IP range.
- This IP CIDR range must belong to the specified subnetwork and
cannot contain IP addresses reserved by system or used by other
network interfaces. This range may be a single IP address (e.g.
10.2.3.4), a netmask (e.g. /24) or a CIDR format string (e.g.
10.1.2.0/24).
returned: success
type: str
subnetworkRangeName:
description:
- Optional subnetwork secondary range name specifying the secondary
range from which to allocate the IP CIDR range for this alias
IP range. If left unspecified, the primary range of the subnetwork
will be used.
returned: success
type: str
name:
description:
- The name of the network interface, generated by the server. For network
devices, these are eth0, eth1, etc .
returned: success
type: str
network:
description:
- Specifies the title of an existing gcompute_network. When creating
an instance, if neither the network nor the subnetwork is specified,
the default network global/networks/default is used; if the network
is not specified but the subnetwork is specified, the network is inferred.
returned: success
type: dict
networkIP:
description:
- An IPv4 internal network address to assign to the instance for this
network interface. If not specified by the user, an unused internal
IP is assigned by the system.
returned: success
type: str
subnetwork:
description:
- Reference to a gcompute_subnetwork resource.
- If the network resource is in legacy mode, do not provide this property.
If the network is in auto subnet mode, providing the subnetwork is
optional. If the network is in custom subnet mode, then this field
should be specified.
returned: success
type: dict
scheduling:
description:
- Sets the scheduling options for this instance.
returned: success
type: complex
contains:
automaticRestart:
description:
- Specifies whether the instance should be automatically restarted if
it is terminated by Compute Engine (not terminated by a user).
- You can only set the automatic restart option for standard instances.
Preemptible instances cannot be automatically restarted.
returned: success
type: bool
onHostMaintenance:
description:
- Defines the maintenance behavior for this instance. For standard instances,
the default behavior is MIGRATE. For preemptible instances, the default
and only possible behavior is TERMINATE.
- For more information, see Setting Instance Scheduling Options.
returned: success
type: str
preemptible:
description:
- Defines whether the instance is preemptible. This can only be set
during instance creation, it cannot be set or changed after the instance
has been created.
returned: success
type: bool
serviceAccounts:
description:
- A list of service accounts, with their specified scopes, authorized for
this instance. Only one service account per VM instance is supported.
returned: success
type: complex
contains:
email:
description:
- Email address of the service account.
returned: success
type: str
scopes:
description:
- The list of scopes to be made available for this service account.
returned: success
type: list
tags:
description:
- A list of tags to apply to this instance. Tags are used to identify valid
sources or targets for network firewalls and are specified by the client
during instance creation. The tags can be later modified by the setTags
method. Each tag within the list must comply with RFC1035.
returned: success
type: complex
contains:
fingerprint:
description:
- Specifies a fingerprint for this request, which is essentially a hash
of the metadata's contents and used for optimistic locking.
- The fingerprint is initially generated by Compute Engine and changes
after every request to modify or update metadata. You must always
provide an up-to-date fingerprint hash in order to update or change
metadata.
returned: success
type: str
items:
description:
- An array of tags. Each tag must be 1-63 characters long, and comply
with RFC1035.
returned: success
type: list
'''
################################################################################
@ -455,7 +479,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,78 +32,83 @@ DOCUMENTATION = '''
---
module: gcp_compute_network
description:
- Represents a Network resource.
- Your Cloud Platform Console project can contain multiple networks, and each network
can have multiple instances attached to it. A network allows you to define a gateway
IP and the network range for the instances attached to that network. Every project
is provided with a default network with preset configurations and firewall rules.
You can choose to customize the default network by adding or removing rules, or
you can create new networks in that project. Generally, most users only need one
network, although you can have up to five networks per project by default.
- A network belongs to only one project, and each instance can only belong to one
network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently
does not support IPv6. However, Google is a major advocate of IPv6 and it is an
important future direction.
- Represents a Network resource.
- Your Cloud Platform Console project can contain multiple networks, and each network
can have multiple instances attached to it. A network allows you to define a gateway
IP and the network range for the instances attached to that network. Every project
is provided with a default network with preset configurations and firewall rules.
You can choose to customize the default network by adding or removing rules, or
you can create new networks in that project. Generally, most users only need one
network, although you can have up to five networks per project by default.
- A network belongs to only one project, and each instance can only belong to one
network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently
does not support IPv6. However, Google is a major advocate of IPv6 and it is an
important future direction.
short_description: Creates a GCP Network
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range
is a CIDR specification, for example: 192.168.0.0/16. Provided by the client
when the network is created.'
required: false
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
auto_create_subnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to
false, the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR
of 10.128.0.0/9 and it automatically creates one subnetwork per region.
required: false
type: bool
routing_config:
description:
- The network-level routing configuration for this network. Used by Cloud Router
to determine what type of network-wide routing behavior to enforce.
required: false
version_added: 2.8
suboptions:
routing_mode:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range is a
CIDR specification, for example: 192.168.0.0/16. Provided by the client when the
network is created.'
required: false
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.
- The network-wide routing mode to use. If set to REGIONAL, this network's
cloud routers will only advertise routes with subnetworks of this network
in the same region as the router. If set to GLOBAL, this network's cloud
routers will advertise routes with all subnetworks of this network, across
regions.
required: true
auto_create_subnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to false,
the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9
and it automatically creates one subnetwork per region.
required: false
type: bool
routing_config:
description:
- The network-level routing configuration for this network. Used by Cloud Router to
determine what type of network-wide routing behavior to enforce.
required: false
version_added: 2.8
suboptions:
routing_mode:
description:
- The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers
will only advertise routes with subnetworks of this network in the same region as
the router. If set to GLOBAL, this network's cloud routers will advertise routes
with all subnetworks of this network, across regions.
required: true
choices: ['REGIONAL', 'GLOBAL']
choices:
- REGIONAL
- GLOBAL
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/networks)"
- "Official Documentation: U(https://cloud.google.com/vpc/docs/vpc)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/networks)'
- 'Official Documentation: U(https://cloud.google.com/vpc/docs/vpc)'
'''
EXAMPLES = '''
@ -118,74 +123,74 @@ EXAMPLES = '''
'''
RETURN = '''
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
gateway_ipv4:
description:
- A gateway address for default routing to other networks. This value is read only
and is selected by the Google Compute Engine, typically as the first usable address
in the IPv4Range.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range is a
CIDR specification, for example: 192.168.0.0/16. Provided by the client when the
network is created.'
returned: success
type: str
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
subnetworks:
description:
- Server-defined fully-qualified URLs for all subnetworks in this network.
returned: success
type: list
autoCreateSubnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to false,
the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9
and it automatically creates one subnetwork per region.
returned: success
type: bool
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
routingConfig:
description:
- The network-level routing configuration for this network. Used by Cloud Router to
determine what type of network-wide routing behavior to enforce.
returned: success
type: complex
contains:
routingMode:
description:
- The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers
will only advertise routes with subnetworks of this network in the same region as
the router. If set to GLOBAL, this network's cloud routers will advertise routes
with all subnetworks of this network, across regions.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
gateway_ipv4:
description:
- A gateway address for default routing to other networks. This value is read only
and is selected by the Google Compute Engine, typically as the first usable address
in the IPv4Range.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range is
a CIDR specification, for example: 192.168.0.0/16. Provided by the client when
the network is created.'
returned: success
type: str
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
subnetworks:
description:
- Server-defined fully-qualified URLs for all subnetworks in this network.
returned: success
type: list
autoCreateSubnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to false,
the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR of
10.128.0.0/9 and it automatically creates one subnetwork per region.
returned: success
type: bool
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
routingConfig:
description:
- The network-level routing configuration for this network. Used by Cloud Router
to determine what type of network-wide routing behavior to enforce.
returned: success
type: complex
contains:
routingMode:
description:
- The network-wide routing mode to use. If set to REGIONAL, this network's cloud
routers will only advertise routes with subnetworks of this network in the
same region as the router. If set to GLOBAL, this network's cloud routers
will advertise routes with all subnetworks of this network, across regions.
returned: success
type: str
'''
################################################################################
@ -273,7 +278,7 @@ def routing_config_update(module, request, response):
"projects/{project}/regions/{region}/subnetworks/{name}"
]).format(**module.params),
{
u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request()
u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request()
}
)
@ -290,7 +295,7 @@ def resource_to_request(module):
u'IPv4Range': module.params.get('ipv4_range'),
u'name': module.params.get('name'),
u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'),
u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request()
u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request()
}
return_vals = {}
for k, v in request.items():
@ -364,7 +369,7 @@ def response_to_hash(module, response):
u'subnetworks': response.get(u'subnetworks'),
u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'),
u'creationTimestamp': response.get(u'creationTimestamp'),
u'routingConfig': NetworkRoutingConfigArray(response.get(u'routingConfig', []), module).from_response()
u'routingConfig': NetworkRoutingconfigArray(response.get(u'routingConfig', []), module).from_response()
}
@ -392,8 +397,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
@ -405,7 +408,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class NetworkRoutingConfigArray(object):
class NetworkRoutingconfigArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_network_facts
description:
- Gather facts for GCP Network
- Gather facts for GCP Network
short_description: Gather facts for GCP Network
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,78 +61,79 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
gateway_ipv4:
description:
- A gateway address for default routing to other networks. This value is read only
and is selected by the Google Compute Engine, typically as the first usable address
in the IPv4Range.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range is a
CIDR specification, for example: 192.168.0.0/16. Provided by the client when the
network is created.'
returned: success
type: str
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
subnetworks:
description:
- Server-defined fully-qualified URLs for all subnetworks in this network.
returned: success
type: list
autoCreateSubnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to false,
the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9
and it automatically creates one subnetwork per region.
returned: success
type: bool
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
routingConfig:
description:
- The network-level routing configuration for this network. Used by Cloud Router to
determine what type of network-wide routing behavior to enforce.
returned: success
type: complex
contains:
routingMode:
description:
- The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers
will only advertise routes with subnetworks of this network in the same region as
the router. If set to GLOBAL, this network's cloud routers will advertise routes
with all subnetworks of this network, across regions.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
gateway_ipv4:
description:
- A gateway address for default routing to other networks. This value is read
only and is selected by the Google Compute Engine, typically as the first
usable address in the IPv4Range.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipv4_range:
description:
- 'The range of internal addresses that are legal on this network. This range
is a CIDR specification, for example: 192.168.0.0/16. Provided by the client
when the network is created.'
returned: success
type: str
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
subnetworks:
description:
- Server-defined fully-qualified URLs for all subnetworks in this network.
returned: success
type: list
autoCreateSubnetworks:
description:
- When set to true, the network is created in "auto subnet mode". When set to
false, the network is in "custom subnet mode".
- In "auto subnet mode", a newly created network is assigned the default CIDR
of 10.128.0.0/9 and it automatically creates one subnetwork per region.
returned: success
type: bool
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
routingConfig:
description:
- The network-level routing configuration for this network. Used by Cloud Router
to determine what type of network-wide routing behavior to enforce.
returned: success
type: complex
contains:
routingMode:
description:
- The network-wide routing mode to use. If set to REGIONAL, this network's
cloud routers will only advertise routes with subnetworks of this network
in the same region as the router. If set to GLOBAL, this network's cloud
routers will advertise routes with all subnetworks of this network, across
regions.
returned: success
type: str
'''
################################################################################
@ -154,7 +154,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,127 +32,128 @@ DOCUMENTATION = '''
---
module: gcp_compute_region_disk
description:
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
short_description: Creates a GCP RegionDisk
version_added: 2.8
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
required: false
licenses:
description:
- Any applicable publicly visible licenses.
required: false
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
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
required: false
replica_zones:
description:
- URLs of the zones where the disk should be replicated to.
required: true
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
required: false
region:
description:
- A reference to the region where the disk resides.
required: true
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
required: false
suboptions:
raw_key:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
labels:
sha256:
description:
- Labels to apply to this disk. A list of key->value pairs.
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
licenses:
source_snapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively,
you can set this source_snapshot to a dictionary with the selfLink key where
the value is the selfLink of your Snapshot'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Any applicable publicly visible licenses.
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
name:
sha256:
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
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
required: false
replica_zones:
description:
- URLs of the zones where the disk should be replicated to.
required: true
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
required: false
region:
description:
- A reference to the region where the disk resides.
required: true
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
source_snapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively,
you can set this source_snapshot to a dictionary with the selfLink key where the
value is the selfLink of your Snapshot.'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)"
- "Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)'
- 'Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)'
'''
EXAMPLES = '''
@ -173,150 +174,149 @@ EXAMPLES = '''
'''
RETURN = '''
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or
to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted and
recreated under the same name, the source snapshot ID would identify the exact
version of the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -443,8 +443,8 @@ def delete(module, link, kind):
def resource_to_request(module):
request = {
u'kind': 'compute#disk',
u'diskEncryptionKey': RegionDiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': RegionDiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'diskEncryptionKey': RegionDiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': RegionDiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'description': module.params.get('description'),
u'labels': module.params.get('labels'),
u'licenses': module.params.get('licenses'),
@ -575,8 +575,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
@ -588,7 +586,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class RegionDiskDiskEncryptionKey(object):
class RegionDiskDiskencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -609,7 +607,7 @@ class RegionDiskDiskEncryptionKey(object):
})
class RegionDiskSourceSnapshotEncryptionKey(object):
class RegionDiskSourcesnapshotencryptionkey(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_region_disk_facts
description:
- Gather facts for GCP RegionDisk
- Gather facts for GCP RegionDisk
short_description: Gather facts for GCP RegionDisk
version_added: 2.8
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- A reference to the region where the disk resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- A reference to the region where the disk resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,154 +66,154 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
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
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of
the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create
the disk. Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the
disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need
to provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted
and recreated under the same name, the source snapshot ID would identify the
exact version of the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -236,7 +235,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,103 +32,105 @@ DOCUMENTATION = '''
---
module: gcp_compute_route
description:
- Represents a Route resource.
- A route is a rule that specifies how certain packets should be handled by the virtual
network. Routes are associated with virtual machines by tag, and the set of routes
for a particular virtual machine is called its routing table. For each packet leaving
a virtual machine, the system searches that virtual machine's routing table for
a single best matching route.
- Routes match packets by destination IP address, preferring smaller or more specific
ranges over larger ones. If there is a tie, the system selects the route with the
smallest priority value. If there is still a tie, it uses the layer three and four
packet headers to select just one of the remaining matching routes. The packet is
then forwarded as specified by the next_hop field of the winning route -- either
to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated
gateway. Packets that do not match any route in the sending virtual machine's routing
table will be dropped.
- A Route resource must have exactly one specification of either nextHopGateway, nextHopInstance,
nextHopIp, or nextHopVpnTunnel.
- Represents a Route resource.
- A route is a rule that specifies how certain packets should be handled by the virtual
network. Routes are associated with virtual machines by tag, and the set of routes
for a particular virtual machine is called its routing table. For each packet leaving
a virtual machine, the system searches that virtual machine's routing table for
a single best matching route.
- Routes match packets by destination IP address, preferring smaller or more specific
ranges over larger ones. If there is a tie, the system selects the route with the
smallest priority value. If there is still a tie, it uses the layer three and four
packet headers to select just one of the remaining matching routes. The packet is
then forwarded as specified by the next_hop field of the winning route -- either
to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated
gateway. Packets that do not match any route in the sending virtual machine's routing
table will be dropped.
- A Route resource must have exactly one specification of either nextHopGateway, nextHopInstance,
nextHopIp, or nextHopVpnTunnel.
short_description: Creates a GCP Route
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'
dest_range:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
required: true
state:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
version_added: 2.7
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
network:
description:
- The network that this route applies to.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: true
priority:
description:
- The priority of this route. Priority is used to break ties in cases where there
is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
required: false
tags:
description:
- A list of instance tags to which this route applies.
required: false
next_hop_gateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial valid
URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
required: false
next_hop_instance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
required: false
next_hop_ip:
description:
- Network IP address of an instance that should handle matching packets.
required: false
next_hop_vpn_tunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
dest_range:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
required: true
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
version_added: 2.7
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
network:
description:
- The network that this route applies to.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: true
priority:
description:
- The priority of this route. Priority is used to break ties in cases where there
is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
required: false
tags:
description:
- A list of instance tags to which this route applies.
required: false
next_hop_gateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial
valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
required: false
next_hop_instance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
required: false
next_hop_ip:
description:
- Network IP address of an instance that should handle matching packets.
required: false
next_hop_vpn_tunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routes)"
- "Using Routes: U(https://cloud.google.com/vpc/docs/using-routes)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routes)'
- 'Using Routes: U(https://cloud.google.com/vpc/docs/using-routes)'
'''
EXAMPLES = '''
@ -157,79 +159,79 @@ EXAMPLES = '''
'''
RETURN = '''
destRange:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
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
network:
description:
- The network that this route applies to.
returned: success
type: dict
priority:
description:
- The priority of this route. Priority is used to break ties in cases where there
is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
returned: success
type: int
tags:
description:
- A list of instance tags to which this route applies.
returned: success
type: list
nextHopGateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial valid
URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
returned: success
type: str
nextHopInstance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
returned: success
type: str
nextHopIp:
description:
- Network IP address of an instance that should handle matching packets.
returned: success
type: str
nextHopVpnTunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
returned: success
type: str
nextHopNetwork:
description:
- URL to a Network that should handle matching packets.
returned: success
type: str
destRange:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
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
network:
description:
- The network that this route applies to.
returned: success
type: dict
priority:
description:
- The priority of this route. Priority is used to break ties in cases where there
is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
returned: success
type: int
tags:
description:
- A list of instance tags to which this route applies.
returned: success
type: list
nextHopGateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial
valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
returned: success
type: str
nextHopInstance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
returned: success
type: str
nextHopIp:
description:
- Network IP address of an instance that should handle matching packets.
returned: success
type: str
nextHopVpnTunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
returned: success
type: str
nextHopNetwork:
description:
- URL to a Network that should handle matching packets.
returned: success
type: str
'''
################################################################################
@ -425,8 +427,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_route_facts
description:
- Gather facts for GCP Route
- Gather facts for GCP Route
short_description: Gather facts for GCP Route
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,83 +61,83 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
destRange:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
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
network:
description:
- The network that this route applies to.
returned: success
type: dict
priority:
description:
- The priority of this route. Priority is used to break ties in cases where there
is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
returned: success
type: int
tags:
description:
- A list of instance tags to which this route applies.
returned: success
type: list
nextHopGateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial valid
URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
returned: success
type: str
nextHopInstance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
returned: success
type: str
nextHopIp:
description:
- Network IP address of an instance that should handle matching packets.
returned: success
type: str
nextHopVpnTunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
returned: success
type: str
nextHopNetwork:
description:
- URL to a Network that should handle matching packets.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
destRange:
description:
- The destination range of outgoing packets that this route applies to.
- Only IPv4 is supported.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
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
network:
description:
- The network that this route applies to.
returned: success
type: dict
priority:
description:
- The priority of this route. Priority is used to break ties in cases where
there is more than one matching route of equal prefix length.
- In the case of two routes with equal prefix length, the one with the lowest-numbered
priority value wins.
- Default value is 1000. Valid range is 0 through 65535.
returned: success
type: int
tags:
description:
- A list of instance tags to which this route applies.
returned: success
type: list
nextHopGateway:
description:
- URL to a gateway that should handle matching packets.
- 'Currently, you can only specify the internet gateway, using a full or partial
valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway)
* projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway
.'
returned: success
type: str
nextHopInstance:
description:
- URL to an instance that should handle matching packets.
- 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/)
instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance
.'
returned: success
type: str
nextHopIp:
description:
- Network IP address of an instance that should handle matching packets.
returned: success
type: str
nextHopVpnTunnel:
description:
- URL to a VpnTunnel that should handle matching packets.
returned: success
type: str
nextHopNetwork:
description:
- URL to a Network that should handle matching packets.
returned: success
type: str
'''
################################################################################
@ -159,7 +158,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,91 +32,97 @@ DOCUMENTATION = '''
---
module: gcp_compute_router
description:
- Represents a Router resource.
- Represents a Router resource.
short_description: Creates a GCP Router
version_added: 2.7
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'
name:
description:
- Name of the resource. 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
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
required: false
network:
description:
- A reference to the network to which this router belongs.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: true
bgp:
description:
- BGP information specific to this router.
required: false
suboptions:
asn:
description:
- An optional description of this resource.
required: false
network:
description:
- A reference to the network to which this router belongs.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN,
either 16-bit or 32-bit. The value will be fixed for this router resource.
All VPN tunnels that link to this router will have the same local ASN.
required: true
bgp:
advertise_mode:
description:
- BGP information specific to this router.
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
required: false
default: DEFAULT
choices:
- DEFAULT
- CUSTOM
advertised_groups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised
to all peers of the router. These groups will be advertised in addition
to any specified prefixes. Leave this field blank to advertise no custom
groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
required: false
advertised_ip_ranges:
description:
- User-specified list of individual IP ranges to advertise in custom mode.
This field can only be populated if advertiseMode is CUSTOM and is advertised
to all peers of the router. These IP ranges will be advertised in addition
to any specified groups.
- Leave this field blank to advertise no custom IP ranges.
required: false
suboptions:
asn:
description:
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either
16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels
that link to this router will have the same local ASN.
required: true
advertise_mode:
description:
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
required: false
default: DEFAULT
choices: ['DEFAULT', 'CUSTOM']
advertised_groups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised to
all peers of the router. These groups will be advertised in addition to any specified
prefixes. Leave this field blank to advertise no custom groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
required: false
advertised_ip_ranges:
description:
- User-specified list of individual IP ranges to advertise in custom mode. This field
can only be populated if advertiseMode is CUSTOM and is advertised to all peers
of the router. These IP ranges will be advertised in addition to any specified groups.
- Leave this field blank to advertise no custom IP ranges.
required: false
suboptions:
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
required: false
description:
description:
- User-specified description for the IP range.
required: false
region:
description:
- Region where the router resides.
required: true
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
required: false
description:
description:
- User-specified description for the IP range.
required: false
region:
description:
- Region where the router resides.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routers)"
- "Google Cloud Router: U(https://cloud.google.com/router/docs/)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routers)'
- 'Google Cloud Router: U(https://cloud.google.com/router/docs/)'
'''
EXAMPLES = '''
@ -149,87 +155,88 @@ EXAMPLES = '''
'''
RETURN = '''
id:
id:
description:
- The unique identifier for the resource.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
network:
description:
- A reference to the network to which this router belongs.
returned: success
type: dict
bgp:
description:
- BGP information specific to this router.
returned: success
type: complex
contains:
asn:
description:
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN,
either 16-bit or 32-bit. The value will be fixed for this router resource.
All VPN tunnels that link to this router will have the same local ASN.
returned: success
type: int
advertiseMode:
description:
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
returned: success
type: str
advertisedGroups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised
to all peers of the router. These groups will be advertised in addition to
any specified prefixes. Leave this field blank to advertise no custom groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
returned: success
type: list
advertisedIpRanges:
description:
- User-specified list of individual IP ranges to advertise in custom mode. This
field can only be populated if advertiseMode is CUSTOM and is advertised to
all peers of the router. These IP ranges will be advertised in addition to
any specified groups.
- Leave this field blank to advertise no custom IP ranges.
returned: success
type: complex
contains:
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
returned: success
type: str
description:
- The unique identifier for the resource.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
network:
description:
- A reference to the network to which this router belongs.
returned: success
type: dict
bgp:
description:
- BGP information specific to this router.
returned: success
type: complex
contains:
asn:
description:
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either
16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels
that link to this router will have the same local ASN.
returned: success
type: int
advertiseMode:
description:
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
returned: success
type: str
advertisedGroups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised to
all peers of the router. These groups will be advertised in addition to any specified
prefixes. Leave this field blank to advertise no custom groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
returned: success
type: list
advertisedIpRanges:
description:
- User-specified list of individual IP ranges to advertise in custom mode. This field
can only be populated if advertiseMode is CUSTOM and is advertised to all peers
of the router. These IP ranges will be advertised in addition to any specified groups.
- Leave this field blank to advertise no custom IP ranges.
returned: success
type: complex
contains:
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
returned: success
type: str
description:
description:
- User-specified description for the IP range.
returned: success
type: str
region:
description:
- Region where the router resides.
returned: success
type: str
description:
- User-specified description for the IP range.
returned: success
type: str
region:
description:
- Region where the router resides.
returned: success
type: str
'''
################################################################################
@ -419,8 +426,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
@ -445,7 +450,7 @@ class RouterBgp(object):
u'asn': self.request.get('asn'),
u'advertiseMode': self.request.get('advertise_mode'),
u'advertisedGroups': self.request.get('advertised_groups'),
u'advertisedIpRanges': RouterAdvertisedIpRangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request()
u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request()
})
def from_response(self):
@ -453,11 +458,11 @@ class RouterBgp(object):
u'asn': self.request.get(u'asn'),
u'advertiseMode': self.request.get(u'advertiseMode'),
u'advertisedGroups': self.request.get(u'advertisedGroups'),
u'advertisedIpRanges': RouterAdvertisedIpRangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response()
u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response()
})
class RouterAdvertisedIpRangesArray(object):
class RouterAdvertisediprangesArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_router_facts
description:
- Gather facts for GCP Router
- Gather facts for GCP Router
short_description: Gather facts for GCP Router
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- Region where the router resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- Region where the router resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,91 +66,93 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
id:
description: List of items
returned: always
type: complex
contains:
id:
description:
- The unique identifier for the resource.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
network:
description:
- A reference to the network to which this router belongs.
returned: success
type: dict
bgp:
description:
- BGP information specific to this router.
returned: success
type: complex
contains:
asn:
description:
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN,
either 16-bit or 32-bit. The value will be fixed for this router resource.
All VPN tunnels that link to this router will have the same local ASN.
returned: success
type: int
advertiseMode:
description:
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
returned: success
type: str
advertisedGroups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised
to all peers of the router. These groups will be advertised in addition
to any specified prefixes. Leave this field blank to advertise no custom
groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
returned: success
type: list
advertisedIpRanges:
description:
- User-specified list of individual IP ranges to advertise in custom mode.
This field can only be populated if advertiseMode is CUSTOM and is advertised
to all peers of the router. These IP ranges will be advertised in addition
to any specified groups.
- Leave this field blank to advertise no custom IP ranges.
returned: success
type: complex
contains:
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
returned: success
type: str
description:
- The unique identifier for the resource.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
network:
description:
- A reference to the network to which this router belongs.
returned: success
type: dict
bgp:
description:
- BGP information specific to this router.
returned: success
type: complex
contains:
asn:
description:
- Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either
16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels
that link to this router will have the same local ASN.
returned: success
type: int
advertiseMode:
description:
- User-specified flag to indicate which mode to use for advertisement.
- 'Valid values of this enum field are: DEFAULT, CUSTOM .'
returned: success
type: str
advertisedGroups:
description:
- User-specified list of prefix groups to advertise in custom mode.
- This field can only be populated if advertiseMode is CUSTOM and is advertised to
all peers of the router. These groups will be advertised in addition to any specified
prefixes. Leave this field blank to advertise no custom groups.
- 'This enum field has the one valid value: ALL_SUBNETS .'
returned: success
type: list
advertisedIpRanges:
description:
- User-specified list of individual IP ranges to advertise in custom mode. This field
can only be populated if advertiseMode is CUSTOM and is advertised to all peers
of the router. These IP ranges will be advertised in addition to any specified groups.
- Leave this field blank to advertise no custom IP ranges.
returned: success
type: complex
contains:
range:
description:
- The IP range to advertise. The value must be a CIDR-formatted string.
returned: success
type: str
description:
description:
- User-specified description for the IP range.
returned: success
type: str
region:
description:
- Region where the router resides.
returned: success
type: str
description:
- User-specified description for the IP range.
returned: success
type: str
region:
description:
- Region where the router resides.
returned: success
type: str
'''
################################################################################
@ -173,7 +174,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,49 +32,51 @@ DOCUMENTATION = '''
---
module: gcp_compute_ssl_certificate
description:
- An SslCertificate resource, used for HTTPS load balancing. This resource provides
a mechanism to upload an SSL key and certificate to the load balancer to serve secure
connections from the user.
- An SslCertificate resource, used for HTTPS load balancing. This resource provides
a mechanism to upload an SSL key and certificate to the load balancer to serve secure
connections from the user.
short_description: Creates a GCP SslCertificate
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'
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
required: true
state:
description:
description:
- An optional description of this resource.
required: false
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: false
private_key:
description:
- The write-only private key in PEM format.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
required: true
description:
description:
- An optional description of this resource.
required: false
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: false
private_key:
description:
- The write-only private key in PEM format.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)"
- "Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)'
- 'Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)'
'''
EXAMPLES = '''
@ -113,43 +115,43 @@ EXAMPLES = '''
'''
RETURN = '''
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
privateKey:
description:
- The write-only private key in PEM format.
returned: success
type: str
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
privateKey:
description:
- The write-only private key in PEM format.
returned: success
type: str
'''
################################################################################
@ -328,8 +330,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_ssl_certificate_facts
description:
- Gather facts for GCP SslCertificate
- Gather facts for GCP SslCertificate
short_description: Gather facts for GCP SslCertificate
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,47 +61,47 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
privateKey:
description:
- The write-only private key in PEM format.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
certificate:
description:
- The certificate in PEM format.
- The certificate chain must be no greater than 5 certs long.
- The chain must include at least one intermediate cert.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
privateKey:
description:
- The write-only private key in PEM format.
returned: success
type: str
'''
################################################################################
@ -123,7 +122,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,58 +32,68 @@ DOCUMENTATION = '''
---
module: gcp_compute_ssl_policy
description:
- Represents a SSL policy. SSL policies give you the ability to control the features
of SSL that your SSL proxy or HTTPS load balancer negotiates.
- Represents a SSL policy. SSL policies give you the ability to control the features
of SSL that your SSL proxy or HTTPS load balancer negotiates.
short_description: Creates a GCP SslPolicy
version_added: 2.7
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`,
or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified
in the `customFeatures` field.
required: false
choices: ['COMPATIBLE', 'MODERN', 'RESTRICTED', 'CUSTOM']
min_tls_version:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`.
required: false
choices: ['TLS_1_0', 'TLS_1_1', 'TLS_1_2']
custom_features:
description:
- A list of features enabled when the selected profile is CUSTOM. The method returns
the set of features that can be specified in this list. This field must be empty
if the profile is not CUSTOM.
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`,
`RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable
must be specified in the `customFeatures` field.
required: false
choices:
- COMPATIBLE
- MODERN
- RESTRICTED
- CUSTOM
min_tls_version:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`,
`TLS_1_2`.
required: false
choices:
- TLS_1_0
- TLS_1_1
- TLS_1_2
custom_features:
description:
- A list of features enabled when the selected profile is CUSTOM. The method returns
the set of features that can be specified in this list. This field must be empty
if the profile is not CUSTOM.
required: false
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslPolicies)"
- "Using SSL Policies: U(https://cloud.google.com/compute/docs/load-balancing/ssl-policies)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslPolicies)'
- 'Using SSL Policies: U(https://cloud.google.com/compute/docs/load-balancing/ssl-policies)'
'''
EXAMPLES = '''
@ -102,80 +112,81 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`,
or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified
in the `customFeatures` field.
returned: success
type: str
minTlsVersion:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`.
returned: success
type: str
enabledFeatures:
description:
- The list of features enabled in the SSL policy.
returned: success
type: list
customFeatures:
description:
- A list of features enabled when the selected profile is CUSTOM. The method returns
the set of features that can be specified in this list. This field must be empty
if the profile is not CUSTOM.
returned: success
type: list
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
returned: success
type: str
warnings:
description:
- If potential misconfigurations are detected for this SSL policy, this field will
be populated with warning messages.
returned: success
type: complex
contains:
code:
description:
- A warning code, if applicable.
returned: success
type: str
message:
description:
- A human-readable description of the warning code.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`,
`RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable
must be specified in the `customFeatures` field.
returned: success
type: str
minTlsVersion:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`,
`TLS_1_2`.
returned: success
type: str
enabledFeatures:
description:
- The list of features enabled in the SSL policy.
returned: success
type: list
customFeatures:
description:
- A list of features enabled when the selected profile is CUSTOM. The method returns
the set of features that can be specified in this list. This field must be empty
if the profile is not CUSTOM.
returned: success
type: list
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
returned: success
type: str
warnings:
description:
- If potential misconfigurations are detected for this SSL policy, this field will
be populated with warning messages.
returned: success
type: complex
contains:
code:
description:
- A warning code, if applicable.
returned: success
type: str
message:
description:
- A human-readable description of the warning code.
returned: success
type: str
'''
################################################################################
@ -361,8 +372,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_ssl_policy_facts
description:
- Gather facts for GCP SslPolicy
- Gather facts for GCP SslPolicy
short_description: Gather facts for GCP SslPolicy
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,84 +61,85 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`,
or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified
in the `customFeatures` field.
returned: success
type: str
minTlsVersion:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`.
returned: success
type: str
enabledFeatures:
description:
- The list of features enabled in the SSL policy.
returned: success
type: list
customFeatures:
description:
- A list of features enabled when the selected profile is CUSTOM. The method returns
the set of features that can be specified in this list. This field must be empty
if the profile is not CUSTOM.
returned: success
type: list
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
returned: success
type: str
warnings:
description:
- If potential misconfigurations are detected for this SSL policy, this field will
be populated with warning messages.
returned: success
type: complex
contains:
code:
description:
- A warning code, if applicable.
returned: success
type: str
message:
description:
- A human-readable description of the warning code.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
profile:
description:
- Profile specifies the set of SSL features that can be used by the load balancer
when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`,
`RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable
must be specified in the `customFeatures` field.
returned: success
type: str
minTlsVersion:
description:
- The minimum version of SSL protocol that can be used by the clients to establish
a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`,
`TLS_1_2`.
returned: success
type: str
enabledFeatures:
description:
- The list of features enabled in the SSL policy.
returned: success
type: list
customFeatures:
description:
- A list of features enabled when the selected profile is CUSTOM. The method
returns the set of features that can be specified in this list. This field
must be empty if the profile is not CUSTOM.
returned: success
type: list
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object.
This field is used in optimistic locking.
returned: success
type: str
warnings:
description:
- If potential misconfigurations are detected for this SSL policy, this field
will be populated with warning messages.
returned: success
type: complex
contains:
code:
description:
- A warning code, if applicable.
returned: success
type: str
message:
description:
- A human-readable description of the warning code.
returned: success
type: str
'''
################################################################################
@ -160,7 +160,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,109 +32,111 @@ DOCUMENTATION = '''
---
module: gcp_compute_subnetwork
description:
- A VPC network is a virtual version of the traditional physical networks that exist
within and between physical data centers. A VPC network provides connectivity for
your Compute Engine virtual machine (VM) instances, Container Engine containers,
App Engine Flex services, and other network-related resources.
- Each GCP project contains one or more VPC networks. Each VPC network is a global
entity spanning all GCP regions. This global VPC network allows VM instances and
other resources to communicate with each other via internal, private IP addresses.
- Each VPC network is subdivided into subnets, and each subnet is contained within
a single region. You can have more than one subnet in a region for a given VPC network.
Each subnet has a contiguous private RFC1918 IP space. You create instances, containers,
and the like in these subnets.
- When you create an instance, you must create it in a subnet, and the instance draws
its internal IP address from that subnet.
- Virtual machine (VM) instances in a VPC network can communicate with instances in
all other subnets of the same VPC network, regardless of region, using their RFC1918
private IP addresses. You can isolate portions of the network, even entire subnets,
using firewall rules.
- A VPC network is a virtual version of the traditional physical networks that exist
within and between physical data centers. A VPC network provides connectivity for
your Compute Engine virtual machine (VM) instances, Container Engine containers,
App Engine Flex services, and other network-related resources.
- Each GCP project contains one or more VPC networks. Each VPC network is a global
entity spanning all GCP regions. This global VPC network allows VM instances and
other resources to communicate with each other via internal, private IP addresses.
- Each VPC network is subdivided into subnets, and each subnet is contained within
a single region. You can have more than one subnet in a region for a given VPC network.
Each subnet has a contiguous private RFC1918 IP space. You create instances, containers,
and the like in these subnets.
- When you create an instance, you must create it in a subnet, and the instance draws
its internal IP address from that subnet.
- Virtual machine (VM) instances in a VPC network can communicate with instances in
all other subnets of the same VPC network, regardless of region, using their RFC1918
private IP addresses. You can isolate portions of the network, even entire subnets,
using firewall rules.
short_description: Creates a GCP Subnetwork
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'
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
required: false
ip_cidr_range:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8
or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network.
Only IPv4 is supported.
required: true
name:
description:
- The name of the resource, provided by the client when initially creating the
resource. 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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: true
enable_flow_logs:
description:
- Whether to enable flow logging for this subnetwork.
required: false
type: bool
version_added: 2.8
secondary_ip_ranges:
description:
- An array of configurations for secondary IP ranges for VM instances contained
in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
required: false
version_added: 2.8
suboptions:
range_name:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
required: false
ip_cidr_range:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or
192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only
IPv4 is supported.
- The name associated with this subnetwork secondary range, used when adding
an alias IP range to a VM instance. The name must be 1-63 characters long,
and comply with RFC1035. The name must be unique within the subnetwork.
required: true
name:
ip_cidr_range:
description:
- The name of the resource, provided by the client when initially creating the resource.
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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: true
enable_flow_logs:
description:
- Whether to enable flow logging for this subnetwork.
required: false
type: bool
version_added: 2.8
secondary_ip_ranges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
required: false
version_added: 2.8
suboptions:
range_name:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
required: true
ip_cidr_range:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
required: true
private_ip_google_access:
description:
- Whether the VMs in this subnet can access Google services without assigned external
IP addresses.
required: false
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
- The range of IP addresses belonging to this subnetwork secondary range.
Provide this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary
IP ranges within a network. Only IPv4 is supported.
required: true
private_ip_google_access:
description:
- Whether the VMs in this subnet can access Google services without assigned external
IP addresses.
required: false
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)"
- "Private Google Access: U(https://cloud.google.com/vpc/docs/configure-private-google-access)"
- "Cloud Networking: U(https://cloud.google.com/vpc/docs/using-vpc)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)'
- 'Private Google Access: U(https://cloud.google.com/vpc/docs/configure-private-google-access)'
- 'Cloud Networking: U(https://cloud.google.com/vpc/docs/using-vpc)'
'''
EXAMPLES = '''
@ -161,97 +163,97 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
returned: success
type: str
gatewayAddress:
description:
- The gateway address for default routes to reach destination addresses outside this
subnetwork.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
returned: success
type: str
gatewayAddress:
description:
- The gateway address for default routes to reach destination addresses outside
this subnetwork.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipCidrRange:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8
or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network.
Only IPv4 is supported.
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the resource.
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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of
this resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained
in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding
an alias IP range to a VM instance. The name must be 1-63 characters long,
and comply with RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or
192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only
IPv4 is supported.
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the resource.
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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned external
IP addresses.
returned: success
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
returned: success
type: str
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP
ranges within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned external
IP addresses.
returned: success
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
returned: success
type: str
'''
################################################################################
@ -361,7 +363,7 @@ def enable_flow_logs_update(module, request, response):
{
u'enableFlowLogs': module.params.get('enable_flow_logs'),
u'fingerprint': response.get('fingerprint'),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()
}
)
@ -392,7 +394,7 @@ def resource_to_request(module):
u'name': module.params.get('name'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'enableFlowLogs': module.params.get('enable_flow_logs'),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
u'privateIpGoogleAccess': module.params.get('private_ip_google_access'),
u'region': module.params.get('region')
}
@ -469,7 +471,7 @@ def response_to_hash(module, response):
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'enableFlowLogs': response.get(u'enableFlowLogs'),
u'fingerprint': response.get(u'fingerprint'),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'),
u'region': module.params.get('region')
}
@ -499,8 +501,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
@ -512,7 +512,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class SubnetworkSecondaryIpRangesArray(object):
class SubnetworkSecondaryiprangesArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_subnetwork_facts
description:
- Gather facts for GCP Subnetwork
- Gather facts for GCP Subnetwork
short_description: Gather facts for GCP Subnetwork
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- URL of the GCP region for this subnetwork.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- URL of the GCP region for this subnetwork.
required: true
extends_documentation_fragment: gcp
'''
@ -67,101 +66,102 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
returned: success
type: str
gatewayAddress:
description:
- The gateway address for default routes to reach destination addresses outside this
subnetwork.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource. This field can be set only at resource creation time.
returned: success
type: str
gatewayAddress:
description:
- The gateway address for default routes to reach destination addresses outside
this subnetwork.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
ipCidrRange:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8
or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network.
Only IPv4 is supported.
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the
resource. 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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates
of this resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained
in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary
ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding
an alias IP range to a VM instance. The name must be 1-63 characters long,
and comply with RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of internal addresses that are owned by this subnetwork.
- Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or
192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only
IPv4 is supported.
returned: success
type: str
name:
description:
- The name of the resource, provided by the client when initially creating the resource.
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
network:
description:
- The network this subnet belongs to.
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned external
IP addresses.
returned: success
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
returned: success
type: str
description:
- The range of IP addresses belonging to this subnetwork secondary range.
Provide this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary
IP ranges within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned
external IP addresses.
returned: success
type: bool
region:
description:
- URL of the GCP region for this subnetwork.
returned: success
type: str
'''
################################################################################
@ -183,7 +183,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,47 +32,50 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_http_proxy
description:
- Represents a TargetHttpProxy resource, which is used by one or more global forwarding
rule to route incoming HTTP requests to a URL map.
- Represents a TargetHttpProxy resource, which is used by one or more global forwarding
rule to route incoming HTTP requests to a URL map.
short_description: Creates a GCP TargetHttpProxy
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
url_map:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
- 'This field represents a link to a UrlMap resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task
and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can
set this url_map to a dictionary with the selfLink key where the value is the selfLink
of your UrlMap.'
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
url_map:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
- 'This field represents a link to a UrlMap resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map
task and then set this url_map field to "{{ name-of-resource }}" Alternatively,
you can set this url_map to a dictionary with the selfLink key where the value
is the selfLink of your UrlMap'
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies)"
- "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)'
'''
EXAMPLES = '''
@ -134,36 +137,36 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
'''
################################################################################
@ -359,8 +362,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_http_proxy_facts
description:
- Gather facts for GCP TargetHttpProxy
- Gather facts for GCP TargetHttpProxy
short_description: Gather facts for GCP TargetHttpProxy
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,40 +61,41 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
returned: success
type: dict
'''
################################################################################
@ -116,7 +116,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,62 +32,69 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_https_proxy
description:
- Represents a TargetHttpsProxy resource, which is used by one or more global forwarding
rule to route incoming HTTPS requests to a URL map.
- Represents a TargetHttpsProxy resource, which is used by one or more global forwarding
rule to route incoming HTTPS requests to a URL map.
short_description: Creates a GCP TargetHttpsProxy
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
quic_override:
description:
- Specifies the QUIC override policy for this resource. This determines whether the
load balancer will attempt to negotiate QUIC with clients or not. Can specify one
of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no
user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent
to specifying NONE.
required: false
version_added: 2.7
choices: ['NONE', 'ENABLE', 'DISABLE']
ssl_certificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
required: true
url_map:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
- 'This field represents a link to a UrlMap resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task
and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can
set this url_map to a dictionary with the selfLink key where the value is the selfLink
of your UrlMap.'
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
quic_override:
description:
- Specifies the QUIC override policy for this resource. This determines whether
the load balancer will attempt to negotiate QUIC with clients or not. Can specify
one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy
with no user overrides, which is equivalent to DISABLE. Not specifying this
field is equivalent to specifying NONE.
required: false
version_added: 2.7
choices:
- NONE
- ENABLE
- DISABLE
ssl_certificates:
description:
- A list of SslCertificate resources that are used to authenticate connections
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
required: true
url_map:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
- 'This field represents a link to a UrlMap resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map
task and then set this url_map field to "{{ name-of-resource }}" Alternatively,
you can set this url_map to a dictionary with the selfLink key where the value
is the selfLink of your UrlMap'
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies)"
- "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)'
'''
EXAMPLES = '''
@ -185,51 +192,51 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
quicOverride:
description:
- Specifies the QUIC override policy for this resource. This determines whether the
load balancer will attempt to negotiate QUIC with clients or not. Can specify one
of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no
user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent
to specifying NONE.
returned: success
type: str
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
quicOverride:
description:
- Specifies the QUIC override policy for this resource. This determines whether
the load balancer will attempt to negotiate QUIC with clients or not. Can specify
one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with
no user overrides, which is equivalent to DISABLE. Not specifying this field is
equivalent to specifying NONE.
returned: success
type: str
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
'''
################################################################################
@ -461,8 +468,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_https_proxy_facts
description:
- Gather facts for GCP TargetHttpsProxy
- Gather facts for GCP TargetHttpsProxy
short_description: Gather facts for GCP TargetHttpsProxy
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,55 +61,57 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
quicOverride:
description:
- Specifies the QUIC override policy for this resource. This determines whether the
load balancer will attempt to negotiate QUIC with clients or not. Can specify one
of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no
user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent
to specifying NONE.
returned: success
type: str
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
quicOverride:
description:
- Specifies the QUIC override policy for this resource. This determines whether
the load balancer will attempt to negotiate QUIC with clients or not. Can
specify one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC
policy with no user overrides, which is equivalent to DISABLE. Not specifying
this field is equivalent to specifying NONE.
returned: success
type: str
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
returned: success
type: list
urlMap:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
returned: success
type: dict
'''
################################################################################
@ -131,7 +132,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,101 +32,106 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_pool
description:
- Represents a TargetPool resource, used for Load Balancing.
- Represents a TargetPool resource, used for Load Balancing.
short_description: Creates a GCP TargetPool
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'
backup_pool:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool, and its failoverRatio field is properly set to a value
between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the primary
target pool: if the ratio of the healthy instances in the primary pool is at or
below failoverRatio, traffic arriving at the load-balanced IP will be directed to
the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances in
the backup pool are unhealthy, the traffic will be directed back to the primary
pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively,
you can set this backup_pool to a dictionary with the selfLink key where the value
is the selfLink of your TargetPool.'
required: false
state:
description:
description:
- An optional description of this resource.
required: false
failover_ratio:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool (i.e., not as a backup pool to some other target pool).
The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP will be
directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup pool are
unhealthy, the traffic will be directed back to the primary pool in the "force"
mode, where traffic will be spread to the healthy instances with the best effort,
or to all instances when no instance is healthy.
required: false
health_check:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health checks
pass. If not specified it means all member instances will be considered healthy
at all times.
- 'This field represents a link to a HttpHealthCheck resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check
task and then set this health_check field to "{{ name-of-resource }}" Alternatively,
you can set this health_check to a dictionary with the selfLink key where the value
is the selfLink of your HttpHealthCheck.'
required: false
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
required: false
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
session_affinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections from
the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
required: false
choices: ['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']
region:
description:
- The region where the target pool resides.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
backup_pool:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool, and its failoverRatio field is properly set to a value
between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the primary
target pool: if the ratio of the healthy instances in the primary pool is at
or below failoverRatio, traffic arriving at the load-balanced IP will be directed
to the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances
in the backup pool are unhealthy, the traffic will be directed back to the primary
pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively,
you can set this backup_pool to a dictionary with the selfLink key where the
value is the selfLink of your TargetPool'
required: false
description:
description:
- An optional description of this resource.
required: false
failover_ratio:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool (i.e., not as a backup pool to some other target pool).
The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP will
be directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup pool
are unhealthy, the traffic will be directed back to the primary pool in the
"force" mode, where traffic will be spread to the healthy instances with the
best effort, or to all instances when no instance is healthy.
required: false
health_check:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health
checks pass. If not specified it means all member instances will be considered
healthy at all times.
- 'This field represents a link to a HttpHealthCheck resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check
task and then set this health_check field to "{{ name-of-resource }}" Alternatively,
you can set this health_check to a dictionary with the selfLink key where the
value is the selfLink of your HttpHealthCheck'
required: false
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
required: false
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
session_affinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections from
the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
required: false
choices:
- NONE
- CLIENT_IP
- CLIENT_IP_PROTO
region:
description:
- The region where the target pool resides.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetPools)"
- "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/target-pools)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetPools)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/target-pools)'
'''
EXAMPLES = '''
@ -141,90 +146,90 @@ EXAMPLES = '''
'''
RETURN = '''
backupPool:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool, and its failoverRatio field is properly set to a value
between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the primary
target pool: if the ratio of the healthy instances in the primary pool is at or
below failoverRatio, traffic arriving at the load-balanced IP will be directed to
the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances in
the backup pool are unhealthy, the traffic will be directed back to the primary
pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
failoverRatio:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool (i.e., not as a backup pool to some other target pool).
The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP will be
directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup pool are
unhealthy, the traffic will be directed back to the primary pool in the "force"
mode, where traffic will be spread to the healthy instances with the best effort,
or to all instances when no instance is healthy.
returned: success
type: str
healthCheck:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health checks
pass. If not specified it means all member instances will be considered healthy
at all times.
returned: success
type: dict
id:
description:
- The unique identifier for the resource.
returned: success
type: int
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
returned: success
type: list
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
sessionAffinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections from
the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
returned: success
type: str
region:
description:
- The region where the target pool resides.
returned: success
type: str
backupPool:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool, and its failoverRatio field is properly set to a value
between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the primary
target pool: if the ratio of the healthy instances in the primary pool is at or
below failoverRatio, traffic arriving at the load-balanced IP will be directed
to the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances in
the backup pool are unhealthy, the traffic will be directed back to the primary
pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
failoverRatio:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool (i.e., not as a backup pool to some other target pool).
The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP will
be directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup pool
are unhealthy, the traffic will be directed back to the primary pool in the "force"
mode, where traffic will be spread to the healthy instances with the best effort,
or to all instances when no instance is healthy.
returned: success
type: str
healthCheck:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health
checks pass. If not specified it means all member instances will be considered
healthy at all times.
returned: success
type: dict
id:
description:
- The unique identifier for the resource.
returned: success
type: int
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
returned: success
type: list
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
sessionAffinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections from
the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
returned: success
type: str
region:
description:
- The region where the target pool resides.
returned: success
type: str
'''
################################################################################
@ -418,8 +423,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

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_pool_facts
description:
- Gather facts for GCP TargetPool
- Gather facts for GCP TargetPool
short_description: Gather facts for GCP TargetPool
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- The region where the target pool resides.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- The region where the target pool resides.
required: true
extends_documentation_fragment: gcp
'''
@ -67,94 +66,94 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
backupPool:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool, and its failoverRatio field is properly set to a value
between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the primary
target pool: if the ratio of the healthy instances in the primary pool is at or
below failoverRatio, traffic arriving at the load-balanced IP will be directed to
the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances in
the backup pool are unhealthy, the traffic will be directed back to the primary
pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
failoverRatio:
description:
- This field is applicable only when the containing target pool is serving a forwarding
rule as the primary pool (i.e., not as a backup pool to some other target pool).
The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP will be
directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup pool are
unhealthy, the traffic will be directed back to the primary pool in the "force"
mode, where traffic will be spread to the healthy instances with the best effort,
or to all instances when no instance is healthy.
returned: success
type: str
healthCheck:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health checks
pass. If not specified it means all member instances will be considered healthy
at all times.
returned: success
type: dict
id:
description:
- The unique identifier for the resource.
returned: success
type: int
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
returned: success
type: list
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
sessionAffinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections from
the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
returned: success
type: str
region:
description:
- The region where the target pool resides.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
backupPool:
description:
- This field is applicable only when the containing target pool is serving a
forwarding rule as the primary pool, and its failoverRatio field is properly
set to a value between [0, 1].
- 'backupPool and failoverRatio together define the fallback behavior of the
primary target pool: if the ratio of the healthy instances in the primary
pool is at or below failoverRatio, traffic arriving at the load-balanced IP
will be directed to the backup pool.'
- In case where failoverRatio and backupPool are not set, or all the instances
in the backup pool are unhealthy, the traffic will be directed back to the
primary pool in the "force" mode, where traffic will be spread to the healthy
instances with the best effort, or to all instances when no instance is healthy.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
failoverRatio:
description:
- This field is applicable only when the containing target pool is serving a
forwarding rule as the primary pool (i.e., not as a backup pool to some other
target pool). The value of the field must be in [0, 1].
- 'If set, backupPool must also be set. They together define the fallback behavior
of the primary target pool: if the ratio of the healthy instances in the primary
pool is at or below this number, traffic arriving at the load-balanced IP
will be directed to the backup pool.'
- In case where failoverRatio is not set or all the instances in the backup
pool are unhealthy, the traffic will be directed back to the primary pool
in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy.
returned: success
type: str
healthCheck:
description:
- A reference to a HttpHealthCheck resource.
- A member instance in this pool is considered healthy if and only if the health
checks pass. If not specified it means all member instances will be considered
healthy at all times.
returned: success
type: dict
id:
description:
- The unique identifier for the resource.
returned: success
type: int
instances:
description:
- A list of virtual machine instances serving this pool.
- They must live in zones contained in the same region as this pool.
returned: success
type: list
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
sessionAffinity:
description:
- 'Session affinity option. Must be one of these values: - NONE: Connections
from the same client IP may go to any instance in the pool.'
- "- CLIENT_IP: Connections from the same client IP will go to the same instance
in the pool while that instance remains healthy."
- "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol
will go to the same instance in the pool while that instance remains healthy."
returned: success
type: str
region:
description:
- The region where the target pool resides.
returned: success
type: str
'''
################################################################################
@ -176,7 +175,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,53 +32,63 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_ssl_proxy
description:
- Represents a TargetSslProxy resource, which is used by one or more global forwarding
rule to route incoming SSL requests to a backend service.
- Represents a TargetSslProxy resource, which is used by one or more global forwarding
rule to route incoming SSL requests to a backend service.
short_description: Creates a GCP TargetSslProxy
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
choices: ['NONE', 'PROXY_V1']
service:
description:
- A reference to the BackendService resource.
required: true
ssl_certificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
choices:
- NONE
- PROXY_V1
service:
description:
- A reference to the BackendService resource.
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value
is the selfLink of your BackendService'
required: true
ssl_certificates:
description:
- A list of SslCertificate resources that are used to authenticate connections
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)"
- "Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)'
- 'Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)'
'''
EXAMPLES = '''
@ -164,54 +174,54 @@ EXAMPLES = '''
- "{{ sslcert }}"
service: "{{ backendservice }}"
project: "test_project"
auth_kind: "service_account"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
creation_timestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
ssl_certificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
'''
################################################################################
@ -253,7 +263,8 @@ def main():
if fetch:
if state == 'present':
if is_different(module, fetch):
fetch = update(module, self_link(module), kind)
update(module, self_link(module), kind, fetch)
fetch = fetch_resource(module, self_link(module), kind)
changed = True
else:
delete(module, self_link(module), kind)
@ -276,9 +287,58 @@ def create(module, link, kind):
return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link, kind):
def update(module, link, kind, fetch):
update_fields(module, resource_to_request(module),
response_to_hash(module, fetch))
return fetch_resource(module, self_link(module), kind)
def update_fields(module, request, response):
if response.get('proxyHeader') != request.get('proxyHeader'):
proxy_header_update(module, request, response)
if response.get('service') != request.get('service'):
service_update(module, request, response)
if response.get('sslCertificates') != request.get('sslCertificates'):
ssl_certificates_update(module, request, response)
def proxy_header_update(module, request, response):
auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.put(link, resource_to_request(module)))
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/targetSslProxies/{name}/setProxyHeader"
]).format(**module.params),
{
u'proxyHeader': module.params.get('proxy_header')
}
)
def service_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/targetSslProxies/{name}/setBackendService"
]).format(**module.params),
{
u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')
}
)
def ssl_certificates_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/targetSslProxies/{name}/setSslCertificates"
]).format(**module.params),
{
u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')
}
)
def delete(module, link, kind):
@ -303,9 +363,9 @@ def resource_to_request(module):
return return_vals
def fetch_resource(module, link, kind):
def fetch_resource(module, link, kind, allow_not_found=True):
auth = GcpSession(module, 'compute')
return return_if_object(module, auth.get(link), kind)
return return_if_object(module, auth.get(link), kind, allow_not_found)
def self_link(module):
@ -316,9 +376,9 @@ def collection(module):
return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params)
def return_if_object(module, response, kind):
def return_if_object(module, response, kind, allow_not_found=False):
# If not found, return nothing.
if response.status_code == 404:
if allow_not_found and response.status_code == 404:
return None
# If no content, return nothing.
@ -333,8 +393,6 @@ def return_if_object(module, response, kind):
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
if result['kind'] != kind:
module.fail_json(msg="Incorrect result: {kind}".format(**result))
return result
@ -395,8 +453,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_ssl_proxy_facts
description:
- Gather facts for GCP TargetSslProxy
- Gather facts for GCP TargetSslProxy
short_description: Gather facts for GCP TargetSslProxy
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,52 +61,53 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
type: list
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
returned: success
type: list
'''
################################################################################
@ -128,7 +128,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,53 +32,57 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_tcp_proxy
description:
- Represents a TargetTcpProxy resource, which is used by one or more global forwarding
rule to route incoming TCP requests to a Backend service.
- Represents a TargetTcpProxy resource, which is used by one or more global forwarding
rule to route incoming TCP requests to a Backend service.
short_description: Creates a GCP TargetTcpProxy
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
choices: ['NONE', 'PROXY_V1']
service:
description:
- A reference to the BackendService resource.
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value is
the selfLink of your BackendService.'
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
proxy_header:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
required: false
choices:
- NONE
- PROXY_V1
service:
description:
- A reference to the BackendService resource.
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value
is the selfLink of your BackendService'
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetTcpProxies)"
- "Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetTcpProxies)'
- 'Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)'
'''
EXAMPLES = '''
@ -135,42 +139,42 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
'''
################################################################################
@ -384,8 +388,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

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_tcp_proxy_facts
description:
- Gather facts for GCP TargetTcpProxy
- Gather facts for GCP TargetTcpProxy
short_description: Gather facts for GCP TargetTcpProxy
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,46 +61,46 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
id:
description:
- The 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
proxyHeader:
description:
- Specifies the type of proxy header to append before sending data to the backend,
either NONE or PROXY_V1. The default is NONE.
returned: success
type: str
service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
'''
################################################################################
@ -122,7 +121,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,50 +32,52 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_vpn_gateway
description:
- Represents a VPN gateway running in GCP. This virtual device is managed by Google,
but used only by you.
- Represents a VPN gateway running in GCP. This virtual device is managed by Google,
but used only by you.
short_description: Creates a GCP TargetVpnGateway
version_added: 2.7
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'
state:
description:
description:
- An optional description of this resource.
required: false
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
network:
description:
- The network this VPN gateway is accepting traffic for.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network task
and then set this network field to "{{ name-of-resource }}" Alternatively, you can
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: true
region:
description:
- The region this gateway should sit in.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource.
required: false
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
network:
description:
- The network this VPN gateway is accepting traffic for.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
required: true
region:
description:
- The region this gateway should sit in.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)'
'''
EXAMPLES = '''
@ -110,51 +112,51 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
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
id:
description:
- The unique identifier for the resource.
returned: success
type: int
network:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
tunnels:
description:
- A list of references to VpnTunnel resources associated to this VPN gateway.
returned: success
type: list
forwardingRules:
description:
- A list of references to the ForwardingRule resources associated to this VPN gateway.
returned: success
type: list
region:
description:
- The region this gateway should sit in.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
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
id:
description:
- The unique identifier for the resource.
returned: success
type: int
network:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
tunnels:
description:
- A list of references to VpnTunnel resources associated to this VPN gateway.
returned: success
type: list
forwardingRules:
description:
- A list of references to the ForwardingRule resources associated to this VPN gateway.
returned: success
type: list
region:
description:
- The region this gateway should sit in.
returned: success
type: str
'''
################################################################################
@ -333,8 +335,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

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_target_vpn_gateway_facts
description:
- Gather facts for GCP TargetVpnGateway
- Gather facts for GCP TargetVpnGateway
short_description: Gather facts for GCP TargetVpnGateway
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- The region this gateway should sit in.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- The region this gateway should sit in.
required: true
extends_documentation_fragment: gcp
'''
@ -67,55 +66,56 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
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
id:
description:
- The unique identifier for the resource.
returned: success
type: int
network:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
tunnels:
description:
- A list of references to VpnTunnel resources associated to this VPN gateway.
returned: success
type: list
forwardingRules:
description:
- A list of references to the ForwardingRule resources associated to this VPN gateway.
returned: success
type: list
region:
description:
- The region this gateway should sit in.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource.
returned: success
type: str
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
id:
description:
- The unique identifier for the resource.
returned: success
type: int
network:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
tunnels:
description:
- A list of references to VpnTunnel resources associated to this VPN gateway.
returned: success
type: list
forwardingRules:
description:
- A list of references to the ForwardingRule resources associated to this VPN
gateway.
returned: success
type: list
region:
description:
- The region this gateway should sit in.
returned: success
type: str
'''
################################################################################
@ -137,7 +137,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,135 +32,141 @@ DOCUMENTATION = '''
---
module: gcp_compute_url_map
description:
- UrlMaps are used to route requests to a backend service based on rules that you
define for the host and path of an incoming URL.
- UrlMaps are used to route requests to a backend service based on rules that you
define for the host and path of an incoming URL.
short_description: Creates a GCP UrlMap
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'
default_service:
description:
- A reference to BackendService resource if none of the hostRules match.
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this default_service field to "{{ name-of-resource }}" Alternatively,
you can set this default_service to a dictionary with the selfLink key where the
value is the selfLink of your BackendService.'
required: true
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
default_service:
description:
- A reference to BackendService resource if none of the hostRules match.
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this default_service field to "{{ name-of-resource }}" Alternatively,
you can set this default_service to a dictionary with the selfLink key where
the value is the selfLink of your BackendService'
required: true
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
host_rules:
description:
- The list of HostRules to use against the URL.
required: false
suboptions:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
- An optional description of this HostRule. Provide this property when you
create the resource.
required: false
host_rules:
hosts:
description:
- The list of HostRules to use against the URL.
required: false
suboptions:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
hosts:
description:
- The list of host patterns to match. They must be valid hostnames, except * will
match any string of ([a-z0-9-.]*). In that case, * must be the first character and
must be followed in the pattern by either - or .
required: true
path_matcher:
description:
- The name of the PathMatcher to use to match the path portion of the URL if the hostRule
matches the URL's host portion.
required: true
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.
- The list of host patterns to match. They must be valid hostnames, except
* will match any string of ([a-z0-9-.]*). In that case, * must be the first
character and must be followed in the pattern by either - or .
required: true
path_matchers:
path_matcher:
description:
- The list of named PathMatchers to use against the URL.
- The name of the PathMatcher to use to match the path portion of the URL
if the hostRule matches the URL's host portion.
required: true
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
path_matchers:
description:
- The list of named PathMatchers to use against the URL.
required: false
suboptions:
default_service:
description:
- A reference to a BackendService resource. This will be used if none of the
pathRules defined by this PathMatcher is matched by the URL's path portion.
- 'This field represents a link to a BackendService resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a
gcp_compute_backend_service task and then set this default_service field
to "{{ name-of-resource }}" Alternatively, you can set this default_service
to a dictionary with the selfLink key where the value is the selfLink of
your BackendService'
required: true
description:
description:
- An optional description of this resource.
required: false
name:
description:
- The name to which this PathMatcher is referred by the HostRule.
required: true
path_rules:
description:
- The list of path rules.
required: false
suboptions:
default_service:
description:
- A reference to a BackendService resource. This will be used if none of the pathRules
defined by this PathMatcher is matched by the URL's path portion.
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this default_service field to "{{ name-of-resource }}" Alternatively,
you can set this default_service to a dictionary with the selfLink key where the
value is the selfLink of your BackendService.'
required: true
paths:
description:
description:
- An optional description of this resource.
required: false
name:
description:
- The name to which this PathMatcher is referred by the HostRule.
required: true
path_rules:
description:
- The list of path rules.
required: false
suboptions:
paths:
description:
- 'The list of path patterns to match. Each must start with / and the only place a
* is allowed is at the end following a /. The string fed to the path matcher does
not include any text after the first ? or #, and those chars are not allowed here.'
required: false
service:
description:
- A reference to the BackendService resource if this rule is matched.
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value is
the selfLink of your BackendService.'
required: true
tests:
- 'The list of path patterns to match. Each must start with / and the
only place a * is allowed is at the end following a /. The string fed
to the path matcher does not include any text after the first ? or #,
and those chars are not allowed here.'
required: true
service:
description:
- A reference to the BackendService resource if this rule is matched.
- 'This field represents a link to a BackendService resource in GCP. It
can be specified in two ways. You can add `register: name-of-resource`
to a gcp_compute_backend_service task and then set this service field
to "{{ name-of-resource }}" Alternatively, you can set this service
to a dictionary with the selfLink key where the value is the selfLink
of your BackendService'
required: true
tests:
description:
- The list of expected URL mappings. Requests to update this UrlMap will succeed
only if all of the test cases pass.
required: false
suboptions:
description:
description:
- The list of expected URL mappings. Request to update this UrlMap will succeed only
if all of the test cases pass.
- Description of this test case.
required: false
suboptions:
description:
description:
- Description of this test case.
required: false
host:
description:
- Host portion of the URL.
required: true
path:
description:
- Path portion of the URL.
required: true
service:
description:
- A reference to expected BackendService resource the given URL should be mapped to.
- 'This field represents a link to a BackendService resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value is
the selfLink of your BackendService.'
required: true
host:
description:
- Host portion of the URL.
required: true
path:
description:
- Path portion of the URL.
required: true
service:
description:
- A reference to expected BackendService resource the given URL should be
mapped to.
- 'This field represents a link to a BackendService resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a
gcp_compute_backend_service task and then set this service field to "{{
name-of-resource }}" Alternatively, you can set this service to a dictionary
with the selfLink key where the value is the selfLink of your BackendService'
required: true
extends_documentation_fragment: gcp
'''
@ -213,135 +219,137 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
defaultService:
description:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
defaultService:
description:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hostRules:
description:
- The list of HostRules to use against the URL.
returned: success
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hostRules:
description:
- The list of HostRules to use against the URL.
returned: success
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hosts:
description:
- The list of host patterns to match. They must be valid hostnames, except * will
match any string of ([a-z0-9-.]*). In that case, * must be the first character and
must be followed in the pattern by either - or .
returned: success
type: list
pathMatcher:
description:
- The name of the PathMatcher to use to match the path portion of the URL if the hostRule
matches the URL's host portion.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
description:
- An optional description of this HostRule. Provide this property when you create
the resource.
returned: success
type: str
hosts:
description:
- The list of host patterns to match. They must be valid hostnames, except *
will match any string of ([a-z0-9-.]*). In that case, * must be the first
character and must be followed in the pattern by either - or .
returned: success
type: list
pathMatcher:
description:
- The name of the PathMatcher to use to match the path portion of the URL if
the hostRule matches the URL's host portion.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of
this resource.
returned: success
type: str
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
pathMatchers:
description:
- The list of named PathMatchers to use against the URL.
returned: success
type: complex
contains:
defaultService:
description:
- A reference to a BackendService resource. This will be used if none of the
pathRules defined by this PathMatcher is matched by the URL's path portion.
returned: success
type: dict
description:
description:
- An optional description of this resource.
returned: success
type: str
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
pathMatchers:
description:
- The list of named PathMatchers to use against the URL.
returned: success
type: complex
contains:
defaultService:
description:
- A reference to a BackendService resource. This will be used if none of the pathRules
defined by this PathMatcher is matched by the URL's path portion.
returned: success
type: dict
description:
description:
- An optional description of this resource.
returned: success
type: str
name:
description:
- The name to which this PathMatcher is referred by the HostRule.
returned: success
type: str
pathRules:
description:
- The list of path rules.
returned: success
type: complex
contains:
paths:
description:
- 'The list of path patterns to match. Each must start with / and the only place a
* is allowed is at the end following a /. The string fed to the path matcher does
not include any text after the first ? or #, and those chars are not allowed here.'
returned: success
type: list
service:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
tests:
description:
- The list of expected URL mappings. Request to update this UrlMap will succeed only
if all of the test cases pass.
returned: success
type: complex
contains:
description:
description:
- Description of this test case.
returned: success
type: str
host:
description:
- Host portion of the URL.
returned: success
type: str
path:
description:
- Path portion of the URL.
returned: success
type: str
service:
description:
- A reference to expected BackendService resource the given URL should be mapped to.
returned: success
type: dict
description:
- The name to which this PathMatcher is referred by the HostRule.
returned: success
type: str
pathRules:
description:
- The list of path rules.
returned: success
type: complex
contains:
paths:
description:
- 'The list of path patterns to match. Each must start with / and the only
place a * is allowed is at the end following a /. The string fed to the
path matcher does not include any text after the first ? or #, and those
chars are not allowed here.'
returned: success
type: list
service:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
tests:
description:
- The list of expected URL mappings. Requests to update this UrlMap will succeed
only if all of the test cases pass.
returned: success
type: complex
contains:
description:
description:
- Description of this test case.
returned: success
type: str
host:
description:
- Host portion of the URL.
returned: success
type: str
path:
description:
- Path portion of the URL.
returned: success
type: str
service:
description:
- A reference to expected BackendService resource the given URL should be mapped
to.
returned: success
type: dict
'''
################################################################################
@ -376,7 +384,7 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
path_rules=dict(type='list', elements='dict', options=dict(
paths=dict(type='list', elements='str'),
paths=dict(required=True, type='list', elements='str'),
service=dict(required=True, type='dict')
))
)),
@ -440,9 +448,9 @@ def resource_to_request(module):
u'kind': 'compute#urlMap',
u'defaultService': replace_resource_dict(module.params.get(u'default_service', {}), 'selfLink'),
u'description': module.params.get('description'),
u'hostRules': UrlMapHostRulesArray(module.params.get('host_rules', []), module).to_request(),
u'hostRules': UrlMapHostrulesArray(module.params.get('host_rules', []), module).to_request(),
u'name': module.params.get('name'),
u'pathMatchers': UrlMapPathMatchersArray(module.params.get('path_matchers', []), module).to_request(),
u'pathMatchers': UrlMapPathmatchersArray(module.params.get('path_matchers', []), module).to_request(),
u'tests': UrlMapTestsArray(module.params.get('tests', []), module).to_request()
}
return_vals = {}
@ -512,11 +520,11 @@ def response_to_hash(module, response):
u'creationTimestamp': response.get(u'creationTimestamp'),
u'defaultService': response.get(u'defaultService'),
u'description': response.get(u'description'),
u'hostRules': UrlMapHostRulesArray(response.get(u'hostRules', []), module).from_response(),
u'hostRules': UrlMapHostrulesArray(response.get(u'hostRules', []), module).from_response(),
u'id': response.get(u'id'),
u'fingerprint': response.get(u'fingerprint'),
u'name': module.params.get('name'),
u'pathMatchers': UrlMapPathMatchersArray(response.get(u'pathMatchers', []), module).from_response(),
u'pathMatchers': UrlMapPathmatchersArray(response.get(u'pathMatchers', []), module).from_response(),
u'tests': UrlMapTestsArray(response.get(u'tests', []), module).from_response()
}
@ -545,8 +553,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
@ -558,7 +564,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class UrlMapHostRulesArray(object):
class UrlMapHostrulesArray(object):
def __init__(self, request, module):
self.module = module
if request:
@ -593,7 +599,7 @@ class UrlMapHostRulesArray(object):
})
class UrlMapPathMatchersArray(object):
class UrlMapPathmatchersArray(object):
def __init__(self, request, module):
self.module = module
if request:
@ -618,7 +624,7 @@ class UrlMapPathMatchersArray(object):
u'defaultService': replace_resource_dict(item.get(u'default_service', {}), 'selfLink'),
u'description': item.get('description'),
u'name': item.get('name'),
u'pathRules': UrlMapPathRulesArray(item.get('path_rules', []), self.module).to_request()
u'pathRules': UrlMapPathrulesArray(item.get('path_rules', []), self.module).to_request()
})
def _response_from_item(self, item):
@ -626,11 +632,11 @@ class UrlMapPathMatchersArray(object):
u'defaultService': item.get(u'defaultService'),
u'description': item.get(u'description'),
u'name': item.get(u'name'),
u'pathRules': UrlMapPathRulesArray(item.get(u'pathRules', []), self.module).from_response()
u'pathRules': UrlMapPathrulesArray(item.get(u'pathRules', []), self.module).from_response()
})
class UrlMapPathRulesArray(object):
class UrlMapPathrulesArray(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,21 +32,20 @@ DOCUMENTATION = '''
---
module: gcp_compute_url_map_facts
description:
- Gather facts for GCP UrlMap
- Gather facts for GCP UrlMap
short_description: Gather facts for GCP UrlMap
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
extends_documentation_fragment: gcp
'''
@ -62,139 +61,142 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
defaultService:
description:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
defaultService:
description:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hostRules:
description:
- The list of HostRules to use against the URL.
returned: success
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hostRules:
description:
- The list of HostRules to use against the URL.
returned: success
type: complex
contains:
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
hosts:
description:
- The list of host patterns to match. They must be valid hostnames, except * will
match any string of ([a-z0-9-.]*). In that case, * must be the first character and
must be followed in the pattern by either - or .
returned: success
type: list
pathMatcher:
description:
- The name of the PathMatcher to use to match the path portion of the URL if the hostRule
matches the URL's host portion.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
description:
- An optional description of this HostRule. Provide this property when you
create the resource.
returned: success
type: str
hosts:
description:
- The list of host patterns to match. They must be valid hostnames, except
* will match any string of ([a-z0-9-.]*). In that case, * must be the
first character and must be followed in the pattern by either - or .
returned: success
type: list
pathMatcher:
description:
- The name of the PathMatcher to use to match the path portion of the URL
if the hostRule matches the URL's host portion.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates
of this resource.
returned: success
type: str
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
pathMatchers:
description:
- The list of named PathMatchers to use against the URL.
returned: success
type: complex
contains:
defaultService:
description:
- A reference to a BackendService resource. This will be used if none of
the pathRules defined by this PathMatcher is matched by the URL's path
portion.
returned: success
type: dict
description:
description:
- An optional description of this resource.
returned: success
type: str
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
pathMatchers:
description:
- The list of named PathMatchers to use against the URL.
returned: success
type: complex
contains:
defaultService:
description:
- A reference to a BackendService resource. This will be used if none of the pathRules
defined by this PathMatcher is matched by the URL's path portion.
returned: success
type: dict
description:
description:
- An optional description of this resource.
returned: success
type: str
name:
description:
- The name to which this PathMatcher is referred by the HostRule.
returned: success
type: str
pathRules:
description:
- The list of path rules.
returned: success
type: complex
contains:
paths:
description:
- 'The list of path patterns to match. Each must start with / and the only place a
* is allowed is at the end following a /. The string fed to the path matcher does
not include any text after the first ? or #, and those chars are not allowed here.'
returned: success
type: list
service:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
tests:
description:
- The list of expected URL mappings. Request to update this UrlMap will succeed only
if all of the test cases pass.
returned: success
type: complex
contains:
description:
description:
- Description of this test case.
returned: success
type: str
host:
description:
- Host portion of the URL.
returned: success
type: str
path:
description:
- Path portion of the URL.
returned: success
type: str
service:
description:
- A reference to expected BackendService resource the given URL should be mapped to.
returned: success
type: dict
description:
- The name to which this PathMatcher is referred by the HostRule.
returned: success
type: str
pathRules:
description:
- The list of path rules.
returned: success
type: complex
contains:
paths:
description:
- 'The list of path patterns to match. Each must start with / and the
only place a * is allowed is at the end following a /. The string
fed to the path matcher does not include any text after the first
? or #, and those chars are not allowed here.'
returned: success
type: list
service:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
tests:
description:
- The list of expected URL mappings. Requests to update this UrlMap will succeed
only if all of the test cases pass.
returned: success
type: complex
contains:
description:
description:
- Description of this test case.
returned: success
type: str
host:
description:
- Host portion of the URL.
returned: success
type: str
path:
description:
- Path portion of the URL.
returned: success
type: str
service:
description:
- A reference to expected BackendService resource the given URL should be
mapped to.
returned: success
type: dict
'''
################################################################################
@ -215,7 +217,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

View file

@ -32,92 +32,94 @@ DOCUMENTATION = '''
---
module: gcp_compute_vpn_tunnel
description:
- VPN tunnel resource.
- VPN tunnel resource.
short_description: Creates a GCP VpnTunnel
version_added: 2.7
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'
name:
description:
- Name of the resource. 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
state:
description:
description:
- An optional description of this resource.
required: false
target_vpn_gateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
- 'This field represents a link to a TargetVpnGateway resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway
task and then set this target_vpn_gateway field to "{{ name-of-resource }}" Alternatively,
you can set this target_vpn_gateway to a dictionary with the selfLink key where
the value is the selfLink of your TargetVpnGateway.'
required: true
router:
description:
- URL of router resource to be used for dynamic routing.
- 'This field represents a link to a Router resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_compute_router task
and then set this router field to "{{ name-of-resource }}" Alternatively, you can
set this router to a dictionary with the selfLink key where the value is the selfLink
of your Router.'
required: false
peer_ip:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
required: true
shared_secret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway and the
peer VPN gateway.
required: true
ike_version:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
required: false
default: 2
local_traffic_selector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
required: false
remote_traffic_selector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
required: false
labels:
description:
- Labels to apply to this VpnTunnel.
required: false
region:
description:
- The region where the tunnel is located.
required: true
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
required: false
target_vpn_gateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
- 'This field represents a link to a TargetVpnGateway resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway
task and then set this target_vpn_gateway field to "{{ name-of-resource }}"
Alternatively, you can set this target_vpn_gateway to a dictionary with the
selfLink key where the value is the selfLink of your TargetVpnGateway'
required: true
router:
description:
- URL of router resource to be used for dynamic routing.
- 'This field represents a link to a Router resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_router
task and then set this router field to "{{ name-of-resource }}" Alternatively,
you can set this router to a dictionary with the selfLink key where the value
is the selfLink of your Router'
required: false
peer_ip:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
required: true
shared_secret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway and
the peer VPN gateway.
required: true
ike_version:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
required: false
default: '2'
local_traffic_selector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN
gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`.
The ranges should be disjoint.
- Only IPv4 is supported.
required: false
remote_traffic_selector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer VPN
gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`.
The ranges should be disjoint.
- Only IPv4 is supported.
required: false
labels:
description:
- Labels to apply to this VpnTunnel.
required: false
region:
description:
- The region where the tunnel is located.
required: true
extends_documentation_fragment: gcp
notes:
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)"
- "Cloud VPN Overview: U(https://cloud.google.com/vpn/docs/concepts/overview)"
- "Networks and Tunnel Routing: U(https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)"
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)'
- 'Cloud VPN Overview: U(https://cloud.google.com/vpn/docs/concepts/overview)'
- 'Networks and Tunnel Routing: U(https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)'
'''
EXAMPLES = '''
@ -174,89 +176,89 @@ EXAMPLES = '''
'''
RETURN = '''
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
targetVpnGateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success
type: dict
router:
description:
- URL of router resource to be used for dynamic routing.
returned: success
type: dict
peerIp:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
returned: success
type: str
sharedSecret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway and the
peer VPN gateway.
returned: success
type: str
sharedSecretHash:
description:
- Hash of the shared secret.
returned: success
type: str
ikeVersion:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
returned: success
type: int
localTrafficSelector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
remoteTrafficSelector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
labels:
description:
- Labels to apply to this VpnTunnel.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
region:
description:
- The region where the tunnel is located.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
targetVpnGateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success
type: dict
router:
description:
- URL of router resource to be used for dynamic routing.
returned: success
type: dict
peerIp:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
returned: success
type: str
sharedSecret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway and
the peer VPN gateway.
returned: success
type: str
sharedSecretHash:
description:
- Hash of the shared secret.
returned: success
type: str
ikeVersion:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
returned: success
type: int
localTrafficSelector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The
ranges should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
remoteTrafficSelector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer VPN
gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`.
The ranges should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
labels:
description:
- Labels to apply to this VpnTunnel.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
region:
description:
- The region where the tunnel is located.
returned: success
type: str
'''
################################################################################
@ -477,8 +479,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

View file

@ -32,25 +32,24 @@ DOCUMENTATION = '''
---
module: gcp_compute_vpn_tunnel_facts
description:
- Gather facts for GCP VpnTunnel
- Gather facts for GCP VpnTunnel
short_description: Gather facts for GCP VpnTunnel
version_added: 2.7
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:
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- The region where the tunnel is located.
required: true
filters:
description:
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- The region where the tunnel is located.
required: true
extends_documentation_fragment: gcp
'''
@ -67,93 +66,94 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
targetVpnGateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success
type: dict
router:
description:
- URL of router resource to be used for dynamic routing.
returned: success
type: dict
peerIp:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
returned: success
type: str
sharedSecret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway and the
peer VPN gateway.
returned: success
type: str
sharedSecretHash:
description:
- Hash of the shared secret.
returned: success
type: str
ikeVersion:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
returned: success
type: int
localTrafficSelector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
remoteTrafficSelector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway.
The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges
should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
labels:
description:
- Labels to apply to this VpnTunnel.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
region:
description:
- The region where the tunnel is located.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
name:
description:
- Name of the resource. 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
description:
description:
- An optional description of this resource.
returned: success
type: str
targetVpnGateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success
type: dict
router:
description:
- URL of router resource to be used for dynamic routing.
returned: success
type: dict
peerIp:
description:
- IP address of the peer VPN gateway. Only IPv4 is supported.
returned: success
type: str
sharedSecret:
description:
- Shared secret used to set the secure session between the Cloud VPN gateway
and the peer VPN gateway.
returned: success
type: str
sharedSecretHash:
description:
- Hash of the shared secret.
returned: success
type: str
ikeVersion:
description:
- IKE protocol version to use when establishing the VPN tunnel with peer VPN
gateway.
- Acceptable IKE versions are 1 or 2. Default version is 2.
returned: success
type: int
localTrafficSelector:
description:
- Local traffic selector to use when establishing the VPN tunnel with peer VPN
gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`.
The ranges should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
remoteTrafficSelector:
description:
- Remote traffic selector to use when establishing the VPN tunnel with peer
VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`.
The ranges should be disjoint.
- Only IPv4 is supported.
returned: success
type: list
labels:
description:
- Labels to apply to this VpnTunnel.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
region:
description:
- The region where the tunnel is located.
returned: success
type: str
'''
################################################################################
@ -175,7 +175,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))

File diff suppressed because it is too large Load diff

View file

@ -32,182 +32,187 @@ DOCUMENTATION = '''
---
module: gcp_container_node_pool
description:
- NodePool contains the name and configuration for a cluster's node pool.
- Node pools are a set of nodes (i.e. VM's), with a common configuration and specification,
under the control of the cluster master. They may have a set of Kubernetes labels
applied to them, which may be used to reference them during pod scheduling. They
may also be resized up or down, to accommodate the workload.
- NodePool contains the name and configuration for a cluster's node pool.
- Node pools are a set of nodes (i.e. VM's), with a common configuration and specification,
under the control of the cluster master. They may have a set of Kubernetes labels
applied to them, which may be used to reference them during pod scheduling. They
may also be resized up or down, to accommodate the workload.
short_description: Creates a GCP NodePool
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:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- The name of the node pool.
required: false
config:
description:
- The node configuration of the pool.
required: false
suboptions:
machine_type:
description:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
name:
description:
- The name of the node pool.
- The name of a Google Compute Engine machine type (e.g.
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
required: false
config:
disk_size_gb:
description:
- The node configuration of the pool.
- Size of the disk attached to each node, specified in GB. The smallest allowed
disk size is 10GB. If unspecified, the default disk size is 100GB.
required: false
oauth_scopes:
description:
- The set of Google API scopes to be made available on all of the node VMs
under the "default" service account.
- 'The following scopes are recommended, but not required, and by default
are not included: U(https://www.googleapis.com/auth/compute) is required
for mounting persistent storage on your nodes.'
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for
communicating with gcr.io (the Google Container Registry).
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring
are enabled, in which case their required scopes will be added.
required: false
service_account:
description:
- The Google Cloud Platform Service Account to be used by the node VMs. If
no Service Account is specified, the "default" service account is used.
required: false
metadata:
description:
- The metadata key/value pairs assigned to instances in the cluster.
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes
in length. These are reflected as part of a URL in the metadata server.
Additionally, to avoid ambiguity, keys must not conflict with any other
metadata keys for the project or be one of the four reserved keys: "instance-template",
"kube-env", "startup-script", and "user-data" Values are free-form strings,
and only have meaning as interpreted by the image running in the instance.
The only restriction placed on them is that each value''s size must be less
than or equal to 32 KB.'
- The total size of all keys and values must be less than 512 KB.
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
image_type:
description:
- The image type to use for this node. Note that for a given image type, the
latest version of it will be used.
required: false
labels:
description:
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
These will added in addition to any default label(s) that Kubernetes may
apply to the node. In case of conflict in label keys, the applied set may
differ depending on the Kubernetes version -- it''s best to assume the behavior
is undefined and conflicts should be avoided. For more information, including
usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html)
An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
local_ssd_count:
description:
- The number of local SSD disks to be attached to the node.
- 'The limit for this value is dependant upon the maximum number of disks
available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits)
for more information.'
required: false
tags:
description:
- The list of instance tags applied to all nodes. Tags are used to identify
valid sources or targets for network firewalls and are specified by the
client during cluster or node pool creation. Each tag within the list must
comply with RFC1035.
required: false
preemptible:
description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.'
required: false
type: bool
initial_node_count:
description:
- The initial node count for the pool. You must ensure that your Compute Engine
resource quota is sufficient for this number of instances. You must also have
available firewall and routes quota.
required: true
autoscaling:
description:
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a
valid configuration is present.
required: false
suboptions:
enabled:
description:
- Is autoscaling enabled for this node pool.
required: false
type: bool
min_node_count:
description:
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
required: false
max_node_count:
description:
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
- There has to enough quota to scale up the cluster.
required: false
management:
description:
- Management configuration for this NodePool.
required: false
suboptions:
auto_upgrade:
description:
- A flag that specifies whether node auto-upgrade is enabled for the node
pool. If enabled, node auto-upgrade helps keep the nodes in your node pool
up to date with the latest release version of Kubernetes.
required: false
type: bool
auto_repair:
description:
- A flag that specifies whether the node auto-repair is enabled for the node
pool. If enabled, the nodes in this node pool will be monitored and, if
they fail health checks too many times, an automatic repair action will
be triggered.
required: false
type: bool
upgrade_options:
description:
- Specifies the Auto Upgrade knobs for the node pool.
required: false
suboptions:
machine_type:
description:
- The name of a Google Compute Engine machine type (e.g.
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
required: false
disk_size_gb:
description:
- Size of the disk attached to each node, specified in GB. The smallest allowed disk
size is 10GB. If unspecified, the default disk size is 100GB.
required: false
oauth_scopes:
description:
- The set of Google API scopes to be made available on all of the node VMs under the
"default" service account.
- 'The following scopes are recommended, but not required, and by default are not
included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent
storage on your nodes.'
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating
with gcr.io (the Google Container Registry).
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are
enabled, in which case their required scopes will be added.
required: false
service_account:
description:
- The Google Cloud Platform Service Account to be used by the node VMs. If no Service
Account is specified, the "default" service account is used.
required: false
metadata:
description:
- The metadata key/value pairs assigned to instances in the cluster.
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length.
These are reflected as part of a URL in the metadata server. Additionally, to avoid
ambiguity, keys must not conflict with any other metadata keys for the project or
be one of the four reserved keys: "instance-template", "kube-env", "startup-script",
and "user-data" Values are free-form strings, and only have meaning as interpreted
by the image running in the instance. The only restriction placed on them is that
each value''s size must be less than or equal to 32 KB.'
- The total size of all keys and values must be less than 512 KB.
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
image_type:
description:
- The image type to use for this node. Note that for a given image type, the latest
version of it will be used.
required: false
labels:
description:
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
These will added in addition to any default label(s) that Kubernetes may apply to
the node. In case of conflict in label keys, the applied set may differ depending
on the Kubernetes version -- it''s best to assume the behavior is undefined and
conflicts should be avoided. For more information, including usage and the valid
values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object
containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
local_ssd_count:
description:
- The number of local SSD disks to be attached to the node.
- 'The limit for this value is dependant upon the maximum number of disks available
on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for
more information.'
required: false
tags:
description:
- The list of instance tags applied to all nodes. Tags are used to identify valid
sources or targets for network firewalls and are specified by the client during
cluster or node pool creation. Each tag within the list must comply with RFC1035.
required: false
preemptible:
description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.'
required: false
type: bool
initial_node_count:
description:
- The initial node count for the pool. You must ensure that your Compute Engine resource
quota is sufficient for this number of instances. You must also have available firewall
and routes quota.
required: true
autoscaling:
description:
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid
configuration is present.
required: false
suboptions:
enabled:
description:
- Is autoscaling enabled for this node pool.
required: false
type: bool
min_node_count:
description:
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
required: false
max_node_count:
description:
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
- There has to enough quota to scale up the cluster.
required: false
management:
description:
- Management configuration for this NodePool.
required: false
suboptions:
auto_upgrade:
description:
- A flag that specifies whether node auto-upgrade is enabled for the node pool. If
enabled, node auto-upgrade helps keep the nodes in your node pool up to date with
the latest release version of Kubernetes.
required: false
type: bool
auto_repair:
description:
- A flag that specifies whether the node auto-repair is enabled for the node pool.
If enabled, the nodes in this node pool will be monitored and, if they fail health
checks too many times, an automatic repair action will be triggered.
required: false
type: bool
upgrade_options:
description:
- Specifies the Auto Upgrade knobs for the node pool.
required: false
suboptions:
auto_upgrade_start_time:
description:
- This field is set when upgrades are about to commence with the approximate start
time for the upgrades, in RFC3339 text format.
required: false
description:
description:
- This field is set when upgrades are about to commence with the description of the
upgrade.
required: false
cluster:
description:
- The cluster this node pool belongs to.
- 'This field represents a link to a Cluster resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_container_cluster
task and then set this cluster field to "{{ name-of-resource }}" Alternatively,
you can set this cluster to a dictionary with the name key where the value is the
name of your Cluster.'
required: true
zone:
description:
- The zone where the node pool is deployed.
required: true
auto_upgrade_start_time:
description:
- This field is set when upgrades are about to commence with the approximate
start time for the upgrades, in RFC3339 text format.
required: false
description:
description:
- This field is set when upgrades are about to commence with the description
of the upgrade.
required: false
cluster:
description:
- The cluster this node pool belongs to.
- 'This field represents a link to a Cluster resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_container_cluster
task and then set this cluster field to "{{ name-of-resource }}" Alternatively,
you can set this cluster to a dictionary with the name key where the value is
the name of your Cluster'
required: true
zone:
description:
- The zone where the node pool is deployed.
required: true
extends_documentation_fragment: gcp
'''
@ -225,7 +230,7 @@ EXAMPLES = '''
- name: create a node pool
gcp_container_node_pool:
name: "test_object"
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
zone: us-central1-a
@ -236,185 +241,187 @@ EXAMPLES = '''
'''
RETURN = '''
name:
name:
description:
- The name of the node pool.
returned: success
type: str
config:
description:
- The node configuration of the pool.
returned: success
type: complex
contains:
machineType:
description:
- The name of a Google Compute Engine machine type (e.g.
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
returned: success
type: str
diskSizeGb:
description:
- Size of the disk attached to each node, specified in GB. The smallest allowed
disk size is 10GB. If unspecified, the default disk size is 100GB.
returned: success
type: int
oauthScopes:
description:
- The set of Google API scopes to be made available on all of the node VMs under
the "default" service account.
- 'The following scopes are recommended, but not required, and by default are
not included: U(https://www.googleapis.com/auth/compute) is required for mounting
persistent storage on your nodes.'
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating
with gcr.io (the Google Container Registry).
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring
are enabled, in which case their required scopes will be added.
returned: success
type: list
serviceAccount:
description:
- The Google Cloud Platform Service Account to be used by the node VMs. If no
Service Account is specified, the "default" service account is used.
returned: success
type: str
metadata:
description:
- The metadata key/value pairs assigned to instances in the cluster.
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes
in length. These are reflected as part of a URL in the metadata server. Additionally,
to avoid ambiguity, keys must not conflict with any other metadata keys for
the project or be one of the four reserved keys: "instance-template", "kube-env",
"startup-script", and "user-data" Values are free-form strings, and only have
meaning as interpreted by the image running in the instance. The only restriction
placed on them is that each value''s size must be less than or equal to 32
KB.'
- The total size of all keys and values must be less than 512 KB.
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
imageType:
description:
- The image type to use for this node. Note that for a given image type, the
latest version of it will be used.
returned: success
type: str
labels:
description:
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
These will added in addition to any default label(s) that Kubernetes may apply
to the node. In case of conflict in label keys, the applied set may differ
depending on the Kubernetes version -- it''s best to assume the behavior is
undefined and conflicts should be avoided. For more information, including
usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html)
An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
localSsdCount:
description:
- The number of local SSD disks to be attached to the node.
- 'The limit for this value is dependant upon the maximum number of disks available
on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits)
for more information.'
returned: success
type: int
tags:
description:
- The list of instance tags applied to all nodes. Tags are used to identify
valid sources or targets for network firewalls and are specified by the client
during cluster or node pool creation. Each tag within the list must comply
with RFC1035.
returned: success
type: list
preemptible:
description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.'
returned: success
type: bool
initialNodeCount:
description:
- The initial node count for the pool. You must ensure that your Compute Engine
resource quota is sufficient for this number of instances. You must also have
available firewall and routes quota.
returned: success
type: int
version:
description:
- The version of the Kubernetes of this node.
returned: success
type: str
autoscaling:
description:
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid
configuration is present.
returned: success
type: complex
contains:
enabled:
description:
- Is autoscaling enabled for this node pool.
returned: success
type: bool
minNodeCount:
description:
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
returned: success
type: int
maxNodeCount:
description:
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
- There has to enough quota to scale up the cluster.
returned: success
type: int
management:
description:
- Management configuration for this NodePool.
returned: success
type: complex
contains:
autoUpgrade:
description:
- A flag that specifies whether node auto-upgrade is enabled for the node pool.
If enabled, node auto-upgrade helps keep the nodes in your node pool up to
date with the latest release version of Kubernetes.
returned: success
type: bool
autoRepair:
description:
- A flag that specifies whether the node auto-repair is enabled for the node
pool. If enabled, the nodes in this node pool will be monitored and, if they
fail health checks too many times, an automatic repair action will be triggered.
returned: success
type: bool
upgradeOptions:
description:
- Specifies the Auto Upgrade knobs for the node pool.
returned: success
type: complex
contains:
autoUpgradeStartTime:
description:
- This field is set when upgrades are about to commence with the approximate
start time for the upgrades, in RFC3339 text format.
returned: success
type: str
description:
- The name of the node pool.
returned: success
type: str
config:
description:
- The node configuration of the pool.
returned: success
type: complex
contains:
machineType:
description:
- The name of a Google Compute Engine machine type (e.g.
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
returned: success
type: str
diskSizeGb:
description:
- Size of the disk attached to each node, specified in GB. The smallest allowed disk
size is 10GB. If unspecified, the default disk size is 100GB.
returned: success
type: int
oauthScopes:
description:
- The set of Google API scopes to be made available on all of the node VMs under the
"default" service account.
- 'The following scopes are recommended, but not required, and by default are not
included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent
storage on your nodes.'
- U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating
with gcr.io (the Google Container Registry).
- If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are
enabled, in which case their required scopes will be added.
returned: success
type: list
serviceAccount:
description:
- The Google Cloud Platform Service Account to be used by the node VMs. If no Service
Account is specified, the "default" service account is used.
returned: success
type: str
metadata:
description:
- The metadata key/value pairs assigned to instances in the cluster.
- 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length.
These are reflected as part of a URL in the metadata server. Additionally, to avoid
ambiguity, keys must not conflict with any other metadata keys for the project or
be one of the four reserved keys: "instance-template", "kube-env", "startup-script",
and "user-data" Values are free-form strings, and only have meaning as interpreted
by the image running in the instance. The only restriction placed on them is that
each value''s size must be less than or equal to 32 KB.'
- The total size of all keys and values must be less than 512 KB.
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
imageType:
description:
- The image type to use for this node. Note that for a given image type, the latest
version of it will be used.
returned: success
type: str
labels:
description:
- 'The map of Kubernetes labels (key/value pairs) to be applied to each node.
These will added in addition to any default label(s) that Kubernetes may apply to
the node. In case of conflict in label keys, the applied set may differ depending
on the Kubernetes version -- it''s best to assume the behavior is undefined and
conflicts should be avoided. For more information, including usage and the valid
values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object
containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
localSsdCount:
description:
- The number of local SSD disks to be attached to the node.
- 'The limit for this value is dependant upon the maximum number of disks available
on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for
more information.'
returned: success
type: int
tags:
description:
- The list of instance tags applied to all nodes. Tags are used to identify valid
sources or targets for network firewalls and are specified by the client during
cluster or node pool creation. Each tag within the list must comply with RFC1035.
returned: success
type: list
preemptible:
description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.'
returned: success
type: bool
initialNodeCount:
description:
- The initial node count for the pool. You must ensure that your Compute Engine resource
quota is sufficient for this number of instances. You must also have available firewall
and routes quota.
returned: success
type: int
version:
description:
- The version of the Kubernetes of this node.
returned: success
type: str
autoscaling:
description:
- Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid
configuration is present.
returned: success
type: complex
contains:
enabled:
description:
- Is autoscaling enabled for this node pool.
returned: success
type: bool
minNodeCount:
description:
- Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount.
returned: success
type: int
maxNodeCount:
description:
- Maximum number of nodes in the NodePool. Must be >= minNodeCount.
- There has to enough quota to scale up the cluster.
returned: success
type: int
management:
description:
- Management configuration for this NodePool.
returned: success
type: complex
contains:
autoUpgrade:
description:
- A flag that specifies whether node auto-upgrade is enabled for the node pool. If
enabled, node auto-upgrade helps keep the nodes in your node pool up to date with
the latest release version of Kubernetes.
returned: success
type: bool
autoRepair:
description:
- A flag that specifies whether the node auto-repair is enabled for the node pool.
If enabled, the nodes in this node pool will be monitored and, if they fail health
checks too many times, an automatic repair action will be triggered.
returned: success
type: bool
upgradeOptions:
description:
- Specifies the Auto Upgrade knobs for the node pool.
returned: success
type: complex
contains:
autoUpgradeStartTime:
description:
- This field is set when upgrades are about to commence with the approximate start
time for the upgrades, in RFC3339 text format.
returned: success
type: str
description:
description:
- This field is set when upgrades are about to commence with the description of the
upgrade.
returned: success
type: str
cluster:
description:
- The cluster this node pool belongs to.
returned: success
type: dict
zone:
description:
- The zone where the node pool is deployed.
returned: success
type: str
description:
- This field is set when upgrades are about to commence with the description
of the upgrade.
returned: success
type: str
cluster:
description:
- The cluster this node pool belongs to.
returned: success
type: dict
zone:
description:
- The zone where the node pool is deployed.
returned: success
type: str
'''
################################################################################
@ -630,8 +637,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', 'ABORTING']:
module.fail_json(msg="Invalid result %s" % status)
op_result = fetch_resource(module, op_uri)
status = navigate_hash(op_result, ['status'])
return op_result
@ -731,18 +736,18 @@ class NodePoolManagement(object):
return remove_nones_from_dict({
u'autoUpgrade': self.request.get('auto_upgrade'),
u'autoRepair': self.request.get('auto_repair'),
u'upgradeOptions': NodePoolUpgradeOptions(self.request.get('upgrade_options', {}), self.module).to_request()
u'upgradeOptions': NodePoolUpgradeoptions(self.request.get('upgrade_options', {}), self.module).to_request()
})
def from_response(self):
return remove_nones_from_dict({
u'autoUpgrade': self.request.get(u'autoUpgrade'),
u'autoRepair': self.request.get(u'autoRepair'),
u'upgradeOptions': NodePoolUpgradeOptions(self.request.get(u'upgradeOptions', {}), self.module).from_response()
u'upgradeOptions': NodePoolUpgradeoptions(self.request.get(u'upgradeOptions', {}), self.module).from_response()
})
class NodePoolUpgradeOptions(object):
class NodePoolUpgradeoptions(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,41 +32,43 @@ DOCUMENTATION = '''
---
module: gcp_dns_managed_zone
description:
- A zone is a subtree of the DNS namespace under one administrative responsibility.
A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.
- A zone is a subtree of the DNS namespace under one administrative responsibility.
A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.
short_description: Creates a GCP ManagedZone
version_added: 2.5
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'
state:
description:
description:
- A mutable string of at most 1024 characters associated with this resource for the
user's convenience. Has no effect on the managed zone's function.
required: false
dns_name:
description:
- The DNS name of this managed zone, for instance "example.com.".
required: false
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
required: true
name_server_set:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
a set of DNS name servers that all host the same ManagedZones. Most users will leave
this field unset.
required: false
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- A mutable string of at most 1024 characters associated with this resource for
the user's convenience. Has no effect on the managed zone's function.
required: false
dns_name:
description:
- The DNS name of this managed zone, for instance "example.com.".
required: false
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
required: true
name_server_set:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet
is a set of DNS name servers that all host the same ManagedZones. Most users
will leave this field unset.
required: false
extends_documentation_fragment: gcp
'''
@ -83,47 +85,47 @@ EXAMPLES = '''
'''
RETURN = '''
description:
description:
- A mutable string of at most 1024 characters associated with this resource for the
user's convenience. Has no effect on the managed zone's function.
returned: success
type: str
dnsName:
description:
- The DNS name of this managed zone, for instance "example.com.".
returned: success
type: str
id:
description:
- Unique identifier for the resource; defined by the server.
returned: success
type: int
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
returned: success
type: str
nameServers:
description:
- Delegate your managed_zone to these virtual name servers; defined by the server
.
returned: success
type: list
nameServerSet:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
a set of DNS name servers that all host the same ManagedZones. Most users will leave
this field unset.
returned: success
type: list
creationTime:
description:
- The time that this resource was created on the server.
- This is in RFC3339 text format.
returned: success
type: str
description:
description:
- A mutable string of at most 1024 characters associated with this resource for
the user's convenience. Has no effect on the managed zone's function.
returned: success
type: str
dnsName:
description:
- The DNS name of this managed zone, for instance "example.com.".
returned: success
type: str
id:
description:
- Unique identifier for the resource; defined by the server.
returned: success
type: int
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
returned: success
type: str
nameServers:
description:
- Delegate your managed_zone to these virtual name servers; defined by the server
.
returned: success
type: list
nameServerSet:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
a set of DNS name servers that all host the same ManagedZones. Most users will
leave this field unset.
returned: success
type: list
creationTime:
description:
- The time that this resource was created on the server.
- This is in RFC3339 text format.
returned: success
type: str
'''
################################################################################

View file

@ -32,18 +32,18 @@ DOCUMENTATION = '''
---
module: gcp_dns_managed_zone_facts
description:
- Gather facts for GCP ManagedZone
- Gather facts for GCP ManagedZone
short_description: Gather facts for GCP ManagedZone
version_added: 2.8
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:
dns_name:
description:
Restricts the list to return only zones with this domain name.
dns_name:
description:
- Restricts the list to return only zones with this domain name.
extends_documentation_fragment: gcp
'''
@ -58,51 +58,51 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
description:
description:
- A mutable string of at most 1024 characters associated with this resource for the
user's convenience. Has no effect on the managed zone's function.
returned: success
type: str
dnsName:
description:
- The DNS name of this managed zone, for instance "example.com.".
returned: success
type: str
id:
description:
- Unique identifier for the resource; defined by the server.
returned: success
type: int
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
returned: success
type: str
nameServers:
description:
- Delegate your managed_zone to these virtual name servers; defined by the server
.
returned: success
type: list
nameServerSet:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
a set of DNS name servers that all host the same ManagedZones. Most users will leave
this field unset.
returned: success
type: list
creationTime:
description:
- The time that this resource was created on the server.
- This is in RFC3339 text format.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
description:
description:
- A mutable string of at most 1024 characters associated with this resource
for the user's convenience. Has no effect on the managed zone's function.
returned: success
type: str
dnsName:
description:
- The DNS name of this managed zone, for instance "example.com.".
returned: success
type: str
id:
description:
- Unique identifier for the resource; defined by the server.
returned: success
type: int
name:
description:
- User assigned name for this resource.
- Must be unique within the project.
returned: success
type: str
nameServers:
description:
- Delegate your managed_zone to these virtual name servers; defined by the server
.
returned: success
type: list
nameServerSet:
description:
- Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet
is a set of DNS name servers that all host the same ManagedZones. Most users
will leave this field unset.
returned: success
type: list
creationTime:
description:
- The time that this resource was created on the server.
- This is in RFC3339 text format.
returned: success
type: str
'''
################################################################################
@ -123,7 +123,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']
items = fetch_list(module, collection(module), module.params['dns_name'])

View file

@ -32,51 +32,65 @@ DOCUMENTATION = '''
---
module: gcp_dns_resource_record_set
description:
- A single DNS record that exists on a domain name (i.e. in a managed zone).
- This record defines the information about the domain and where the domain / subdomains
direct to.
- The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX,
CNAME, NS, etc) .
- A single DNS record that exists on a domain name (i.e. in a managed zone).
- This record defines the information about the domain and where the domain / subdomains
direct to.
- The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX,
CNAME, NS, etc) .
short_description: Creates a GCP ResourceRecordSet
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'
name:
description:
- For example, U(www.example.com.)
required: true
type:
description:
- One of valid DNS resource types.
required: true
choices: ['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
required: false
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
required: false
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone.'
required: true
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- For example, U(www.example.com.)
required: true
type:
description:
- One of valid DNS resource types.
required: true
choices:
- A
- AAAA
- CAA
- CNAME
- MX
- NAPTR
- NS
- PTR
- SOA
- SPF
- SRV
- TXT
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
required: false
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
required: false
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone'
required: true
extends_documentation_fragment: gcp
'''
@ -108,32 +122,32 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- For example, U(www.example.com.)
returned: success
type: str
type:
description:
- One of valid DNS resource types.
returned: success
type: str
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
returned: success
type: int
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
returned: success
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
returned: success
type: dict
name:
description:
- For example, U(www.example.com.)
returned: success
type: str
type:
description:
- One of valid DNS resource types.
returned: success
type: str
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
returned: success
type: int
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
returned: success
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
returned: success
type: dict
'''
################################################################################

View file

@ -32,25 +32,25 @@ DOCUMENTATION = '''
---
module: gcp_dns_resource_record_set_facts
description:
- Gather facts for GCP ResourceRecordSet
- Gather facts for GCP ResourceRecordSet
short_description: Gather facts for GCP ResourceRecordSet
version_added: 2.8
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:
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone.'
required: true
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone'
required: true
extends_documentation_fragment: gcp
'''
@ -65,36 +65,36 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
name:
description:
- For example, U(www.example.com.)
returned: success
type: str
type:
description:
- One of valid DNS resource types.
returned: success
type: str
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
returned: success
type: int
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
returned: success
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
returned: success
type: dict
description: List of items
returned: always
type: complex
contains:
name:
description:
- For example, U(www.example.com.)
returned: success
type: str
type:
description:
- One of valid DNS resource types.
returned: success
type: str
ttl:
description:
- Number of seconds that this ResourceRecordSet can be cached by resolvers.
returned: success
type: int
target:
description:
- As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) .
returned: success
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
returned: success
type: dict
'''
################################################################################
@ -115,7 +115,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']
items = fetch_list(module, collection(module))

View file

@ -32,63 +32,65 @@ DOCUMENTATION = '''
---
module: gcp_pubsub_subscription
description:
- A named resource representing the stream of messages from a single, specific topic,
to be delivered to the subscribing application.
- A named resource representing the stream of messages from a single, specific topic,
to be delivered to the subscribing application.
short_description: Creates a GCP Subscription
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:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- Name of the subscription.
required: false
topic:
description:
- A reference to a Topic resource.
- 'This field represents a link to a Topic resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic
task and then set this topic field to "{{ name-of-resource }}" Alternatively,
you can set this topic to a dictionary with the name key where the value is
the name of your Topic'
required: false
push_config:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
required: false
suboptions:
push_endpoint:
description:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
name:
description:
- Name of the subscription.
required: false
topic:
description:
- A reference to a Topic resource.
- 'This field represents a link to a Topic resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic task and
then set this topic field to "{{ name-of-resource }}" Alternatively, you can set
this topic to a dictionary with the name key where the value is the name of your
Topic.'
required: false
push_config:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
required: false
suboptions:
push_endpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
required: false
ack_deadline_seconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the call
to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
required: false
ack_deadline_seconds:
description:
- This value is the maximum time after a subscriber receives a message before
the subscriber should acknowledge the message. After message delivery but before
the ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack
deadline. To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you
can specify is 10 seconds. The maximum custom deadline you can specify is 600
seconds (10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the
call to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
required: false
extends_documentation_fragment: gcp
'''
@ -116,48 +118,48 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the call
to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
returned: success
type: int
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the
call to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
returned: success
type: int
'''
################################################################################
@ -235,7 +237,7 @@ def resource_to_request(module):
request = {
u'name': module.params.get('name'),
u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'),
u'pushConfig': SubscriptionPushConfig(module.params.get('push_config', {}), module).to_request(),
u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(),
u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds')
}
request = encode_request(request, module)
@ -308,7 +310,7 @@ def response_to_hash(module, response):
return {
u'name': response.get(u'name'),
u'topic': response.get(u'topic'),
u'pushConfig': SubscriptionPushConfig(response.get(u'pushConfig', {}), module).from_response(),
u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(),
u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds')
}
@ -332,7 +334,7 @@ def encode_request(request, module):
return request
class SubscriptionPushConfig(object):
class SubscriptionPushconfig(object):
def __init__(self, request, module):
self.module = module
if request:

View file

@ -32,14 +32,15 @@ DOCUMENTATION = '''
---
module: gcp_pubsub_subscription_facts
description:
- Gather facts for GCP Subscription
- Gather facts for GCP Subscription
short_description: Gather facts for GCP Subscription
version_added: 2.8
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: {}
extends_documentation_fragment: gcp
'''
@ -53,52 +54,53 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the call
to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
returned: success
type: int
description: List of items
returned: always
type: complex
contains:
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before
the subscriber should acknowledge the message. After message delivery but
before the ack deadline expires and before the message is acknowledged, it
is an outstanding message and will not be delivered again during that time
(on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack
deadline. To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you
can specify is 10 seconds. The maximum custom deadline you can specify is
600 seconds (10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for
the call to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will
eventually redeliver the message.
returned: success
type: int
'''
################################################################################
@ -118,7 +120,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']
items = fetch_list(module, collection(module))

View file

@ -32,24 +32,26 @@ DOCUMENTATION = '''
---
module: gcp_pubsub_topic
description:
- A named resource to which messages are sent by publishers.
- A named resource to which messages are sent by publishers.
short_description: Creates a GCP Topic
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'
name:
description:
- Name of the topic.
required: false
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- Name of the topic.
required: false
extends_documentation_fragment: gcp
'''
@ -64,11 +66,11 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- Name of the topic.
returned: success
type: str
name:
description:
- Name of the topic.
returned: success
type: str
'''
################################################################################

View file

@ -32,14 +32,15 @@ DOCUMENTATION = '''
---
module: gcp_pubsub_topic_facts
description:
- Gather facts for GCP Topic
- Gather facts for GCP Topic
short_description: Gather facts for GCP Topic
version_added: 2.8
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: {}
extends_documentation_fragment: gcp
'''
@ -53,15 +54,15 @@ EXAMPLES = '''
RETURN = '''
items:
description: List of items
returned: always
type: complex
contains:
name:
description:
- Name of the topic.
returned: success
type: str
description: List of items
returned: always
type: complex
contains:
name:
description:
- Name of the topic.
returned: success
type: str
'''
################################################################################
@ -81,7 +82,7 @@ def main():
)
)
if 'scopes' not in module.params:
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']
items = fetch_list(module, collection(module))

View file

@ -32,41 +32,44 @@ DOCUMENTATION = '''
---
module: gcp_spanner_database
description:
- A Cloud Spanner Database which is hosted on a Spanner instance.
- A Cloud Spanner Database which is hosted on a Spanner instance.
short_description: Creates a GCP Database
version_added: 2.7
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'
name:
description:
- A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
required: false
extra_statements:
description:
- 'An optional list of DDL statements to run inside the newly created database. Statements
can create tables, indexes, etc. These statements execute atomically with the creation
of the database: if there is an error in any statement, the database is not created.'
required: false
instance:
description:
- The instance to create the database on.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance
task and then set this instance field to "{{ name-of-resource }}" Alternatively,
you can set this instance to a dictionary with the name key where the value is the
name of your Instance.'
required: true
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
required: false
extra_statements:
description:
- 'An optional list of DDL statements to run inside the newly created database.
Statements can create tables, indexes, etc. These statements execute atomically
with the creation of the database: if there is an error in any statement, the
database is not created.'
required: false
instance:
description:
- The instance to create the database on.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance
task and then set this instance field to "{{ name-of-resource }}" Alternatively,
you can set this instance to a dictionary with the name key where the value
is the name of your Instance'
required: true
extends_documentation_fragment: gcp
'''
@ -96,25 +99,26 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success
type: str
extraStatements:
description:
- 'An optional list of DDL statements to run inside the newly created database. Statements
can create tables, indexes, etc. These statements execute atomically with the creation
of the database: if there is an error in any statement, the database is not created.'
returned: success
type: list
instance:
description:
- The instance to create the database on.
returned: success
type: dict
name:
description:
- A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success
type: str
extraStatements:
description:
- 'An optional list of DDL statements to run inside the newly created database.
Statements can create tables, indexes, etc. These statements execute atomically
with the creation of the database: if there is an error in any statement, the
database is not created.'
returned: success
type: list
instance:
description:
- The instance to create the database on.
returned: success
type: dict
'''
################################################################################

View file

@ -32,60 +32,62 @@ DOCUMENTATION = '''
---
module: gcp_spanner_instance
description:
- An isolated set of Cloud Spanner resources on which databases can be hosted.
- An isolated set of Cloud Spanner resources on which databases can be hosted.
short_description: Creates a GCP Instance
version_added: 2.7
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'
name:
description:
- A unique identifier for the instance, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
required: false
config:
description:
- A reference to the instance configuration.
required: false
display_name:
description:
- The descriptive name for this instance as it appears in UIs. Must be unique per
project and between 4 and 30 characters in length.
required: true
node_count:
description:
- The number of nodes allocated to this instance.
required: false
labels:
description:
- Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources
into groups that reflect a customer's organizational needs and deployment strategies.
Cloud Labels can be used to filter collections of resources. They can be used to
control how resource metrics are aggregated. And they can be used as arguments to
policy management rules (e.g. route, firewall, load balancing, etc.).
- 'Label keys must be between 1 and 63 characters long and must conform to the following
regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.'
- Label values must be between 0 and 63 characters long and must conform to the regular
expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
- No more than 64 labels can be associated with a given resource.
- See U(https://goo.gl/xmQnxf) for more information on and examples of labels.
- 'If you plan to use labels in your own code, please note that additional characters
may be allowed in the future. And so you are advised to use an internal label representation,
such as JSON, which doesn''t rely upon specific characters being disallowed. For
example, representing labels as the string: name + "_" + value would prove problematic
if we were to allow "_" in a future release.'
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- A unique identifier for the instance, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
required: false
config:
description:
- A reference to the instance configuration.
required: false
display_name:
description:
- The descriptive name for this instance as it appears in UIs. Must be unique
per project and between 4 and 30 characters in length.
required: true
node_count:
description:
- The number of nodes allocated to this instance.
required: false
labels:
description:
- Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources
into groups that reflect a customer's organizational needs and deployment strategies.
Cloud Labels can be used to filter collections of resources. They can be used
to control how resource metrics are aggregated. And they can be used as arguments
to policy management rules (e.g. route, firewall, load balancing, etc.).
- 'Label keys must be between 1 and 63 characters long and must conform to the
following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.'
- Label values must be between 0 and 63 characters long and must conform to the
regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
- No more than 64 labels can be associated with a given resource.
- See U(https://goo.gl/xmQnxf) for more information on and examples of labels.
- 'If you plan to use labels in your own code, please note that additional characters
may be allowed in the future. And so you are advised to use an internal label
representation, such as JSON, which doesn''t rely upon specific characters being
disallowed. For example, representing labels as the string: name + "_" + value
would prove problematic if we were to allow "_" in a future release.'
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false
extends_documentation_fragment: gcp
'''
@ -105,51 +107,51 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- A unique identifier for the instance, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success
type: str
config:
description:
- A reference to the instance configuration.
returned: success
type: str
displayName:
description:
- The descriptive name for this instance as it appears in UIs. Must be unique per
project and between 4 and 30 characters in length.
returned: success
type: str
nodeCount:
description:
- The number of nodes allocated to this instance.
returned: success
type: int
labels:
description:
- Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources
into groups that reflect a customer's organizational needs and deployment strategies.
Cloud Labels can be used to filter collections of resources. They can be used to
control how resource metrics are aggregated. And they can be used as arguments to
policy management rules (e.g. route, firewall, load balancing, etc.).
- 'Label keys must be between 1 and 63 characters long and must conform to the following
regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.'
- Label values must be between 0 and 63 characters long and must conform to the regular
expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
- No more than 64 labels can be associated with a given resource.
- See U(https://goo.gl/xmQnxf) for more information on and examples of labels.
- 'If you plan to use labels in your own code, please note that additional characters
may be allowed in the future. And so you are advised to use an internal label representation,
such as JSON, which doesn''t rely upon specific characters being disallowed. For
example, representing labels as the string: name + "_" + value would prove problematic
if we were to allow "_" in a future release.'
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
name:
description:
- A unique identifier for the instance, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success
type: str
config:
description:
- A reference to the instance configuration.
returned: success
type: str
displayName:
description:
- The descriptive name for this instance as it appears in UIs. Must be unique per
project and between 4 and 30 characters in length.
returned: success
type: str
nodeCount:
description:
- The number of nodes allocated to this instance.
returned: success
type: int
labels:
description:
- Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources
into groups that reflect a customer's organizational needs and deployment strategies.
Cloud Labels can be used to filter collections of resources. They can be used
to control how resource metrics are aggregated. And they can be used as arguments
to policy management rules (e.g. route, firewall, load balancing, etc.).
- 'Label keys must be between 1 and 63 characters long and must conform to the following
regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.'
- Label values must be between 0 and 63 characters long and must conform to the
regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
- No more than 64 labels can be associated with a given resource.
- See U(https://goo.gl/xmQnxf) for more information on and examples of labels.
- 'If you plan to use labels in your own code, please note that additional characters
may be allowed in the future. And so you are advised to use an internal label
representation, such as JSON, which doesn''t rely upon specific characters being
disallowed. For example, representing labels as the string: name + "_" + value
would prove problematic if we were to allow "_" in a future release.'
- 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
'''
################################################################################

View file

@ -32,42 +32,44 @@ DOCUMENTATION = '''
---
module: gcp_sql_database
description:
- Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud.
- Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud.
short_description: Creates a GCP Database
version_added: 2.7
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'
charset:
description:
- The MySQL charset value.
required: false
collation:
description:
- The MySQL collation value.
required: false
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
required: false
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task
and then set this instance field to "{{ name-of-resource }}" Alternatively, you
can set this instance to a dictionary with the name key where the value is the name
of your Instance.'
required: true
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
charset:
description:
- The MySQL charset value.
required: false
collation:
description:
- The MySQL collation value.
required: false
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
required: false
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}" Alternatively,
you can set this instance to a dictionary with the name key where the value
is the name of your Instance'
required: true
extends_documentation_fragment: gcp
'''
@ -100,27 +102,27 @@ EXAMPLES = '''
'''
RETURN = '''
charset:
description:
- The MySQL charset value.
returned: success
type: str
collation:
description:
- The MySQL collation value.
returned: success
type: str
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
returned: success
type: str
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: dict
charset:
description:
- The MySQL charset value.
returned: success
type: str
collation:
description:
- The MySQL collation value.
returned: success
type: str
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
returned: success
type: str
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: dict
'''
################################################################################
@ -234,7 +236,7 @@ def collection(module):
def return_if_object(module, response, kind, allow_not_found=False):
# If not found, return nothing.
if response.status_code == 404:
if allow_not_found and response.status_code == 404:
return None
# If no content, return nothing.
@ -242,7 +244,7 @@ def return_if_object(module, response, kind, allow_not_found=False):
return None
# SQL only: return on 403 if not exist
if response.status_code == 403:
if allow_not_found and response.status_code == 403:
return None
try:
@ -252,8 +254,6 @@ def return_if_object(module, response, kind, allow_not_found=False):
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
if result['kind'] != kind:
module.fail_json(msg="Incorrect result: {kind}".format(**result))
return result
@ -310,8 +310,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, 'sql#operation')
status = navigate_hash(op_result, ['status'])
return op_result

File diff suppressed because it is too large Load diff

View file

@ -32,43 +32,45 @@ DOCUMENTATION = '''
---
module: gcp_sql_user
description:
- The Users resource represents a database user in a Cloud SQL instance.
- The Users resource represents a database user in a Cloud SQL instance.
short_description: Creates a GCP User
version_added: 2.7
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'
host:
description:
- The host name from which the user can connect. For insert operations, host defaults
to an empty string. For update operations, host is specified as part of the request
URL. The host name cannot be updated after insertion.
required: true
name:
description:
- The name of the user in the Cloud SQL instance.
required: true
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task
and then set this instance field to "{{ name-of-resource }}" Alternatively, you
can set this instance to a dictionary with the name key where the value is the name
of your Instance.'
required: true
password:
description:
- The password for the user.
required: false
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
host:
description:
- The host name from which the user can connect. For insert operations, host defaults
to an empty string. For update operations, host is specified as part of the
request URL. The host name cannot be updated after insertion.
required: true
name:
description:
- The name of the user in the Cloud SQL instance.
required: true
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}" Alternatively,
you can set this instance to a dictionary with the name key where the value
is the name of your Instance'
required: true
password:
description:
- The password for the user.
required: false
extends_documentation_fragment: gcp
'''
@ -102,28 +104,28 @@ EXAMPLES = '''
'''
RETURN = '''
host:
description:
- The host name from which the user can connect. For insert operations, host defaults
to an empty string. For update operations, host is specified as part of the request
URL. The host name cannot be updated after insertion.
returned: success
type: str
name:
description:
- The name of the user in the Cloud SQL instance.
returned: success
type: str
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: dict
password:
description:
- The password for the user.
returned: success
type: str
host:
description:
- The host name from which the user can connect. For insert operations, host defaults
to an empty string. For update operations, host is specified as part of the request
URL. The host name cannot be updated after insertion.
returned: success
type: str
name:
description:
- The name of the user in the Cloud SQL instance.
returned: success
type: str
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: dict
password:
description:
- The password for the user.
returned: success
type: str
'''
################################################################################
@ -278,7 +280,7 @@ def collection(module):
def return_if_object(module, response, kind, allow_not_found=False):
# If not found, return nothing.
if response.status_code == 404:
if allow_not_found and response.status_code == 404:
return None
# If no content, return nothing.
@ -286,7 +288,7 @@ def return_if_object(module, response, kind, allow_not_found=False):
return None
# SQL only: return on 403 if not exist
if response.status_code == 403:
if allow_not_found and response.status_code == 403:
return None
try:
@ -296,8 +298,6 @@ def return_if_object(module, response, kind, allow_not_found=False):
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
if result['kind'] != kind:
module.fail_json(msg="Incorrect result: {kind}".format(**result))
return result
@ -353,8 +353,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, 'sql#operation')
status = navigate_hash(op_result, ['status'])
return op_result

File diff suppressed because it is too large Load diff

View file

@ -32,71 +32,78 @@ DOCUMENTATION = '''
---
module: gcp_storage_bucket_access_control
description:
- The BucketAccessControls resource represents the Access Control Lists (ACLs) for
buckets within Google Cloud Storage. ACLs let you specify who has access to your
data and to what extent.
- 'There are three roles that can be assigned to an entity: READERs can get the bucket,
though no acl property will be returned, and list the bucket''s objects. WRITERs
are READERs, and they can insert objects into the bucket and delete the bucket''s
objects. OWNERs are WRITERs, and they can get the acl property of a bucket, update
a bucket, and call all BucketAccessControls methods on the bucket. For more information,
see Access Control, with the caveat that this API uses READER, WRITER, and OWNER
instead of READ, WRITE, and FULL_CONTROL.'
- The BucketAccessControls resource represents the Access Control Lists (ACLs) for
buckets within Google Cloud Storage. ACLs let you specify who has access to your
data and to what extent.
- 'There are three roles that can be assigned to an entity: READERs can get the bucket,
though no acl property will be returned, and list the bucket''s objects. WRITERs
are READERs, and they can insert objects into the bucket and delete the bucket''s
objects. OWNERs are WRITERs, and they can get the acl property of a bucket, update
a bucket, and call all BucketAccessControls methods on the bucket. For more information,
see Access Control, with the caveat that this API uses READER, WRITER, and OWNER
instead of READ, WRITE, and FULL_CONTROL.'
short_description: Creates a GCP BucketAccessControl
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:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
bucket:
description:
- The name of the bucket.
- 'This field represents a link to a Bucket resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}" Alternatively,
you can set this bucket to a dictionary with the name key where the value is
the name of your Bucket'
required: true
entity:
description:
- 'The entity holding the permission, in one of the following forms: user-userId
user-email group-groupId group-email domain-domain project-team-projectId allUsers
allAuthenticatedUsers Examples: The user liz@example.com would be user-liz@example.com.'
- The group example@googlegroups.com would be group-example@googlegroups.com.
- To refer to all members of the Google Apps for Business domain example.com,
the entity would be domain-example.com.
required: true
entity_id:
description:
- The ID for the entity.
required: false
project_team:
description:
- The project team associated with the entity.
required: false
suboptions:
project_number:
description:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
bucket:
description:
- The name of the bucket.
- 'This field represents a link to a Bucket resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task
and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can
set this bucket to a dictionary with the name key where the value is the name of
your Bucket.'
required: true
entity:
description:
- 'The entity holding the permission, in one of the following forms: user-userId
user-email group-groupId group-email domain-domain project-team-projectId allUsers
allAuthenticatedUsers Examples: The user liz@example.com would be
user-liz@example.com.'
- The group example@googlegroups.com would be group-example@googlegroups.com.
- To refer to all members of the Google Apps for Business domain example.com, the
entity would be domain-example.com.
required: true
entity_id:
description:
- The ID for the entity.
- The project team associated with the entity.
required: false
project_team:
team:
description:
- The project team associated with the entity.
- The team.
required: false
suboptions:
project_number:
description:
- The project team associated with the entity.
required: false
team:
description:
- The team.
required: false
choices: ['editors', 'owners', 'viewers']
role:
description:
- The access permission for the entity.
required: false
choices: ['OWNER', 'READER', 'WRITER']
choices:
- editors
- owners
- viewers
role:
description:
- The access permission for the entity.
required: false
choices:
- OWNER
- READER
- WRITER
extends_documentation_fragment: gcp
'''
@ -122,63 +129,62 @@ EXAMPLES = '''
'''
RETURN = '''
bucket:
description:
- The name of the bucket.
returned: success
type: dict
domain:
description:
- The domain associated with the entity.
returned: success
type: str
email:
description:
- The email address associated with the entity.
returned: success
type: str
entity:
description:
- 'The entity holding the permission, in one of the following forms: user-userId
user-email group-groupId group-email domain-domain project-team-projectId allUsers
allAuthenticatedUsers Examples: The user liz@example.com would be
user-liz@example.com.'
- The group example@googlegroups.com would be group-example@googlegroups.com.
- To refer to all members of the Google Apps for Business domain example.com, the
entity would be domain-example.com.
returned: success
type: str
entityId:
description:
- The ID for the entity.
returned: success
type: str
id:
description:
- The ID of the access-control entry.
returned: success
type: str
projectTeam:
description:
- The project team associated with the entity.
returned: success
type: complex
contains:
projectNumber:
description:
- The project team associated with the entity.
returned: success
type: str
team:
description:
- The team.
returned: success
type: str
role:
description:
- The access permission for the entity.
returned: success
type: str
bucket:
description:
- The name of the bucket.
returned: success
type: dict
domain:
description:
- The domain associated with the entity.
returned: success
type: str
email:
description:
- The email address associated with the entity.
returned: success
type: str
entity:
description:
- 'The entity holding the permission, in one of the following forms: user-userId
user-email group-groupId group-email domain-domain project-team-projectId allUsers
allAuthenticatedUsers Examples: The user liz@example.com would be user-liz@example.com.'
- The group example@googlegroups.com would be group-example@googlegroups.com.
- To refer to all members of the Google Apps for Business domain example.com, the
entity would be domain-example.com.
returned: success
type: str
entityId:
description:
- The ID for the entity.
returned: success
type: str
id:
description:
- The ID of the access-control entry.
returned: success
type: str
projectTeam:
description:
- The project team associated with the entity.
returned: success
type: complex
contains:
projectNumber:
description:
- The project team associated with the entity.
returned: success
type: str
team:
description:
- The team.
returned: success
type: str
role:
description:
- The access permission for the entity.
returned: success
type: str
'''
################################################################################
@ -262,7 +268,7 @@ def resource_to_request(module):
u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'),
u'entity': module.params.get('entity'),
u'entityId': module.params.get('entity_id'),
u'projectTeam': BucketAccessControlProjectTeam(module.params.get('project_team', {}), module).to_request(),
u'projectTeam': BucketAccessControlProjectteam(module.params.get('project_team', {}), module).to_request(),
u'role': module.params.get('role')
}
return_vals = {}
@ -335,12 +341,12 @@ def response_to_hash(module, response):
u'entity': response.get(u'entity'),
u'entityId': response.get(u'entityId'),
u'id': response.get(u'id'),
u'projectTeam': BucketAccessControlProjectTeam(response.get(u'projectTeam', {}), module).from_response(),
u'projectTeam': BucketAccessControlProjectteam(response.get(u'projectTeam', {}), module).from_response(),
u'role': response.get(u'role')
}
class BucketAccessControlProjectTeam(object):
class BucketAccessControlProjectteam(object):
def __init__(self, request, module):
self.module = module
if request: