Bug fixes for GCP (as of 2019-07-09T06:06:53Z) (#59132)

* Bug fixes for GCP modules

* ignore syntax
This commit is contained in:
The Magician 2019-07-19 11:32:05 -07:00 committed by Matt Clay
parent 1d3f2c7764
commit b75e8d19be
18 changed files with 174 additions and 18 deletions

View file

@ -54,6 +54,7 @@ options:
Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote,
double-quote, space, and exclamation point.' double-quote, space, and exclamation point.'
required: false required: false
type: str
labels: labels:
description: description:
- The labels associated with this Project. - The labels associated with this Project.
@ -65,25 +66,30 @@ options:
- Clients should store labels in a representation such as JSON that does not depend - Clients should store labels in a representation such as JSON that does not depend
on specific characters being disallowed . on specific characters being disallowed .
required: false required: false
type: dict
parent: parent:
description: description:
- A parent organization. - A parent organization.
required: false required: false
type: dict
suboptions: suboptions:
type: type:
description: description:
- Must be organization. - Must be organization.
required: false required: false
type: str
id: id:
description: description:
- Id of the organization. - Id of the organization.
required: false required: false
type: str
id: id:
description: description:
- The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, - The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters,
digits, or hyphens. It must start with a letter. digits, or hyphens. It must start with a letter.
- Trailing hyphens are prohibited. - Trailing hyphens are prohibited.
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -329,7 +335,7 @@ def wait_for_operation(module, response):
return {} return {}
status = navigate_hash(op_result, ['done']) status = navigate_hash(op_result, ['done'])
wait_done = wait_for_completion(status, op_result, module) wait_done = wait_for_completion(status, op_result, module)
raise_if_errors(op_result, ['error'], module) raise_if_errors(wait_done, ['error'], module)
return navigate_hash(wait_done, ['response']) return navigate_hash(wait_done, ['response'])

View file

@ -53,6 +53,7 @@ options:
- The repo name may contain slashes. eg, projects/myproject/repos/name/with/slash - The repo name may contain slashes. eg, projects/myproject/repos/name/with/slash
. .
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos)' - 'API Reference: U(https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos)'

View file

@ -52,6 +52,7 @@ options:
- A unique identifier for the database, which cannot be changed after the instance - A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9].
required: true required: true
type: str
extra_statements: extra_statements:
description: description:
- 'An optional list of DDL statements to run inside the newly created database. - 'An optional list of DDL statements to run inside the newly created database.
@ -59,6 +60,7 @@ options:
with the creation of the database: if there is an error in any statement, the with the creation of the database: if there is an error in any statement, the
database is not created.' database is not created.'
required: false required: false
type: list
instance: instance:
description: description:
- The instance to create the database on. - The instance to create the database on.
@ -68,6 +70,7 @@ options:
to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases)' - 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases)'
@ -127,6 +130,7 @@ instance:
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict
import json import json
import time
################################################################################ ################################################################################
# Main # Main
@ -177,7 +181,7 @@ def main():
def create(module, link): def create(module, link):
auth = GcpSession(module, 'spanner') auth = GcpSession(module, 'spanner')
return return_if_object(module, auth.post(link, resource_to_request(module))) return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link): def update(module, link):
@ -191,11 +195,7 @@ def delete(module, link):
def resource_to_request(module): def resource_to_request(module):
request = { request = {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')}
u'instance': replace_resource_dict(module.params.get(u'instance', {}), 'name'),
u'name': module.params.get('name'),
u'extraStatements': module.params.get('extra_statements'),
}
request = encode_request(request, module) request = encode_request(request, module)
return_vals = {} return_vals = {}
for k, v in request.items(): for k, v in request.items():
@ -268,6 +268,42 @@ def response_to_hash(module, response):
return {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')} return {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')}
def async_op_url(module, extra_data=None):
if extra_data is None:
extra_data = {}
url = "https://spanner.googleapis.com/v1/{op_id}"
combined = extra_data.copy()
combined.update(module.params)
return url.format(**combined)
def wait_for_operation(module, response):
op_result = return_if_object(module, response)
if op_result is None:
return {}
status = navigate_hash(op_result, ['done'])
wait_done = wait_for_completion(status, op_result, module)
raise_if_errors(wait_done, ['error'], module)
return navigate_hash(wait_done, ['response'])
def wait_for_completion(status, op_result, module):
op_id = navigate_hash(op_result, ['name'])
op_uri = async_op_url(module, {'op_id': op_id})
while not status:
raise_if_errors(op_result, ['error'], module)
time.sleep(1.0)
op_result = fetch_resource(module, op_uri, False)
status = navigate_hash(op_result, ['done'])
return op_result
def raise_if_errors(response, err_path, module):
errors = navigate_hash(response, err_path)
if errors is not None:
module.fail_json(msg=errors)
def decode_response(response, module): def decode_response(response, module):
if not response: if not response:
return response return response

View file

@ -49,6 +49,7 @@ options:
to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -52,6 +52,7 @@ options:
- A unique identifier for the instance, which cannot be changed after the instance - A unique identifier for the instance, which cannot be changed after the instance
is created. The name must be between 6 and 30 characters in length. is created. The name must be between 6 and 30 characters in length.
required: true required: true
type: str
config: config:
description: description:
- The name of the instance's configuration (similar but not quite the same as - The name of the instance's configuration (similar but not quite the same as
@ -61,21 +62,25 @@ options:
- In order to obtain a valid list please consult the [Configuration section of - In order to obtain a valid list please consult the [Configuration section of
the docs](U(https://cloud.google.com/spanner/docs/instances)). the docs](U(https://cloud.google.com/spanner/docs/instances)).
required: true required: true
type: str
display_name: display_name:
description: description:
- The descriptive name for this instance as it appears in UIs. Must be unique - The descriptive name for this instance as it appears in UIs. Must be unique
per project and between 4 and 30 characters in length. per project and between 4 and 30 characters in length.
required: true required: true
type: str
node_count: node_count:
description: description:
- The number of nodes allocated to this instance. - The number of nodes allocated to this instance.
required: false required: false
default: '1' default: '1'
type: int
labels: labels:
description: description:
- 'An object containing a list of "key": value pairs.' - 'An object containing a list of "key": value pairs.'
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
required: false required: false
type: dict
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances)' - 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances)'
@ -202,7 +207,7 @@ def update(module, link):
def delete(module, link): def delete(module, link):
auth = GcpSession(module, 'spanner') auth = GcpSession(module, 'spanner')
return wait_for_operation(module, auth.delete(link)) return return_if_object(module, auth.delete(link))
def resource_to_request(module): def resource_to_request(module):
@ -303,7 +308,7 @@ def wait_for_operation(module, response):
return {} return {}
status = navigate_hash(op_result, ['done']) status = navigate_hash(op_result, ['done'])
wait_done = wait_for_completion(status, op_result, module) wait_done = wait_for_completion(status, op_result, module)
raise_if_errors(op_result, ['error'], module) raise_if_errors(wait_done, ['error'], module)
return navigate_hash(wait_done, ['response']) return navigate_hash(wait_done, ['response'])

View file

@ -51,19 +51,23 @@ options:
description: description:
- The MySQL charset value. - The MySQL charset value.
required: false required: false
type: str
collation: collation:
description: description:
- The MySQL collation value. - The MySQL collation value.
required: false required: false
type: str
name: name:
description: description:
- The name of the database in the Cloud SQL instance. - The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name. - This does not include the project ID or instance name.
required: true required: true
type: str
instance: instance:
description: description:
- The name of the Cloud SQL instance. This does not include the project ID. - The name of the Cloud SQL instance. This does not include the project ID.
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -44,6 +44,7 @@ options:
description: description:
- The name of the Cloud SQL instance. This does not include the project ID. - The name of the Cloud SQL instance. This does not include the project ID.
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -56,10 +56,12 @@ options:
- "* EXTERNAL: A database server that is not managed by Google." - "* EXTERNAL: A database server that is not managed by Google."
- 'Some valid choices include: "FIRST_GEN", "SECOND_GEN", "EXTERNAL"' - 'Some valid choices include: "FIRST_GEN", "SECOND_GEN", "EXTERNAL"'
required: false required: false
type: str
connection_name: connection_name:
description: description:
- Connection name of the Cloud SQL instance used in connection strings. - Connection name of the Cloud SQL instance used in connection strings.
required: false required: false
type: str
database_version: database_version:
description: description:
- The database engine type and version. For First Generation instances, can be - The database engine type and version. For First Generation instances, can be
@ -69,11 +71,13 @@ options:
changed after instance creation.' changed after instance creation.'
- 'Some valid choices include: "MYSQL_5_5", "MYSQL_5_6", "MYSQL_5_7", "POSTGRES_9_6"' - 'Some valid choices include: "MYSQL_5_5", "MYSQL_5_6", "MYSQL_5_7", "POSTGRES_9_6"'
required: false required: false
type: str
failover_replica: failover_replica:
description: description:
- The name and status of the failover replica. This property is applicable only - The name and status of the failover replica. This property is applicable only
to Second Generation instances. to Second Generation instances.
required: false required: false
type: dict
suboptions: suboptions:
name: name:
description: description:
@ -81,6 +85,7 @@ options:
replica is created for the instance. The name doesn't include the project replica is created for the instance. The name doesn't include the project
ID. This property is applicable only to Second Generation instances. ID. This property is applicable only to Second Generation instances.
required: false required: false
type: str
instance_type: instance_type:
description: description:
- The instance type. This can be one of the following. - The instance type. This can be one of the following.
@ -89,32 +94,39 @@ options:
- "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica."
- 'Some valid choices include: "CLOUD_SQL_INSTANCE", "ON_PREMISES_INSTANCE", "READ_REPLICA_INSTANCE"' - 'Some valid choices include: "CLOUD_SQL_INSTANCE", "ON_PREMISES_INSTANCE", "READ_REPLICA_INSTANCE"'
required: false required: false
type: str
ipv6_address: ipv6_address:
description: description:
- The IPv6 address assigned to the instance. This property is applicable only - The IPv6 address assigned to the instance. This property is applicable only
to First Generation instances. to First Generation instances.
required: false required: false
type: str
master_instance_name: master_instance_name:
description: description:
- The name of the instance which will act as master in the replication setup. - The name of the instance which will act as master in the replication setup.
required: false required: false
type: str
max_disk_size: max_disk_size:
description: description:
- The maximum disk size of the instance in bytes. - The maximum disk size of the instance in bytes.
required: false required: false
type: int
name: name:
description: description:
- Name of the Cloud SQL instance. This does not include the project ID. - Name of the Cloud SQL instance. This does not include the project ID.
required: true required: true
type: str
region: region:
description: description:
- The geographical region. Defaults to us-central or us-central1 depending on - The geographical region. Defaults to us-central or us-central1 depending on
the instance type (First Generation or Second Generation/PostgreSQL). the instance type (First Generation or Second Generation/PostgreSQL).
required: false required: false
type: str
replica_configuration: replica_configuration:
description: description:
- Configuration specific to failover replicas and read replicas. - Configuration specific to failover replicas and read replicas.
required: false required: false
type: dict
suboptions: suboptions:
failover_target: failover_target:
description: description:
@ -134,24 +146,29 @@ options:
is used only to set up the replication connection and is stored by MySQL is used only to set up the replication connection and is stored by MySQL
in a file named master.info in the data directory. in a file named master.info in the data directory.
required: false required: false
type: dict
suboptions: suboptions:
ca_certificate: ca_certificate:
description: description:
- PEM representation of the trusted CA's x509 certificate. - PEM representation of the trusted CA's x509 certificate.
required: false required: false
type: str
client_certificate: client_certificate:
description: description:
- PEM representation of the slave's x509 certificate . - PEM representation of the slave's x509 certificate .
required: false required: false
type: str
client_key: client_key:
description: description:
- PEM representation of the slave's private key. The corresponding public - PEM representation of the slave's private key. The corresponding public
key is encoded in the client's certificate. key is encoded in the client's certificate.
required: false required: false
type: str
connect_retry_interval: connect_retry_interval:
description: description:
- Seconds to wait between connect retries. MySQL's default is 60 seconds. - Seconds to wait between connect retries. MySQL's default is 60 seconds.
required: false required: false
type: int
dump_file_path: dump_file_path:
description: description:
- Path to a SQL dump file in Google Cloud Storage from which the slave - Path to a SQL dump file in Google Cloud Storage from which the slave
@ -160,22 +177,27 @@ options:
binlog co-ordinates from which replication should begin. This can be binlog co-ordinates from which replication should begin. This can be
accomplished by setting --master-data to 1 when using mysqldump. accomplished by setting --master-data to 1 when using mysqldump.
required: false required: false
type: str
master_heartbeat_period: master_heartbeat_period:
description: description:
- Interval in milliseconds between replication heartbeats. - Interval in milliseconds between replication heartbeats.
required: false required: false
type: int
password: password:
description: description:
- The password for the replication connection. - The password for the replication connection.
required: false required: false
type: str
ssl_cipher: ssl_cipher:
description: description:
- A list of permissible ciphers to use for SSL encryption. - A list of permissible ciphers to use for SSL encryption.
required: false required: false
type: str
username: username:
description: description:
- The username for the replication connection. - The username for the replication connection.
required: false required: false
type: str
verify_server_certificate: verify_server_certificate:
description: description:
- Whether or not to check the master's Common Name value in the certificate - Whether or not to check the master's Common Name value in the certificate
@ -186,20 +208,24 @@ options:
description: description:
- The replicas of the instance. - The replicas of the instance.
required: false required: false
type: list
service_account_email_address: service_account_email_address:
description: description:
- The service account email address assigned to the instance. This property - The service account email address assigned to the instance. This property
is applicable only to Second Generation instances. is applicable only to Second Generation instances.
required: false required: false
type: str
settings: settings:
description: description:
- The user settings. - The user settings.
required: false required: false
type: dict
suboptions: suboptions:
database_flags: database_flags:
description: description:
- The database flags passed to the instance at startup. - The database flags passed to the instance at startup.
required: false required: false
type: list
version_added: 2.9 version_added: 2.9
suboptions: suboptions:
name: name:
@ -208,17 +234,20 @@ options:
include both server options and system variables for MySQL. Flags should include both server options and system variables for MySQL. Flags should
be specified with underscores, not hyphens. be specified with underscores, not hyphens.
required: false required: false
type: str
value: value:
description: description:
- The value of the flag. Booleans should be set to on for true and off - The value of the flag. Booleans should be set to on for true and off
for false. This field must be omitted if the flag doesn't take a value. for false. This field must be omitted if the flag doesn't take a value.
required: false required: false
type: str
ip_configuration: ip_configuration:
description: description:
- The settings for IP Management. This allows to enable or disable the instance - The settings for IP Management. This allows to enable or disable the instance
IP and manage which external networks can connect to the instance. The IPv4 IP and manage which external networks can connect to the instance. The IPv4
address cannot be disabled for Second Generation instances. address cannot be disabled for Second Generation instances.
required: false required: false
type: dict
suboptions: suboptions:
ipv4_enabled: ipv4_enabled:
description: description:
@ -231,22 +260,26 @@ options:
using the IP. In CIDR notation, also known as 'slash' notation (e.g. using the IP. In CIDR notation, also known as 'slash' notation (e.g.
192.168.100.0/24). 192.168.100.0/24).
required: false required: false
type: list
suboptions: suboptions:
expiration_time: expiration_time:
description: description:
- The time when this access control entry expires in RFC 3339 format, - The time when this access control entry expires in RFC 3339 format,
for example 2012-11-15T16:19:00.094Z. for example 2012-11-15T16:19:00.094Z.
required: false required: false
type: str
name: name:
description: description:
- An optional label to identify this entry. - An optional label to identify this entry.
required: false required: false
type: str
value: value:
description: description:
- The whitelisted value for the access control list. For example, - The whitelisted value for the access control list. For example,
to grant access to a client from an external IP (IPv4 or IPv6) address to grant access to a client from an external IP (IPv4 or IPv6) address
or subnet, use that address or subnet here. or subnet, use that address or subnet here.
required: false required: false
type: str
require_ssl: require_ssl:
description: description:
- Whether the mysqld should default to 'REQUIRE X509' for users connecting - Whether the mysqld should default to 'REQUIRE X509' for users connecting
@ -259,15 +292,18 @@ options:
For MySQL instances, this field determines whether the instance is Second For MySQL instances, this field determines whether the instance is Second
Generation (recommended) or First Generation. Generation (recommended) or First Generation.
required: false required: false
type: str
availability_type: availability_type:
description: description:
- The availabilityType define if your postgres instance is run zonal or regional. - The availabilityType define if your postgres instance is run zonal or regional.
- 'Some valid choices include: "ZONAL", "REGIONAL"' - 'Some valid choices include: "ZONAL", "REGIONAL"'
required: false required: false
type: str
backup_configuration: backup_configuration:
description: description:
- The daily backup configuration for the instance. - The daily backup configuration for the instance.
required: false required: false
type: dict
suboptions: suboptions:
enabled: enabled:
description: description:
@ -284,6 +320,7 @@ options:
description: description:
- Define the backup start time in UTC (HH:MM) . - Define the backup start time in UTC (HH:MM) .
required: false required: false
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -53,10 +53,12 @@ options:
to an empty string. For update operations, host is specified as part of the to an empty string. For update operations, host is specified as part of the
request URL. The host name cannot be updated after insertion. request URL. The host name cannot be updated after insertion.
required: true required: true
type: str
name: name:
description: description:
- The name of the user in the Cloud SQL instance. - The name of the user in the Cloud SQL instance.
required: true required: true
type: str
instance: instance:
description: description:
- The name of the Cloud SQL instance. This does not include the project ID. - The name of the Cloud SQL instance. This does not include the project ID.
@ -66,10 +68,12 @@ options:
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
password: password:
description: description:
- The password for the user. - The password for the user.
required: false required: false
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -49,6 +49,7 @@ options:
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -56,6 +56,7 @@ options:
description: description:
- Access controls on the bucket. - Access controls on the bucket.
required: false required: false
type: list
suboptions: suboptions:
bucket: bucket:
description: description:
@ -66,6 +67,7 @@ options:
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
entity: entity:
description: description:
- 'The entity holding the permission, in one of the following forms: user-userId - 'The entity holding the permission, in one of the following forms: user-userId
@ -76,59 +78,71 @@ options:
- To refer to all members of the Google Apps for Business domain example.com, - To refer to all members of the Google Apps for Business domain example.com,
the entity would be domain-example.com. the entity would be domain-example.com.
required: true required: true
type: str
entity_id: entity_id:
description: description:
- The ID for the entity. - The ID for the entity.
required: false required: false
type: str
project_team: project_team:
description: description:
- The project team associated with the entity. - The project team associated with the entity.
required: false required: false
type: dict
suboptions: suboptions:
project_number: project_number:
description: description:
- The project team associated with the entity. - The project team associated with the entity.
required: false required: false
type: str
team: team:
description: description:
- The team. - The team.
- 'Some valid choices include: "editors", "owners", "viewers"' - 'Some valid choices include: "editors", "owners", "viewers"'
required: false required: false
type: str
role: role:
description: description:
- The access permission for the entity. - The access permission for the entity.
- 'Some valid choices include: "OWNER", "READER", "WRITER"' - 'Some valid choices include: "OWNER", "READER", "WRITER"'
required: false required: false
type: str
cors: cors:
description: description:
- The bucket's Cross-Origin Resource Sharing (CORS) configuration. - The bucket's Cross-Origin Resource Sharing (CORS) configuration.
required: false required: false
type: list
suboptions: suboptions:
max_age_seconds: max_age_seconds:
description: description:
- The value, in seconds, to return in the Access-Control-Max-Age header used - The value, in seconds, to return in the Access-Control-Max-Age header used
in preflight responses. in preflight responses.
required: false required: false
type: int
method: method:
description: description:
- 'The list of HTTP methods on which to include CORS response headers, (GET, - 'The list of HTTP methods on which to include CORS response headers, (GET,
OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means
"any method".' "any method".'
required: false required: false
type: list
origin: origin:
description: description:
- The list of Origins eligible to receive CORS response headers. - The list of Origins eligible to receive CORS response headers.
- 'Note: "*" is permitted in the list of origins, and means "any Origin".' - 'Note: "*" is permitted in the list of origins, and means "any Origin".'
required: false required: false
type: list
response_header: response_header:
description: description:
- The list of HTTP headers other than the simple response headers to give - The list of HTTP headers other than the simple response headers to give
permission for the user-agent to share across domains. permission for the user-agent to share across domains.
required: false required: false
type: list
default_object_acl: default_object_acl:
description: description:
- Default access controls to apply to new objects when no ACL is provided. - Default access controls to apply to new objects when no ACL is provided.
required: false required: false
type: list
version_added: 2.7 version_added: 2.7
suboptions: suboptions:
bucket: bucket:
@ -140,6 +154,7 @@ options:
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
entity: entity:
description: description:
- 'The entity holding the permission, in one of the following forms: * user-{{userId}} - 'The entity holding the permission, in one of the following forms: * user-{{userId}}
@ -148,58 +163,69 @@ options:
(such as "domain-example.com") * project-team-{{projectId}} * allUsers * (such as "domain-example.com") * project-team-{{projectId}} * allUsers *
allAuthenticatedUsers .' allAuthenticatedUsers .'
required: true required: true
type: str
object: object:
description: description:
- The name of the object, if applied to an object. - The name of the object, if applied to an object.
required: false required: false
type: str
role: role:
description: description:
- The access permission for the entity. - The access permission for the entity.
- 'Some valid choices include: "OWNER", "READER"' - 'Some valid choices include: "OWNER", "READER"'
required: true required: true
type: str
lifecycle: lifecycle:
description: description:
- The bucket's lifecycle configuration. - The bucket's lifecycle configuration.
- See U(https://developers.google.com/storage/docs/lifecycle) for more information. - See U(https://developers.google.com/storage/docs/lifecycle) for more information.
required: false required: false
type: dict
suboptions: suboptions:
rule: rule:
description: description:
- A lifecycle management rule, which is made of an action to take and the - A lifecycle management rule, which is made of an action to take and the
condition(s) under which the action will be taken. condition(s) under which the action will be taken.
required: false required: false
type: list
suboptions: suboptions:
action: action:
description: description:
- The action to take. - The action to take.
required: false required: false
type: dict
suboptions: suboptions:
storage_class: storage_class:
description: description:
- Target storage class. Required iff the type of the action is SetStorageClass. - Target storage class. Required iff the type of the action is SetStorageClass.
required: false required: false
type: str
type: type:
description: description:
- Type of the action. Currently, only Delete and SetStorageClass are - Type of the action. Currently, only Delete and SetStorageClass are
supported. supported.
- 'Some valid choices include: "Delete", "SetStorageClass"' - 'Some valid choices include: "Delete", "SetStorageClass"'
required: false required: false
type: str
condition: condition:
description: description:
- The condition(s) under which the action will be taken. - The condition(s) under which the action will be taken.
required: false required: false
type: dict
suboptions: suboptions:
age_days: age_days:
description: description:
- Age of an object (in days). This condition is satisfied when an - Age of an object (in days). This condition is satisfied when an
object reaches the specified age. object reaches the specified age.
required: false required: false
type: int
created_before: created_before:
description: description:
- A date in RFC 3339 format with only the date part (for instance, - A date in RFC 3339 format with only the date part (for instance,
"2013-01-15"). This condition is satisfied when an object is created "2013-01-15"). This condition is satisfied when an object is created
before midnight of the specified date in UTC. before midnight of the specified date in UTC.
required: false required: false
type: str
is_live: is_live:
description: description:
- Relevant only for versioned objects. If the value is true, this - Relevant only for versioned objects. If the value is true, this
@ -213,49 +239,59 @@ options:
will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE,
COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.
required: false required: false
type: list
num_newer_versions: num_newer_versions:
description: description:
- Relevant only for versioned objects. If the value is N, this condition - Relevant only for versioned objects. If the value is N, this condition
is satisfied when there are at least N versions (including the live is satisfied when there are at least N versions (including the live
version) newer than this version of the object. version) newer than this version of the object.
required: false required: false
type: int
location: location:
description: description:
- The location of the bucket. Object data for objects in the bucket resides in - The location of the bucket. Object data for objects in the bucket resides in
physical storage within this region. Defaults to US. See the developer's guide physical storage within this region. Defaults to US. See the developer's guide
for the authoritative list. for the authoritative list.
required: false required: false
type: str
logging: logging:
description: description:
- The bucket's logging configuration, which defines the destination bucket and - The bucket's logging configuration, which defines the destination bucket and
optional name prefix for the current bucket's logs. optional name prefix for the current bucket's logs.
required: false required: false
type: dict
suboptions: suboptions:
log_bucket: log_bucket:
description: description:
- The destination bucket where the current bucket's logs should be placed. - The destination bucket where the current bucket's logs should be placed.
required: false required: false
type: str
log_object_prefix: log_object_prefix:
description: description:
- A prefix for log object names. - A prefix for log object names.
required: false required: false
type: str
metageneration: metageneration:
description: description:
- The metadata generation of this bucket. - The metadata generation of this bucket.
required: false required: false
type: int
name: name:
description: description:
- The name of the bucket. - The name of the bucket.
required: false required: false
type: str
owner: owner:
description: description:
- The owner of the bucket. This is always the project team's owner group. - The owner of the bucket. This is always the project team's owner group.
required: false required: false
type: dict
suboptions: suboptions:
entity: entity:
description: description:
- The entity, in the form project-owner-projectId. - The entity, in the form project-owner-projectId.
required: false required: false
type: str
storage_class: storage_class:
description: description:
- The bucket's default storage class, used whenever no storageClass is specified - The bucket's default storage class, used whenever no storageClass is specified
@ -267,10 +303,12 @@ options:
- 'Some valid choices include: "MULTI_REGIONAL", "REGIONAL", "STANDARD", "NEARLINE", - 'Some valid choices include: "MULTI_REGIONAL", "REGIONAL", "STANDARD", "NEARLINE",
"COLDLINE", "DURABLE_REDUCED_AVAILABILITY"' "COLDLINE", "DURABLE_REDUCED_AVAILABILITY"'
required: false required: false
type: str
versioning: versioning:
description: description:
- The bucket's versioning configuration. - The bucket's versioning configuration.
required: false required: false
type: dict
suboptions: suboptions:
enabled: enabled:
description: description:
@ -283,6 +321,7 @@ options:
accessing bucket contents as a web site. See the Static Website Examples for accessing bucket contents as a web site. See the Static Website Examples for
more information. more information.
required: false required: false
type: dict
suboptions: suboptions:
main_page_suffix: main_page_suffix:
description: description:
@ -291,16 +330,19 @@ options:
object. This allows the creation of index.html objects to represent directory object. This allows the creation of index.html objects to represent directory
pages. pages.
required: false required: false
type: str
not_found_page: not_found_page:
description: description:
- If the requested object path is missing, and any mainPageSuffix object is - If the requested object path is missing, and any mainPageSuffix object is
missing, if applicable, the service will return the named object from this missing, if applicable, the service will return the named object from this
bucket as the content for a 404 Not Found result. bucket as the content for a 404 Not Found result.
required: false required: false
type: str
project: project:
description: description:
- A valid API project identifier. - A valid API project identifier.
required: false required: false
type: str
predefined_default_object_acl: predefined_default_object_acl:
description: description:
- Apply a predefined set of default object access controls to this bucket. - Apply a predefined set of default object access controls to this bucket.
@ -317,6 +359,7 @@ options:
- 'Some valid choices include: "authenticatedRead", "bucketOwnerFullControl", - 'Some valid choices include: "authenticatedRead", "bucketOwnerFullControl",
"bucketOwnerRead", "private", "projectPrivate", "publicRead"' "bucketOwnerRead", "private", "projectPrivate", "publicRead"'
required: false required: false
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -65,6 +65,7 @@ options:
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"' }}"'
required: true required: true
type: dict
entity: entity:
description: description:
- 'The entity holding the permission, in one of the following forms: user-userId - 'The entity holding the permission, in one of the following forms: user-userId
@ -74,29 +75,35 @@ options:
- To refer to all members of the Google Apps for Business domain example.com, - To refer to all members of the Google Apps for Business domain example.com,
the entity would be domain-example.com. the entity would be domain-example.com.
required: true required: true
type: str
entity_id: entity_id:
description: description:
- The ID for the entity. - The ID for the entity.
required: false required: false
type: str
project_team: project_team:
description: description:
- The project team associated with the entity. - The project team associated with the entity.
required: false required: false
type: dict
suboptions: suboptions:
project_number: project_number:
description: description:
- The project team associated with the entity. - The project team associated with the entity.
required: false required: false
type: str
team: team:
description: description:
- The team. - The team.
- 'Some valid choices include: "editors", "owners", "viewers"' - 'Some valid choices include: "editors", "owners", "viewers"'
required: false required: false
type: str
role: role:
description: description:
- The access permission for the entity. - The access permission for the entity.
- 'Some valid choices include: "OWNER", "READER", "WRITER"' - 'Some valid choices include: "OWNER", "READER", "WRITER"'
required: false required: false
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -52,6 +52,7 @@ options:
- Upload or download from the bucket. - Upload or download from the bucket.
- 'Some valid choices include: "download", "upload"' - 'Some valid choices include: "download", "upload"'
required: false required: false
type: str
overwrite: overwrite:
description: description:
- "'Overwrite the file on the bucket/local machine. If overwrite is false and - "'Overwrite the file on the bucket/local machine. If overwrite is false and
@ -62,14 +63,17 @@ options:
description: description:
- Source location of file (may be local machine or cloud depending on action). - Source location of file (may be local machine or cloud depending on action).
required: false required: false
type: path
dest: dest:
description: description:
- Destination location of file (may be local machine or cloud depending on action). - Destination location of file (may be local machine or cloud depending on action).
required: false required: false
type: path
bucket: bucket:
description: description:
- The name of the bucket. - The name of the bucket.
required: false required: false
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -51,24 +51,29 @@ options:
description: description:
- The immutable name of the TPU. - The immutable name of the TPU.
required: true required: true
type: str
description: description:
description: description:
- The user-supplied description of the TPU. Maximum of 512 characters. - The user-supplied description of the TPU. Maximum of 512 characters.
required: false required: false
type: str
accelerator_type: accelerator_type:
description: description:
- The type of hardware accelerators associated with this node. - The type of hardware accelerators associated with this node.
required: true required: true
type: str
tensorflow_version: tensorflow_version:
description: description:
- The version of Tensorflow running in the Node. - The version of Tensorflow running in the Node.
required: true required: true
type: str
network: network:
description: description:
- The name of a network to peer the TPU node to. It must be a preexisting Compute - The name of a network to peer the TPU node to. It must be a preexisting Compute
Engine network inside of the project on which this API has been activated. If Engine network inside of the project on which this API has been activated. If
none is provided, "default" will be used. none is provided, "default" will be used.
required: false required: false
type: str
cidr_block: cidr_block:
description: description:
- The CIDR block that the TPU node will use when selecting an IP address. This - The CIDR block that the TPU node will use when selecting an IP address. This
@ -80,10 +85,12 @@ options:
network, or the provided network is peered with another network that is using network, or the provided network is peered with another network that is using
that CIDR block. that CIDR block.
required: true required: true
type: str
scheduling_config: scheduling_config:
description: description:
- Sets the scheduling options for this TPU instance. - Sets the scheduling options for this TPU instance.
required: false required: false
type: dict
suboptions: suboptions:
preemptible: preemptible:
description: description:
@ -95,10 +102,12 @@ options:
description: description:
- Resource labels to represent user provided metadata. - Resource labels to represent user provided metadata.
required: false required: false
type: dict
zone: zone:
description: description:
- The GCP location for the TPU. - The GCP location for the TPU.
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/tpu/docs/reference/rest/)' - 'API Reference: U(https://cloud.google.com/tpu/docs/reference/rest/)'
@ -402,7 +411,7 @@ def wait_for_operation(module, response):
return {} return {}
status = navigate_hash(op_result, ['done']) status = navigate_hash(op_result, ['done'])
wait_done = wait_for_completion(status, op_result, module) wait_done = wait_for_completion(status, op_result, module)
raise_if_errors(op_result, ['error'], module) raise_if_errors(wait_done, ['error'], module)
return navigate_hash(wait_done, ['response']) return navigate_hash(wait_done, ['response'])

View file

@ -44,6 +44,7 @@ options:
description: description:
- The GCP location for the TPU. - The GCP location for the TPU.
required: true required: true
type: str
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''

View file

@ -60,7 +60,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'webstore' in \"{{ results['resources'] | map(attribute='name') | list }}\"" - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a database that already exists - name: create a database that already exists
gcp_spanner_database: gcp_spanner_database:
@ -101,7 +101,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'webstore' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a database that does not exist - name: delete a database that does not exist
gcp_spanner_database: gcp_spanner_database:

View file

@ -54,7 +54,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a instance that already exists - name: create a instance that already exists
gcp_spanner_instance: gcp_spanner_instance:
@ -102,7 +102,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 0
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a instance that does not exist - name: delete a instance that does not exist
gcp_spanner_instance: gcp_spanner_instance:

View file

@ -743,13 +743,10 @@ lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py E337
lib/ansible/modules/cloud/google/gcp_redis_instance.py E337 lib/ansible/modules/cloud/google/gcp_redis_instance.py E337
lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py E337 lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py E337
lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py E337 lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py E337
lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py E337
lib/ansible/modules/cloud/google/gcp_spanner_database.py E337 lib/ansible/modules/cloud/google/gcp_spanner_database.py E337
lib/ansible/modules/cloud/google/gcp_spanner_instance.py E337 lib/ansible/modules/cloud/google/gcp_spanner_instance.py E337
lib/ansible/modules/cloud/google/gcp_sql_database_facts.py E337
lib/ansible/modules/cloud/google/gcp_sql_database.py E337 lib/ansible/modules/cloud/google/gcp_sql_database.py E337
lib/ansible/modules/cloud/google/gcp_sql_instance.py E337 lib/ansible/modules/cloud/google/gcp_sql_instance.py E337
lib/ansible/modules/cloud/google/gcp_sql_user_facts.py E337
lib/ansible/modules/cloud/google/gcp_sql_user.py E337 lib/ansible/modules/cloud/google/gcp_sql_user.py E337
lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py E337 lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py E337
lib/ansible/modules/cloud/google/gcp_storage_bucket.py E337 lib/ansible/modules/cloud/google/gcp_storage_bucket.py E337
@ -758,7 +755,6 @@ lib/ansible/modules/cloud/google/_gcp_target_proxy.py E322
lib/ansible/modules/cloud/google/_gcp_target_proxy.py E326 lib/ansible/modules/cloud/google/_gcp_target_proxy.py E326
lib/ansible/modules/cloud/google/_gcp_target_proxy.py E337 lib/ansible/modules/cloud/google/_gcp_target_proxy.py E337
lib/ansible/modules/cloud/google/_gcp_target_proxy.py E338 lib/ansible/modules/cloud/google/_gcp_target_proxy.py E338
lib/ansible/modules/cloud/google/gcp_tpu_node_facts.py E337
lib/ansible/modules/cloud/google/gcp_tpu_node.py E337 lib/ansible/modules/cloud/google/gcp_tpu_node.py E337
lib/ansible/modules/cloud/google/gcpubsub_facts.py E322 lib/ansible/modules/cloud/google/gcpubsub_facts.py E322
lib/ansible/modules/cloud/google/gcpubsub_facts.py E324 lib/ansible/modules/cloud/google/gcpubsub_facts.py E324