diff --git a/plugins/modules/gcp_appengine_firewall_rule.py b/plugins/modules/gcp_appengine_firewall_rule.py index c347966..01cd65a 100644 --- a/plugins/modules/gcp_appengine_firewall_rule.py +++ b/plugins/modules/gcp_appengine_firewall_rule.py @@ -34,7 +34,6 @@ description: - A single firewall rule that is evaluated against incoming traffic and provides an action to take on matched requests. short_description: Creates a GCP FirewallRule -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -106,6 +105,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_appengine_firewall_rule_info.py b/plugins/modules/gcp_appengine_firewall_rule_info.py index ef62652..41b797f 100644 --- a/plugins/modules/gcp_appengine_firewall_rule_info.py +++ b/plugins/modules/gcp_appengine_firewall_rule_info.py @@ -33,7 +33,6 @@ module: gcp_appengine_firewall_rule_info description: - Gather info for GCP FirewallRule short_description: Gather info for GCP FirewallRule -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -134,7 +134,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_bigquery_dataset.py b/plugins/modules/gcp_bigquery_dataset.py index b881fd2..acb6ae8 100644 --- a/plugins/modules/gcp_bigquery_dataset.py +++ b/plugins/modules/gcp_bigquery_dataset.py @@ -33,7 +33,6 @@ module: gcp_bigquery_dataset description: - Datasets allow you to organize and control access to your tables. short_description: Creates a GCP Dataset -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -74,9 +73,9 @@ options: role: description: - Describes the rights granted to the user specified by the other member of - the access object. Primitive, Predefined and custom roles are supported. - Predefined roles that have equivalent primitive roles are swapped by the - API to their Primitive counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). + the access object. Basic, predefined, and custom roles are supported. Predefined + roles that have equivalent basic roles are swapped by the API to their basic + counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). required: false type: str special_group: @@ -85,7 +84,7 @@ options: Owners of the enclosing project.' - "* `projectReaders`: Readers of the enclosing project." - "* `projectWriters`: Writers of the enclosing project." - - "* `allAuthenticatedUsers`: All authenticated BigQuery users. ." + - "* `allAuthenticatedUsers`: All authenticated BigQuery users." required: false type: str user_by_email: @@ -167,7 +166,6 @@ options: the default partition expiration time indicated by this property.' required: false type: int - version_added: '2.9' description: description: - A user-friendly description of the dataset. @@ -208,7 +206,6 @@ options: key. required: false type: dict - version_added: '2.10' suboptions: kms_key_name: description: @@ -248,6 +245,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -307,9 +305,9 @@ access: role: description: - Describes the rights granted to the user specified by the other member of - the access object. Primitive, Predefined and custom roles are supported. Predefined - roles that have equivalent primitive roles are swapped by the API to their - Primitive counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). + the access object. Basic, predefined, and custom roles are supported. Predefined + roles that have equivalent basic roles are swapped by the API to their basic + counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). returned: success type: str specialGroup: @@ -318,7 +316,7 @@ access: Owners of the enclosing project.' - "* `projectReaders`: Readers of the enclosing project." - "* `projectWriters`: Writers of the enclosing project." - - "* `allAuthenticatedUsers`: All authenticated BigQuery users. ." + - "* `allAuthenticatedUsers`: All authenticated BigQuery users." returned: success type: str userByEmail: @@ -600,11 +598,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{name}".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_bigquery_dataset_info.py b/plugins/modules/gcp_bigquery_dataset_info.py index 901be7e..c249a36 100644 --- a/plugins/modules/gcp_bigquery_dataset_info.py +++ b/plugins/modules/gcp_bigquery_dataset_info.py @@ -33,7 +33,6 @@ module: gcp_bigquery_dataset_info description: - Gather info for GCP Dataset short_description: Gather info for GCP Dataset -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -129,9 +129,9 @@ resources: role: description: - Describes the rights granted to the user specified by the other member - of the access object. Primitive, Predefined and custom roles are supported. - Predefined roles that have equivalent primitive roles are swapped by the - API to their Primitive counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). + of the access object. Basic, predefined, and custom roles are supported. + Predefined roles that have equivalent basic roles are swapped by the API + to their basic counterparts. See [official docs](U(https://cloud.google.com/bigquery/docs/access-control)). returned: success type: str specialGroup: @@ -140,7 +140,7 @@ resources: Owners of the enclosing project.' - "* `projectReaders`: Readers of the enclosing project." - "* `projectWriters`: Writers of the enclosing project." - - "* `allAuthenticatedUsers`: All authenticated BigQuery users. ." + - "* `allAuthenticatedUsers`: All authenticated BigQuery users." returned: success type: str userByEmail: @@ -298,7 +298,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -317,7 +317,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) def fetch_list(module, link): diff --git a/plugins/modules/gcp_bigquery_table.py b/plugins/modules/gcp_bigquery_table.py index f145113..0f9bb18 100644 --- a/plugins/modules/gcp_bigquery_table.py +++ b/plugins/modules/gcp_bigquery_table.py @@ -33,7 +33,6 @@ module: gcp_bigquery_table description: - A Table that belongs to a Dataset . short_description: Creates a GCP Table -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -78,7 +77,6 @@ options: elements: str required: false type: list - version_added: '2.9' description: description: - A user-friendly description of the dataset. @@ -106,7 +104,6 @@ options: buffer. required: false type: int - version_added: '2.9' view: description: - The view definition. @@ -157,7 +154,6 @@ options: or REQUIRED. required: false type: str - version_added: '2.9' type: description: - The only type supported is DAY, which will generate one partition per day. @@ -497,6 +493,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1195,11 +1192,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables/{name}".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_bigquery_table_info.py b/plugins/modules/gcp_bigquery_table_info.py index f012617..7ad1de7 100644 --- a/plugins/modules/gcp_bigquery_table_info.py +++ b/plugins/modules/gcp_bigquery_table_info.py @@ -33,7 +33,6 @@ module: gcp_bigquery_table_info description: - Gather info for GCP Table short_description: Gather info for GCP Table -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -574,7 +574,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -593,7 +593,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) + return "https://bigquery.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) def fetch_list(module, link): diff --git a/plugins/modules/gcp_bigtable_instance.py b/plugins/modules/gcp_bigtable_instance.py index 18d9bc2..79ccf8c 100644 --- a/plugins/modules/gcp_bigtable_instance.py +++ b/plugins/modules/gcp_bigtable_instance.py @@ -34,7 +34,6 @@ description: - A collection of Bigtable Tables and the resources that serve them. All tables in an instance are served from all Clusters in the instance. short_description: Creates a GCP Instance -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -136,6 +135,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_bigtable_instance_info.py b/plugins/modules/gcp_bigtable_instance_info.py index 8a7b276..16224e3 100644 --- a/plugins/modules/gcp_bigtable_instance_info.py +++ b/plugins/modules/gcp_bigtable_instance_info.py @@ -33,7 +33,6 @@ module: gcp_bigtable_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -172,7 +172,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_cloudbuild_trigger.py b/plugins/modules/gcp_cloudbuild_trigger.py index 918ae8e..af0347e 100644 --- a/plugins/modules/gcp_cloudbuild_trigger.py +++ b/plugins/modules/gcp_cloudbuild_trigger.py @@ -33,7 +33,6 @@ module: gcp_cloudbuild_trigger description: - Configuration for an automated build in response to source repository changes. short_description: Creates a GCP Trigger -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -58,7 +57,6 @@ options: - Name of the trigger. Must be unique within the project. required: false type: str - version_added: '2.10' description: description: - Human-readable description of the trigger. @@ -70,7 +68,6 @@ options: elements: str required: false type: list - version_added: '2.10' disabled: description: - Whether the trigger is disabled or not. If true, the trigger will never result @@ -145,7 +142,6 @@ options: - Only trigger a build if the revision regex does NOT match the revision regex. required: false type: bool - version_added: '2.10' branch_name: description: - Name of the branch to build. Exactly one a of branch name, tag, or commit @@ -178,7 +174,6 @@ options: - The location of the source files to build. required: false type: dict - version_added: '2.10' suboptions: storage_source: description: @@ -286,7 +281,6 @@ options: - Substitutions data for Build resource. required: false type: dict - version_added: '2.10' queue_ttl: description: - TTL in queue for this build. If provided and the build is enqueued longer @@ -296,14 +290,12 @@ options: ''s''. Example: "3.5s".' required: false type: str - version_added: '2.10' logs_bucket: description: - Google Cloud Storage bucket where logs should be written. Logs file names will be of the format ${logsBucket}/log-${build_id}.txt. required: false type: str - version_added: '2.10' timeout: description: - Amount of time that this build should be allowed to run, to second granularity. @@ -316,14 +308,12 @@ options: required: false default: 600s type: str - version_added: '2.10' secrets: description: - Secrets to decrypt using Cloud Key Management Service. elements: dict required: false type: list - version_added: '2.10' suboptions: kms_key_name: description: @@ -464,6 +454,168 @@ options: elements: str required: false type: list + artifacts: + description: + - Artifacts produced by the build that should be uploaded upon successful + completion of all build steps. + required: false + type: dict + suboptions: + images: + description: + - A list of images to be pushed upon the successful completion of all + build steps. + - The images will be pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's + results field. + - If any of the images fail to be pushed, the build is marked FAILURE. + elements: str + required: false + type: list + objects: + description: + - A list of objects to be uploaded to Cloud Storage upon successful completion + of all build steps. + - Files in the workspace matching specified paths globs will be uploaded + to the Cloud Storage location using the builder service account's credentials. + - The location and generation of the uploaded objects will be stored in + the Build resource's results field. + - If any objects fail to be pushed, the build is marked FAILURE. + required: false + type: dict + suboptions: + location: + description: + - Cloud Storage bucket and optional object path, in the form "gs://bucket/path/to/somewhere/". + - Files in the workspace matching any path pattern will be uploaded + to Cloud Storage with this location as a prefix. + required: false + type: str + paths: + description: + - Path globs used to match files in the build's workspace. + elements: str + required: false + type: list + options: + description: + - Special options for this build. + required: false + type: dict + suboptions: + source_provenance_hash: + description: + - Requested hash for SourceProvenance. + elements: str + required: false + type: list + requested_verify_option: + description: + - Requested verifiability options. + - 'Some valid choices include: "NOT_VERIFIED", "VERIFIED"' + required: false + type: str + machine_type: + description: + - Compute Engine machine type on which to run the build. + - 'Some valid choices include: "UNSPECIFIED", "N1_HIGHCPU_8", "N1_HIGHCPU_32"' + required: false + type: str + disk_size_gb: + description: + - Requested disk size for the VM that runs the build. Note that this is + NOT "disk free"; some of the space will be used by the operating system + and build utilities. + - Also note that this is the minimum disk size that will be allocated + for the build -- the build may run with a larger disk than requested. + At present, the maximum disk size is 1000GB; builds that request more + than the maximum are rejected with an error. + required: false + type: int + substitution_option: + description: + - Option to specify behavior when there is an error in the substitution + checks. + - NOTE this is always set to ALLOW_LOOSE for triggered builds and cannot + be overridden in the build configuration file. + - 'Some valid choices include: "MUST_MATCH", "ALLOW_LOOSE"' + required: false + type: str + dynamic_substitutions: + description: + - Option to specify whether or not to apply bash style string operations + to the substitutions. + - NOTE this is always enabled for triggered builds and cannot be overridden + in the build configuration file. + required: false + type: bool + log_streaming_option: + description: + - Option to define build log streaming behavior to Google Cloud Storage. + - 'Some valid choices include: "STREAM_DEFAULT", "STREAM_ON", "STREAM_OFF"' + required: false + type: str + worker_pool: + description: + - Option to specify a WorkerPool for the build. Format projects/{project}/workerPools/{workerPool} + This field is experimental. + required: false + type: str + logging: + description: + - Option to specify the logging mode, which determines if and where build + logs are stored. + - 'Some valid choices include: "LOGGING_UNSPECIFIED", "LEGACY", "GCS_ONLY", + "STACKDRIVER_ONLY", "NONE"' + required: false + type: str + env: + description: + - A list of global environment variable definitions that will exist for + all build steps in this build. If a variable is defined in both globally + and in a build step, the variable will use the build step value. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + elements: str + required: false + type: list + secret_env: + description: + - A list of global environment variables, which are encrypted using a + Cloud Key Management Service crypto key. These values must be specified + in the build's Secret. These variables will be available to all build + steps in this build. + elements: str + required: false + type: list + volumes: + description: + - Global list of volumes to mount for ALL build steps Each volume is created + as an empty volume prior to starting the build process. + - Upon completion of the build, volumes and their contents are discarded. + Global volume names and paths cannot conflict with the volumes defined + a build step. + - Using a global volume in a build with only one step is not valid as + it is indicative of a build request with an incorrect configuration. + elements: dict + required: false + type: list + suboptions: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. + - Each named volume must be used by at least two build steps. + required: false + type: str + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + required: false + type: str project: description: - The Google Cloud Platform project to use. @@ -495,6 +647,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -935,6 +1088,178 @@ build: successfully. returned: success type: list + artifacts: + description: + - Artifacts produced by the build that should be uploaded upon successful completion + of all build steps. + returned: success + type: complex + contains: + images: + description: + - A list of images to be pushed upon the successful completion of all build + steps. + - The images will be pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's + results field. + - If any of the images fail to be pushed, the build is marked FAILURE. + returned: success + type: list + objects: + description: + - A list of objects to be uploaded to Cloud Storage upon successful completion + of all build steps. + - Files in the workspace matching specified paths globs will be uploaded + to the Cloud Storage location using the builder service account's credentials. + - The location and generation of the uploaded objects will be stored in + the Build resource's results field. + - If any objects fail to be pushed, the build is marked FAILURE. + returned: success + type: complex + contains: + location: + description: + - Cloud Storage bucket and optional object path, in the form "gs://bucket/path/to/somewhere/". + - Files in the workspace matching any path pattern will be uploaded + to Cloud Storage with this location as a prefix. + returned: success + type: str + paths: + description: + - Path globs used to match files in the build's workspace. + returned: success + type: list + timing: + description: + - Output only. Stores timing information for pushing all artifact objects. + returned: success + type: complex + contains: + startTime: + description: + - Start of time span. + - 'A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution + and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" + and "2014-10-02T15:01:23.045123456Z".' + returned: success + type: str + endTime: + description: + - End of time span. + - 'A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution + and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" + and "2014-10-02T15:01:23.045123456Z".' + returned: success + type: str + options: + description: + - Special options for this build. + returned: success + type: complex + contains: + sourceProvenanceHash: + description: + - Requested hash for SourceProvenance. + returned: success + type: list + requestedVerifyOption: + description: + - Requested verifiability options. + returned: success + type: str + machineType: + description: + - Compute Engine machine type on which to run the build. + returned: success + type: str + diskSizeGb: + description: + - Requested disk size for the VM that runs the build. Note that this is + NOT "disk free"; some of the space will be used by the operating system + and build utilities. + - Also note that this is the minimum disk size that will be allocated for + the build -- the build may run with a larger disk than requested. At present, + the maximum disk size is 1000GB; builds that request more than the maximum + are rejected with an error. + returned: success + type: int + substitutionOption: + description: + - Option to specify behavior when there is an error in the substitution + checks. + - NOTE this is always set to ALLOW_LOOSE for triggered builds and cannot + be overridden in the build configuration file. + returned: success + type: str + dynamicSubstitutions: + description: + - Option to specify whether or not to apply bash style string operations + to the substitutions. + - NOTE this is always enabled for triggered builds and cannot be overridden + in the build configuration file. + returned: success + type: bool + logStreamingOption: + description: + - Option to define build log streaming behavior to Google Cloud Storage. + returned: success + type: str + workerPool: + description: + - Option to specify a WorkerPool for the build. Format projects/{project}/workerPools/{workerPool} + This field is experimental. + returned: success + type: str + logging: + description: + - Option to specify the logging mode, which determines if and where build + logs are stored. + returned: success + type: str + env: + description: + - A list of global environment variable definitions that will exist for + all build steps in this build. If a variable is defined in both globally + and in a build step, the variable will use the build step value. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + returned: success + type: list + secretEnv: + description: + - A list of global environment variables, which are encrypted using a Cloud + Key Management Service crypto key. These values must be specified in the + build's Secret. These variables will be available to all build steps in + this build. + returned: success + type: list + volumes: + description: + - Global list of volumes to mount for ALL build steps Each volume is created + as an empty volume prior to starting the build process. + - Upon completion of the build, volumes and their contents are discarded. + Global volume names and paths cannot conflict with the volumes defined + a build step. + - Using a global volume in a build with only one step is not valid as it + is indicative of a build request with an incorrect configuration. + returned: success + type: complex + contains: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. + - Each named volume must be used by at least two build steps. + returned: success + type: str + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + returned: success + type: str ''' ################################################################################ @@ -1035,6 +1360,30 @@ def main(): wait_for=dict(type='list', elements='str'), ), ), + artifacts=dict( + type='dict', + options=dict( + images=dict(type='list', elements='str'), + objects=dict(type='dict', options=dict(location=dict(type='str'), paths=dict(type='list', elements='str'))), + ), + ), + options=dict( + type='dict', + options=dict( + source_provenance_hash=dict(type='list', elements='str'), + requested_verify_option=dict(type='str'), + machine_type=dict(type='str'), + disk_size_gb=dict(type='int'), + substitution_option=dict(type='str'), + dynamic_substitutions=dict(type='bool'), + log_streaming_option=dict(type='str'), + worker_pool=dict(type='str'), + logging=dict(type='str'), + env=dict(type='list', elements='str'), + secret_env=dict(type='list', elements='str'), + volumes=dict(type='list', elements='dict', options=dict(name=dict(type='str'), path=dict(type='str'))), + ), + ), ), ), ) @@ -1233,6 +1582,8 @@ class TriggerBuild(object): u'timeout': self.request.get('timeout'), u'secrets': TriggerSecretsArray(self.request.get('secrets', []), self.module).to_request(), u'steps': TriggerStepsArray(self.request.get('steps', []), self.module).to_request(), + u'artifacts': TriggerArtifacts(self.request.get('artifacts', {}), self.module).to_request(), + u'options': TriggerOptions(self.request.get('options', {}), self.module).to_request(), } ) @@ -1248,6 +1599,8 @@ class TriggerBuild(object): u'timeout': self.request.get(u'timeout'), u'secrets': TriggerSecretsArray(self.request.get(u'secrets', []), self.module).from_response(), u'steps': TriggerStepsArray(self.request.get(u'steps', []), self.module).from_response(), + u'artifacts': TriggerArtifacts(self.request.get(u'artifacts', {}), self.module).from_response(), + u'options': TriggerOptions(self.request.get(u'options', {}), self.module).from_response(), } ) @@ -1442,5 +1795,126 @@ class TriggerVolumesArray(object): return remove_nones_from_dict({u'name': item.get(u'name'), u'path': item.get(u'path')}) +class TriggerArtifacts(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + {u'images': self.request.get('images'), u'objects': TriggerObjects(self.request.get('objects', {}), self.module).to_request()} + ) + + def from_response(self): + return remove_nones_from_dict( + {u'images': self.request.get(u'images'), u'objects': TriggerObjects(self.request.get(u'objects', {}), self.module).from_response()} + ) + + +class TriggerObjects(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({u'location': self.request.get('location'), u'paths': self.request.get('paths')}) + + def from_response(self): + return remove_nones_from_dict({u'location': self.request.get(u'location'), u'paths': self.request.get(u'paths')}) + + +class TriggerTiming(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({u'startTime': self.request.get('start_time'), u'endTime': self.request.get('end_time')}) + + def from_response(self): + return remove_nones_from_dict({u'startTime': self.request.get(u'startTime'), u'endTime': self.request.get(u'endTime')}) + + +class TriggerOptions(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'sourceProvenanceHash': self.request.get('source_provenance_hash'), + u'requestedVerifyOption': self.request.get('requested_verify_option'), + u'machineType': self.request.get('machine_type'), + u'diskSizeGb': self.request.get('disk_size_gb'), + u'substitutionOption': self.request.get('substitution_option'), + u'dynamicSubstitutions': self.request.get('dynamic_substitutions'), + u'logStreamingOption': self.request.get('log_streaming_option'), + u'workerPool': self.request.get('worker_pool'), + u'logging': self.request.get('logging'), + u'env': self.request.get('env'), + u'secretEnv': self.request.get('secret_env'), + u'volumes': TriggerVolumesArray(self.request.get('volumes', []), self.module).to_request(), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'sourceProvenanceHash': self.request.get(u'sourceProvenanceHash'), + u'requestedVerifyOption': self.request.get(u'requestedVerifyOption'), + u'machineType': self.request.get(u'machineType'), + u'diskSizeGb': self.request.get(u'diskSizeGb'), + u'substitutionOption': self.request.get(u'substitutionOption'), + u'dynamicSubstitutions': self.request.get(u'dynamicSubstitutions'), + u'logStreamingOption': self.request.get(u'logStreamingOption'), + u'workerPool': self.request.get(u'workerPool'), + u'logging': self.request.get(u'logging'), + u'env': self.request.get(u'env'), + u'secretEnv': self.request.get(u'secretEnv'), + u'volumes': TriggerVolumesArray(self.request.get(u'volumes', []), self.module).from_response(), + } + ) + + +class TriggerVolumesArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({u'name': item.get('name'), u'path': item.get('path')}) + + def _response_from_item(self, item): + return remove_nones_from_dict({u'name': item.get(u'name'), u'path': item.get(u'path')}) + + if __name__ == '__main__': main() diff --git a/plugins/modules/gcp_cloudbuild_trigger_info.py b/plugins/modules/gcp_cloudbuild_trigger_info.py index f2c7270..64b2259 100644 --- a/plugins/modules/gcp_cloudbuild_trigger_info.py +++ b/plugins/modules/gcp_cloudbuild_trigger_info.py @@ -33,7 +33,6 @@ module: gcp_cloudbuild_trigger_info description: - Gather info for GCP Trigger short_description: Gather info for GCP Trigger -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -506,12 +506,187 @@ resources: have completed successfully. returned: success type: list + artifacts: + description: + - Artifacts produced by the build that should be uploaded upon successful + completion of all build steps. + returned: success + type: complex + contains: + images: + description: + - A list of images to be pushed upon the successful completion of all + build steps. + - The images will be pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's + results field. + - If any of the images fail to be pushed, the build is marked FAILURE. + returned: success + type: list + objects: + description: + - A list of objects to be uploaded to Cloud Storage upon successful + completion of all build steps. + - Files in the workspace matching specified paths globs will be uploaded + to the Cloud Storage location using the builder service account's + credentials. + - The location and generation of the uploaded objects will be stored + in the Build resource's results field. + - If any objects fail to be pushed, the build is marked FAILURE. + returned: success + type: complex + contains: + location: + description: + - Cloud Storage bucket and optional object path, in the form "gs://bucket/path/to/somewhere/". + - Files in the workspace matching any path pattern will be uploaded + to Cloud Storage with this location as a prefix. + returned: success + type: str + paths: + description: + - Path globs used to match files in the build's workspace. + returned: success + type: list + timing: + description: + - Output only. Stores timing information for pushing all artifact + objects. + returned: success + type: complex + contains: + startTime: + description: + - Start of time span. + - 'A timestamp in RFC3339 UTC "Zulu" format, with nanosecond + resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" + and "2014-10-02T15:01:23.045123456Z".' + returned: success + type: str + endTime: + description: + - End of time span. + - 'A timestamp in RFC3339 UTC "Zulu" format, with nanosecond + resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" + and "2014-10-02T15:01:23.045123456Z".' + returned: success + type: str + options: + description: + - Special options for this build. + returned: success + type: complex + contains: + sourceProvenanceHash: + description: + - Requested hash for SourceProvenance. + returned: success + type: list + requestedVerifyOption: + description: + - Requested verifiability options. + returned: success + type: str + machineType: + description: + - Compute Engine machine type on which to run the build. + returned: success + type: str + diskSizeGb: + description: + - Requested disk size for the VM that runs the build. Note that this + is NOT "disk free"; some of the space will be used by the operating + system and build utilities. + - Also note that this is the minimum disk size that will be allocated + for the build -- the build may run with a larger disk than requested. + At present, the maximum disk size is 1000GB; builds that request more + than the maximum are rejected with an error. + returned: success + type: int + substitutionOption: + description: + - Option to specify behavior when there is an error in the substitution + checks. + - NOTE this is always set to ALLOW_LOOSE for triggered builds and cannot + be overridden in the build configuration file. + returned: success + type: str + dynamicSubstitutions: + description: + - Option to specify whether or not to apply bash style string operations + to the substitutions. + - NOTE this is always enabled for triggered builds and cannot be overridden + in the build configuration file. + returned: success + type: bool + logStreamingOption: + description: + - Option to define build log streaming behavior to Google Cloud Storage. + returned: success + type: str + workerPool: + description: + - Option to specify a WorkerPool for the build. Format projects/{project}/workerPools/{workerPool} + This field is experimental. + returned: success + type: str + logging: + description: + - Option to specify the logging mode, which determines if and where + build logs are stored. + returned: success + type: str + env: + description: + - A list of global environment variable definitions that will exist + for all build steps in this build. If a variable is defined in both + globally and in a build step, the variable will use the build step + value. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + returned: success + type: list + secretEnv: + description: + - A list of global environment variables, which are encrypted using + a Cloud Key Management Service crypto key. These values must be specified + in the build's Secret. These variables will be available to all build + steps in this build. + returned: success + type: list + volumes: + description: + - Global list of volumes to mount for ALL build steps Each volume is + created as an empty volume prior to starting the build process. + - Upon completion of the build, volumes and their contents are discarded. + Global volume names and paths cannot conflict with the volumes defined + a build step. + - Using a global volume in a build with only one step is not valid as + it is indicative of a build request with an incorrect configuration. + returned: success + type: complex + contains: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. + - Each named volume must be used by at least two build steps. + returned: success + type: str + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + returned: success + type: str ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function.py b/plugins/modules/gcp_cloudfunctions_cloud_function.py index cf58cb6..00174c4 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function.py @@ -33,7 +33,6 @@ module: gcp_cloudfunctions_cloud_function description: - A Cloud Function that contains user computation executed in response to an event. short_description: Creates a GCP CloudFunction -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -189,6 +188,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py index e9d2839..c33cbc8 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py @@ -33,7 +33,6 @@ module: gcp_cloudfunctions_cloud_function_info description: - Gather info for GCP CloudFunction short_description: Gather info for GCP CloudFunction -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -257,7 +257,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_cloudscheduler_job.py b/plugins/modules/gcp_cloudscheduler_job.py index efb2652..307fb67 100644 --- a/plugins/modules/gcp_cloudscheduler_job.py +++ b/plugins/modules/gcp_cloudscheduler_job.py @@ -37,7 +37,6 @@ description: in one of the supported regions. If your project does not have an App Engine app, you must create one. short_description: Creates a GCP Job -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -84,6 +83,8 @@ options: - 'The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes.' - "* For App Engine HTTP targets, between 15 seconds and 24 hours." + - "* **Note**: For PubSub targets, this field is ignored - setting it will introduce + an unresolvable diff." - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. Example: "3.5s" .' required: false @@ -324,6 +325,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -399,6 +401,8 @@ attemptDeadline: - 'The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes.' - "* For App Engine HTTP targets, between 15 seconds and 24 hours." + - "* **Note**: For PubSub targets, this field is ignored - setting it will introduce + an unresolvable diff." - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. Example: "3.5s" .' returned: success diff --git a/plugins/modules/gcp_cloudscheduler_job_info.py b/plugins/modules/gcp_cloudscheduler_job_info.py index a372899..dfb5f3e 100644 --- a/plugins/modules/gcp_cloudscheduler_job_info.py +++ b/plugins/modules/gcp_cloudscheduler_job_info.py @@ -33,7 +33,6 @@ module: gcp_cloudscheduler_job_info description: - Gather info for GCP Job short_description: Gather info for GCP Job -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -141,6 +141,8 @@ resources: - 'The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes.' - "* For App Engine HTTP targets, between 15 seconds and 24 hours." + - "* **Note**: For PubSub targets, this field is ignored - setting it will introduce + an unresolvable diff." - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. Example: "3.5s" .' returned: success @@ -358,7 +360,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_cloudtasks_queue.py b/plugins/modules/gcp_cloudtasks_queue.py index 1fdd0b4..4e525b4 100644 --- a/plugins/modules/gcp_cloudtasks_queue.py +++ b/plugins/modules/gcp_cloudtasks_queue.py @@ -33,7 +33,6 @@ module: gcp_cloudtasks_queue description: - A named resource to which messages are sent by publishers. short_description: Creates a GCP Queue -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -194,6 +193,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_cloudtasks_queue_info.py b/plugins/modules/gcp_cloudtasks_queue_info.py index f177c89..19664a4 100644 --- a/plugins/modules/gcp_cloudtasks_queue_info.py +++ b/plugins/modules/gcp_cloudtasks_queue_info.py @@ -33,7 +33,6 @@ module: gcp_cloudtasks_queue_info description: - Gather info for GCP Queue short_description: Gather info for GCP Queue -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -250,7 +250,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_compute_address.py b/plugins/modules/gcp_compute_address.py index ef2c506..c11b7db 100644 --- a/plugins/modules/gcp_compute_address.py +++ b/plugins/modules/gcp_compute_address.py @@ -42,7 +42,6 @@ description: 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 @@ -71,7 +70,6 @@ options: required: false default: EXTERNAL type: str - version_added: '2.7' description: description: - An optional description of this resource. @@ -95,7 +93,6 @@ options: - 'Some valid choices include: "GCE_ENDPOINT"' required: false type: str - version_added: '2.10' network_tier: description: - The networking tier used for configuring this address. If this field is not @@ -103,7 +100,6 @@ options: - 'Some valid choices include: "PREMIUM", "STANDARD"' required: false type: str - version_added: '2.8' subnetwork: description: - The URL of the subnetwork in which to reserve the address. If an IP address @@ -117,7 +113,6 @@ options: }}"' required: false type: dict - version_added: '2.7' region: description: - URL of the region where the regional address resides. @@ -155,6 +150,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -369,11 +365,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -436,7 +432,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_address_info.py b/plugins/modules/gcp_compute_address_info.py index 17919ff..c5cc01f 100644 --- a/plugins/modules/gcp_compute_address_info.py +++ b/plugins/modules/gcp_compute_address_info.py @@ -33,7 +33,6 @@ module: gcp_compute_address_info description: - Gather info for GCP Address short_description: Gather info for GCP Address -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - URL of the region where the regional address resides. @@ -83,6 +83,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -201,7 +202,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -220,7 +221,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_autoscaler.py b/plugins/modules/gcp_compute_autoscaler.py index 6b770f1..a73a5aa 100644 --- a/plugins/modules/gcp_compute_autoscaler.py +++ b/plugins/modules/gcp_compute_autoscaler.py @@ -35,7 +35,6 @@ description: - Autoscalers allow you to automatically scale virtual machine instances in managed instance groups according to an autoscaling policy that you define. short_description: Creates a GCP Autoscaler -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -112,7 +111,6 @@ options: required: false default: 'ON' type: str - version_added: '2.10' cpu_utilization: description: - Defines the CPU utilization policy that allows the autoscaler to scale based @@ -237,6 +235,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -592,11 +591,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -654,7 +653,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_autoscaler_info.py b/plugins/modules/gcp_compute_autoscaler_info.py index 8d18e90..acd956e 100644 --- a/plugins/modules/gcp_compute_autoscaler_info.py +++ b/plugins/modules/gcp_compute_autoscaler_info.py @@ -33,7 +33,6 @@ module: gcp_compute_autoscaler_info description: - Gather info for GCP Autoscaler short_description: Gather info for GCP Autoscaler -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - URL of the zone where the instance group resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -261,7 +262,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -280,7 +281,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/autoscalers".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_backend_bucket.py b/plugins/modules/gcp_compute_backend_bucket.py index fa77477..9ede363 100644 --- a/plugins/modules/gcp_compute_backend_bucket.py +++ b/plugins/modules/gcp_compute_backend_bucket.py @@ -37,7 +37,6 @@ description: rather than a backend service. It can send requests for static content to a Cloud Storage bucket and requests for dynamic content to a virtual machine instance. short_description: Creates a GCP BackendBucket -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -62,7 +61,6 @@ options: - Cloud CDN configuration for this Backend Bucket. required: false type: dict - version_added: '2.8' suboptions: signed_url_cache_max_age_sec: description: @@ -127,6 +125,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -329,11 +328,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendBuckets/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendBuckets/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendBuckets".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendBuckets".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -392,7 +391,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_backend_bucket_info.py b/plugins/modules/gcp_compute_backend_bucket_info.py index 1e6bc96..a0624da 100644 --- a/plugins/modules/gcp_compute_backend_bucket_info.py +++ b/plugins/modules/gcp_compute_backend_bucket_info.py @@ -33,7 +33,6 @@ module: gcp_compute_backend_bucket_info description: - Gather info for GCP BackendBucket short_description: Gather info for GCP BackendBucket -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -170,7 +171,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -189,7 +190,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendBuckets".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendBuckets".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index bf09bc6..5dd1df9 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -37,7 +37,6 @@ description: - For managed internal load balancing, use a regional backend service instead. - Currently self-managed internal load balancing is only available in beta. short_description: Creates a GCP BackendService -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -134,7 +133,6 @@ options: must be set. required: false type: int - version_added: '2.9' max_rate: description: - The max requests per second (RPS) of the group. @@ -159,7 +157,6 @@ options: must be set. required: false type: str - version_added: '2.9' max_utilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization @@ -173,7 +170,6 @@ options: is applicable only when the load_balancing_scheme is set to INTERNAL_SELF_MANAGED. required: false type: dict - version_added: '2.10' suboptions: max_requests_per_connection: description: @@ -221,7 +217,6 @@ options: This field is only applicable when locality_lb_policy is set to MAGLEV or RING_HASH. required: false type: dict - version_added: '2.10' suboptions: http_cookie: description: @@ -338,7 +333,6 @@ options: required: false default: '3600' type: int - version_added: '2.8' connection_draining: description: - Settings for connection draining . @@ -358,7 +352,6 @@ options: elements: str required: false type: list - version_added: '2.10' description: description: - An optional description of this resource. @@ -374,7 +367,7 @@ options: - The set of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified. - A health check must be specified unless the backend service uses an internet - NEG as a backend. + or serverless NEG as a backend. - For internal load balancing, a URL to a HealthCheck resource must be specified instead. elements: str @@ -385,7 +378,6 @@ options: - Settings for enabling Cloud Identity Aware Proxy. required: false type: dict - version_added: '2.7' suboptions: enabled: description: @@ -411,7 +403,6 @@ options: required: false default: EXTERNAL type: str - version_added: '2.7' locality_lb_policy: description: - The load balancing algorithm used within the scope of the locality. @@ -435,7 +426,6 @@ options: "ORIGINAL_DESTINATION", "MAGLEV"' required: false type: str - version_added: '2.10' name: description: - Name of the resource. Provided by the client when the resource is created. The @@ -452,7 +442,6 @@ options: - This field is applicable only when the load_balancing_scheme is set to INTERNAL_SELF_MANAGED. required: false type: dict - version_added: '2.10' suboptions: base_ejection_time: description: @@ -583,7 +572,7 @@ options: - The protocol this BackendService uses to communicate with backends. - 'The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer types and may result in errors if used with the GA API.' - - 'Some valid choices include: "HTTP", "HTTPS", "HTTP2", "TCP", "SSL"' + - 'Some valid choices include: "HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC"' required: false type: str security_policy: @@ -591,7 +580,6 @@ options: - The security policy associated with this backend service. required: false type: str - version_added: '2.8' session_affinity: description: - Type of session affinity to use. The default is NONE. Session affinity is not @@ -615,7 +603,6 @@ options: - If logging is enabled, logs will be exported to Stackdriver. required: false type: dict - version_added: '2.10' suboptions: enable: description: @@ -663,6 +650,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1032,8 +1020,8 @@ healthChecks: description: - The set of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified. - - A health check must be specified unless the backend service uses an internet NEG - as a backend. + - A health check must be specified unless the backend service uses an internet or + serverless NEG as a backend. - For internal load balancing, a URL to a HealthCheck resource must be specified instead. returned: success @@ -1450,7 +1438,7 @@ def update_fields(module, request, response): def security_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/backendServices/{name}/setSecurityPolicy"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/backendServices/{name}/setSecurityPolicy"]).format(**module.params), {u'securityPolicy': module.params.get('security_policy')}, ) @@ -1499,11 +1487,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1579,7 +1567,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_backend_service_info.py b/plugins/modules/gcp_compute_backend_service_info.py index 3d60d0b..8dc7105 100644 --- a/plugins/modules/gcp_compute_backend_service_info.py +++ b/plugins/modules/gcp_compute_backend_service_info.py @@ -33,7 +33,6 @@ module: gcp_compute_backend_service_info description: - Gather info for GCP BackendService short_description: Gather info for GCP BackendService -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -428,7 +429,7 @@ resources: - The set of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified. - A health check must be specified unless the backend service uses an internet - NEG as a backend. + or serverless NEG as a backend. - For internal load balancing, a URL to a HealthCheck resource must be specified instead. returned: success @@ -680,7 +681,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -699,7 +700,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_disk.py b/plugins/modules/gcp_compute_disk.py index 165bc64..a387c11 100644 --- a/plugins/modules/gcp_compute_disk.py +++ b/plugins/modules/gcp_compute_disk.py @@ -43,7 +43,6 @@ description: - 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 @@ -69,7 +68,6 @@ options: - Labels to apply to this disk. A list of key->value pairs. required: false type: dict - version_added: '2.7' licenses: description: - Any applicable publicly visible licenses. @@ -105,22 +103,20 @@ options: values for the caller's project. required: false type: int - version_added: '2.8' 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 type: str - 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 + image by its family name. For example, specify family/debian-9 to use the latest + Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively, + use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-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 @@ -151,6 +147,12 @@ options: - The name of the encryption key that is stored in Google Cloud KMS. required: false type: str + kms_key_service_account: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + required: false + type: str disk_encryption_key: description: - Encrypts the disk using a customer-supplied encryption key. @@ -177,6 +179,12 @@ options: must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature. required: false type: str + kms_key_service_account: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + required: false + type: str source_snapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -206,6 +214,12 @@ options: - The name of the encryption key that is stored in Google Cloud KMS. required: false type: str + kms_key_service_account: + description: + - The service account used for the encryption request for the given KMS key. + If absent, the Compute Engine Service Agent service account is used. + required: false + type: str project: description: - The Google Cloud Platform project to use. @@ -237,6 +251,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -361,9 +376,9 @@ sourceImage: - 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 + image by its family name. For example, specify family/debian-9 to use the latest + Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively, + use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-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 @@ -400,6 +415,12 @@ sourceImageEncryptionKey: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceImageId: description: - The ID value of the image used to create this disk. This value identifies the @@ -441,6 +462,12 @@ diskEncryptionKey: must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceSnapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -471,6 +498,12 @@ sourceSnapshotEncryptionKey: key that protects this resource. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS key. + If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceSnapshotId: description: - The unique ID of the snapshot used to create this disk. This value identifies @@ -518,10 +551,16 @@ def main(): type=dict(type='str'), source_image=dict(type='str'), zone=dict(required=True, type='str'), - source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), - disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), + source_image_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str')) + ), + disk_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str')) + ), source_snapshot=dict(type='dict'), - source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), + source_snapshot_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str')) + ), ) ) @@ -576,7 +615,7 @@ def update_fields(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}/zones/{zone}/disks/{name}/setLabels"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/setLabels"]).format(**module.params), {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, ) @@ -584,7 +623,7 @@ def label_fingerprint_update(module, request, response): def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params), {u'sizeGb': module.params.get('size_gb')}, ) @@ -599,6 +638,7 @@ def resource_to_request(module): 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'sourceSnapshot': replace_resource_dict(module.params.get(u'source_snapshot', {}), 'selfLink'), 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'), @@ -623,11 +663,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -693,16 +733,16 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) @@ -743,10 +783,22 @@ class DiskSourceimageencryptionkey(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get('raw_key'), + u'kmsKeyName': self.request.get('kms_key_name'), + u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'), + } + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get(u'rawKey'), + u'kmsKeyName': self.request.get(u'kmsKeyName'), + u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'), + } + ) class DiskDiskencryptionkey(object): @@ -758,10 +810,22 @@ class DiskDiskencryptionkey(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get('raw_key'), + u'kmsKeyName': self.request.get('kms_key_name'), + u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'), + } + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get(u'rawKey'), + u'kmsKeyName': self.request.get(u'kmsKeyName'), + u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'), + } + ) class DiskSourcesnapshotencryptionkey(object): @@ -773,10 +837,22 @@ class DiskSourcesnapshotencryptionkey(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get('raw_key'), + u'kmsKeyName': self.request.get('kms_key_name'), + u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'), + } + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get(u'rawKey'), + u'kmsKeyName': self.request.get(u'kmsKeyName'), + u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'), + } + ) if __name__ == '__main__': diff --git a/plugins/modules/gcp_compute_disk_info.py b/plugins/modules/gcp_compute_disk_info.py index 07add3b..619c986 100644 --- a/plugins/modules/gcp_compute_disk_info.py +++ b/plugins/modules/gcp_compute_disk_info.py @@ -33,7 +33,6 @@ module: gcp_compute_disk_info description: - Gather info for GCP Disk short_description: Gather info for GCP Disk -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - A reference to the zone where the disk resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -206,10 +207,10 @@ resources: - 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 + the image by its family name. For example, specify family/debian-9 to use + the latest Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively, use a specific version of a public operating system image: - projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To create a + projects/debian-cloud/global/images/debian-9-stretch-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 @@ -246,6 +247,13 @@ resources: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS + key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceImageId: description: - The ID value of the image used to create this disk. This value identifies @@ -288,6 +296,13 @@ resources: must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS + key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceSnapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -318,6 +333,12 @@ resources: key that protects this resource. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS + key. If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceSnapshotId: description: - The unique ID of the snapshot used to create this disk. This value identifies @@ -332,7 +353,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -351,7 +372,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_external_vpn_gateway.py b/plugins/modules/gcp_compute_external_vpn_gateway.py index 27a1d35..4847150 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway.py @@ -33,7 +33,6 @@ module: gcp_compute_external_vpn_gateway description: - Represents a VPN gateway managed outside of GCP. short_description: Creates a GCP ExternalVpnGateway -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -88,7 +87,7 @@ options: description: - IP address of the interface in the external VPN gateway. - Only IPv4 is supported. This IP address can be either from your on-premise - gateway or another Cloud provider’s VPN gateway, it cannot be an IP address + gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine. required: false type: str @@ -123,6 +122,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -196,7 +196,7 @@ interfaces: description: - IP address of the interface in the external VPN gateway. - Only IPv4 is supported. This IP address can be either from your on-premise - gateway or another Cloud provider’s VPN gateway, it cannot be an IP address + gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine. returned: success type: str @@ -303,11 +303,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -363,7 +363,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_external_vpn_gateway_info.py b/plugins/modules/gcp_compute_external_vpn_gateway_info.py index 0efe9e7..cb47726 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway_info.py @@ -33,7 +33,6 @@ module: gcp_compute_external_vpn_gateway_info description: - Gather info for GCP ExternalVpnGateway short_description: Gather info for GCP ExternalVpnGateway -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -149,7 +150,7 @@ resources: description: - IP address of the interface in the external VPN gateway. - Only IPv4 is supported. This IP address can be either from your on-premise - gateway or another Cloud provider’s VPN gateway, it cannot be an IP address + gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine. returned: success type: str @@ -158,7 +159,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -177,7 +178,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/externalVpnGateways".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_firewall.py b/plugins/modules/gcp_compute_firewall.py index d3ef3b6..8bac11f 100644 --- a/plugins/modules/gcp_compute_firewall.py +++ b/plugins/modules/gcp_compute_firewall.py @@ -40,7 +40,6 @@ description: 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 @@ -67,8 +66,8 @@ options: 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, ipip), or the - IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), + or the IP protocol number. required: true type: str ports: @@ -88,14 +87,13 @@ options: elements: dict required: false type: list - 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, ipip), or the - IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), + or the IP protocol number. required: true type: str ports: @@ -122,7 +120,6 @@ options: elements: str required: false type: list - version_added: '2.8' direction: description: - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: @@ -131,7 +128,6 @@ options: - 'Some valid choices include: "INGRESS", "EGRESS"' required: false type: str - version_added: '2.8' disabled: description: - Denotes whether the firewall rule is disabled, i.e not applied to the network @@ -140,14 +136,12 @@ options: rule will be enabled. required: false type: bool - version_added: '2.8' log_config: description: - This field denotes the logging options for a particular firewall rule. - If logging is enabled, logs will be exported to Cloud Logging. required: false type: dict - version_added: '2.10' suboptions: enable: description: @@ -198,7 +192,6 @@ options: required: false default: '1000' type: int - version_added: '2.8' source_ranges: description: - If source ranges are specified, the firewall will apply only to traffic that @@ -225,7 +218,6 @@ options: elements: str required: false type: list - version_added: '2.8' source_tags: description: - If source tags are specified, the firewall will apply only to traffic with source @@ -249,7 +241,6 @@ options: elements: str required: false type: list - version_added: '2.8' target_tags: description: - A list of instance tags indicating sets of instances located in the network @@ -290,6 +281,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -342,8 +334,8 @@ allowed: 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, ipip), or the - IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), or + the IP protocol number. returned: success type: str ports: @@ -370,8 +362,8 @@ denied: 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, ipip), or the - IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), or + the IP protocol number. returned: success type: str ports: @@ -650,11 +642,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/firewalls/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/firewalls/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/firewalls".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/firewalls".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -723,7 +715,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_firewall_info.py b/plugins/modules/gcp_compute_firewall_info.py index 433573a..6f2f1eb 100644 --- a/plugins/modules/gcp_compute_firewall_info.py +++ b/plugins/modules/gcp_compute_firewall_info.py @@ -33,7 +33,6 @@ module: gcp_compute_firewall_info description: - Gather info for GCP Firewall short_description: Gather info for GCP Firewall -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -123,8 +124,8 @@ resources: 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, ipip), or - the IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), + or the IP protocol number. returned: success type: str ports: @@ -152,8 +153,8 @@ resources: 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, ipip), or - the IP protocol number. + well known protocol strings (tcp, udp, icmp, esp, ah, sctp, ipip, all), + or the IP protocol number. returned: success type: str ports: @@ -305,7 +306,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -324,7 +325,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/firewalls".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/firewalls".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_forwarding_rule.py b/plugins/modules/gcp_compute_forwarding_rule.py index 6ea99ba..5b58b16 100644 --- a/plugins/modules/gcp_compute_forwarding_rule.py +++ b/plugins/modules/gcp_compute_forwarding_rule.py @@ -35,7 +35,6 @@ description: 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 @@ -177,14 +176,12 @@ options: - The forwarded traffic must be of a type appropriate to the target object. required: false type: str - version_added: '2.7' allow_global_access: description: - If true, clients can access ILB from all regions. - Otherwise only allows from the local region the ILB is located at. required: false type: bool - version_added: '2.10' all_ports: description: - For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL @@ -193,7 +190,6 @@ options: Used with backend service. Cannot be set if port or portRange are set. required: false type: bool - version_added: '2.8' network_tier: description: - The networking tier used for configuring this address. If this field is not @@ -201,7 +197,6 @@ options: - 'Some valid choices include: "PREMIUM", "STANDARD"' required: false type: str - version_added: '2.8' service_label: description: - An optional prefix to the service name for this Forwarding Rule. @@ -214,7 +209,6 @@ options: - This field is only used for INTERNAL load balancing. required: false type: str - version_added: '2.8' region: description: - A reference to the region where the regional forwarding rule resides. @@ -252,6 +246,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -562,7 +557,7 @@ def update_fields(module, request, response): def target_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params), {u'target': module.params.get('target')}, ) @@ -570,7 +565,7 @@ def target_update(module, request, response): def allow_global_access_update(module, request, response): auth = GcpSession(module, 'compute') auth.patch( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}"]).format(**module.params), {u'allowGlobalAccess': module.params.get('allow_global_access')}, ) @@ -613,11 +608,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -687,7 +682,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_forwarding_rule_info.py b/plugins/modules/gcp_compute_forwarding_rule_info.py index 483ebfc..b7ac597 100644 --- a/plugins/modules/gcp_compute_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_forwarding_rule_info.py @@ -33,7 +33,6 @@ module: gcp_compute_forwarding_rule_info description: - Gather info for GCP ForwardingRule short_description: Gather info for GCP ForwardingRule -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - A reference to the region where the regional forwarding rule resides. @@ -83,6 +83,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -288,7 +289,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -307,7 +308,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_global_address.py b/plugins/modules/gcp_compute_global_address.py index f308581..31df97c 100644 --- a/plugins/modules/gcp_compute_global_address.py +++ b/plugins/modules/gcp_compute_global_address.py @@ -34,7 +34,6 @@ description: - 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 @@ -54,7 +53,6 @@ options: - The static external IP address represented by this resource. required: false type: str - version_added: '2.8' description: description: - An optional description of this resource. @@ -83,7 +81,6 @@ options: - This field is not applicable to addresses with addressType=EXTERNAL. required: false type: int - version_added: '2.9' address_type: description: - The type of the address to reserve. @@ -93,7 +90,6 @@ options: required: false default: EXTERNAL type: str - version_added: '2.8' purpose: description: - The purpose of the resource. For global internal addresses it can be * VPC_PEERING @@ -101,7 +97,6 @@ options: - 'Some valid choices include: "VPC_PEERING"' required: false type: str - version_added: '2.9' network: description: - The URL of the network in which to reserve the IP range. The IP range must be @@ -115,7 +110,6 @@ options: }}"' required: false type: dict - version_added: '2.9' project: description: - The Google Cloud Platform project to use. @@ -147,6 +141,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -352,11 +347,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/addresses/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/addresses/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/addresses".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/addresses".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -419,16 +414,16 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_global_address_info.py b/plugins/modules/gcp_compute_global_address_info.py index 87f9a4e..f86436a 100644 --- a/plugins/modules/gcp_compute_global_address_info.py +++ b/plugins/modules/gcp_compute_global_address_info.py @@ -33,7 +33,6 @@ module: gcp_compute_global_address_info description: - Gather info for GCP GlobalAddress short_description: Gather info for GCP GlobalAddress -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -186,7 +187,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -205,7 +206,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/addresses".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/addresses".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_global_forwarding_rule.py b/plugins/modules/gcp_compute_global_forwarding_rule.py index 5ac3eb1..7c856d7 100644 --- a/plugins/modules/gcp_compute_global_forwarding_rule.py +++ b/plugins/modules/gcp_compute_global_forwarding_rule.py @@ -37,7 +37,6 @@ description: - 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 @@ -122,7 +121,6 @@ options: elements: dict required: false type: list - version_added: '2.10' suboptions: filter_match_criteria: description: @@ -231,6 +229,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -563,7 +562,7 @@ def update_fields(module, request, response): def target_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/forwardingRules/{name}/setTarget"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/forwardingRules/{name}/setTarget"]).format(**module.params), {u'target': module.params.get('target')}, ) @@ -601,11 +600,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/forwardingRules/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/forwardingRules/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/forwardingRules".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/forwardingRules".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -669,7 +668,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_global_forwarding_rule_info.py b/plugins/modules/gcp_compute_global_forwarding_rule_info.py index f936ed9..1a3836f 100644 --- a/plugins/modules/gcp_compute_global_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_global_forwarding_rule_info.py @@ -33,7 +33,6 @@ module: gcp_compute_global_forwarding_rule_info description: - Gather info for GCP GlobalForwardingRule short_description: Gather info for GCP GlobalForwardingRule -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -265,7 +266,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -284,7 +285,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/forwardingRules".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/forwardingRules".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_health_check.py b/plugins/modules/gcp_compute_health_check.py index 4bbada8..b123da8 100644 --- a/plugins/modules/gcp_compute_health_check.py +++ b/plugins/modules/gcp_compute_health_check.py @@ -41,7 +41,6 @@ description: 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 @@ -171,7 +170,6 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str - version_added: '2.9' https_health_check: description: - A nested object resource. @@ -233,7 +231,6 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str - version_added: '2.9' tcp_health_check: description: - A nested object resource. @@ -288,7 +285,6 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str - version_added: '2.9' ssl_health_check: description: - A nested object resource. @@ -343,13 +339,11 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str - version_added: '2.9' http2_health_check: description: - A nested object resource. required: false type: dict - version_added: '2.10' suboptions: host: description: @@ -406,6 +400,49 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str + grpc_health_check: + description: + - A nested object resource. + required: false + type: dict + suboptions: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + required: false + type: int + port_name: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + required: false + type: str + port_specification: + description: + - 'Specifies how port is selected for health checking, can be one of the following + values: * `USE_FIXED_PORT`: The port number in `port` is used for health + checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for + each network endpoint is used for health checking. For other backends, the + port or named port specified in the Backend Service is used for health checking." + - If not specified, gRPC health check follows behavior specified in `port` + and `portName` fields. + - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' + required: false + type: str + grpc_service_name: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the + overall status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + required: false + type: str project: description: - The Google Cloud Platform project to use. @@ -437,6 +474,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -797,6 +835,47 @@ http2HealthCheck: and `portName` fields. returned: success type: str +grpcHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + 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 + portSpecification: + description: + - 'Specifies how port is selected for health checking, can be one of the following + values: * `USE_FIXED_PORT`: The port number in `port` is used for health checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for each + network endpoint is used for health checking. For other backends, the port + or named port specified in the Backend Service is used for health checking." + - If not specified, gRPC health check follows behavior specified in `port` and + `portName` fields. + returned: success + type: str + grpcServiceName: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the overall + status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + returned: success + type: str ''' ################################################################################ @@ -890,6 +969,10 @@ def main(): port_specification=dict(type='str'), ), ), + grpc_health_check=dict( + type='dict', + options=dict(port=dict(type='int'), port_name=dict(type='str'), port_specification=dict(type='str'), grpc_service_name=dict(type='str')), + ), ) ) @@ -954,6 +1037,7 @@ def resource_to_request(module): 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'http2HealthCheck': HealthCheckHttp2healthcheck(module.params.get('http2_health_check', {}), module).to_request(), + u'grpcHealthCheck': HealthCheckGrpchealthcheck(module.params.get('grpc_health_check', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -969,11 +1053,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/healthChecks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/healthChecks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/healthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/healthChecks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1033,13 +1117,14 @@ def response_to_hash(module, response): u'tcpHealthCheck': HealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(), u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response(), u'http2HealthCheck': HealthCheckHttp2healthcheck(response.get(u'http2HealthCheck', {}), module).from_response(), + u'grpcHealthCheck': HealthCheckGrpchealthcheck(response.get(u'grpcHealthCheck', {}), module).from_response(), } def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) @@ -1242,5 +1327,34 @@ class HealthCheckHttp2healthcheck(object): ) +class HealthCheckGrpchealthcheck(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'port': self.request.get('port'), + u'portName': self.request.get('port_name'), + u'portSpecification': self.request.get('port_specification'), + u'grpcServiceName': self.request.get('grpc_service_name'), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'port': self.request.get(u'port'), + u'portName': self.request.get(u'portName'), + u'portSpecification': self.request.get(u'portSpecification'), + u'grpcServiceName': self.request.get(u'grpcServiceName'), + } + ) + + if __name__ == '__main__': main() diff --git a/plugins/modules/gcp_compute_health_check_info.py b/plugins/modules/gcp_compute_health_check_info.py index 5329859..bd7697b 100644 --- a/plugins/modules/gcp_compute_health_check_info.py +++ b/plugins/modules/gcp_compute_health_check_info.py @@ -33,7 +33,6 @@ module: gcp_compute_health_check_info description: - Gather info for GCP HealthCheck short_description: Gather info for GCP HealthCheck -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -450,12 +451,55 @@ resources: and `portName` fields. returned: success type: str + grpcHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + 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 + portSpecification: + description: + - 'Specifies how port is selected for health checking, can be one of the + following values: * `USE_FIXED_PORT`: The port number in `port` is used + for health checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for + each network endpoint is used for health checking. For other backends, + the port or named port specified in the Backend Service is used for health + checking." + - If not specified, gRPC health check follows behavior specified in `port` + and `portName` fields. + returned: success + type: str + grpcServiceName: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the + overall status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + returned: success + type: str ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -474,7 +518,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/healthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/healthChecks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_http_health_check.py b/plugins/modules/gcp_compute_http_health_check.py index 5969c78..94f8e8d 100644 --- a/plugins/modules/gcp_compute_http_health_check.py +++ b/plugins/modules/gcp_compute_http_health_check.py @@ -34,7 +34,6 @@ description: - 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 @@ -144,6 +143,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -355,11 +355,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -422,7 +422,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_http_health_check_info.py b/plugins/modules/gcp_compute_http_health_check_info.py index a1ec4c1..3320950 100644 --- a/plugins/modules/gcp_compute_http_health_check_info.py +++ b/plugins/modules/gcp_compute_http_health_check_info.py @@ -33,7 +33,6 @@ module: gcp_compute_http_health_check_info description: - Gather info for GCP HttpHealthCheck short_description: Gather info for GCP HttpHealthCheck -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -187,7 +188,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -206,7 +207,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_https_health_check.py b/plugins/modules/gcp_compute_https_health_check.py index 12dcd6e..ecd6f61 100644 --- a/plugins/modules/gcp_compute_https_health_check.py +++ b/plugins/modules/gcp_compute_https_health_check.py @@ -34,7 +34,6 @@ description: - 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 @@ -141,6 +140,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -352,11 +352,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -419,7 +419,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_https_health_check_info.py b/plugins/modules/gcp_compute_https_health_check_info.py index 2628e33..a0356dd 100644 --- a/plugins/modules/gcp_compute_https_health_check_info.py +++ b/plugins/modules/gcp_compute_https_health_check_info.py @@ -33,7 +33,6 @@ module: gcp_compute_https_health_check_info description: - Gather info for GCP HttpsHealthCheck short_description: Gather info for GCP HttpsHealthCheck -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -187,7 +188,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -206,7 +207,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_image.py b/plugins/modules/gcp_compute_image.py index d4a7852..6368808 100644 --- a/plugins/modules/gcp_compute_image.py +++ b/plugins/modules/gcp_compute_image.py @@ -43,7 +43,6 @@ description: 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 @@ -88,8 +87,8 @@ options: type: description: - The type of supported feature. - - 'Some valid choices include: "MULTI_IP_SUBNET", "SECURE_BOOT", "UEFI_COMPATIBLE", - "VIRTIO_SCSI_MULTIQUEUE", "WINDOWS"' + - 'Some valid choices include: "MULTI_IP_SUBNET", "SECURE_BOOT", "SEV_CAPABLE", + "UEFI_COMPATIBLE", "VIRTIO_SCSI_MULTIQUEUE", "WINDOWS"' required: true type: str image_encryption_key: @@ -111,7 +110,6 @@ options: - Labels to apply to this Image. required: false type: dict - version_added: '2.8' licenses: description: - Any applicable license URI. @@ -186,6 +184,31 @@ options: of a given disk name. required: false type: str + source_image: + description: + - 'URL of the source image used to create this image. In order to create an image, + you must provide the full or partial URL of one of the following: The selfLink + URL This property The rawDisk.source URL The sourceDisk URL .' + - 'This field represents a link to a Image resource in GCP. It can be specified + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_image task and then set this source_image field to "{{ name-of-resource + }}"' + required: false + type: dict + source_snapshot: + description: + - URL of the source snapshot used to create this image. + - 'In order to create an image, you must provide the full or partial URL of one + of the following: The selfLink URL This property The sourceImage URL The rawDisk.source + URL The sourceDisk URL .' + - 'This field represents a link to a Snapshot resource in GCP. It can be specified + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_snapshot task and then set this source_snapshot field to "{{ + name-of-resource }}"' + required: false + type: dict source_type: description: - The type of the image used to create this disk. The default and only value is @@ -224,6 +247,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -460,6 +484,21 @@ sourceDiskId: of a given disk name. returned: success type: str +sourceImage: + description: + - 'URL of the source image used to create this image. In order to create an image, + you must provide the full or partial URL of one of the following: The selfLink + URL This property The rawDisk.source URL The sourceDisk URL .' + returned: success + type: dict +sourceSnapshot: + description: + - URL of the source snapshot used to create this image. + - 'In order to create an image, you must provide the full or partial URL of one + of the following: The selfLink URL This property The sourceImage URL The rawDisk.source + URL The sourceDisk URL .' + returned: success + type: dict sourceType: description: - The type of the image used to create this disk. The default and only value is @@ -507,6 +546,8 @@ def main(): source_disk=dict(type='dict'), source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), source_disk_id=dict(type='str'), + source_image=dict(type='dict'), + source_snapshot=dict(type='dict'), source_type=dict(type='str'), ) ) @@ -560,7 +601,7 @@ def update_fields(module, request, response): def labels_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/images/{name}/setLabels"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/images/{name}/setLabels"]).format(**module.params), {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, ) @@ -585,6 +626,8 @@ def resource_to_request(module): 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'sourceDiskId': module.params.get('source_disk_id'), + u'sourceImage': replace_resource_dict(module.params.get(u'source_image', {}), 'selfLink'), + u'sourceSnapshot': replace_resource_dict(module.params.get(u'source_snapshot', {}), 'selfLink'), u'sourceType': module.params.get('source_type'), } return_vals = {} @@ -601,11 +644,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/images/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/images/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/images".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/images".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -668,6 +711,8 @@ def response_to_hash(module, response): u'sourceDisk': response.get(u'sourceDisk'), u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(), u'sourceDiskId': response.get(u'sourceDiskId'), + u'sourceImage': response.get(u'sourceImage'), + u'sourceSnapshot': response.get(u'sourceSnapshot'), u'sourceType': response.get(u'sourceType'), } @@ -675,16 +720,16 @@ def response_to_hash(module, response): def license_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1//projects/.*/global/licenses/.*" + url = r"https://compute.googleapis.com/compute/v1//projects/.*/global/licenses/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1//projects/{project}/global/licenses/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1//projects/{project}/global/licenses/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_image_info.py b/plugins/modules/gcp_compute_image_info.py index 729b034..5f8a3c5 100644 --- a/plugins/modules/gcp_compute_image_info.py +++ b/plugins/modules/gcp_compute_image_info.py @@ -33,7 +33,6 @@ module: gcp_compute_image_info description: - Gather info for GCP Image short_description: Gather info for GCP Image -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -307,6 +308,21 @@ resources: of a given disk name. returned: success type: str + sourceImage: + description: + - 'URL of the source image used to create this image. In order to create an + image, you must provide the full or partial URL of one of the following: The + selfLink URL This property The rawDisk.source URL The sourceDisk URL .' + returned: success + type: dict + sourceSnapshot: + description: + - URL of the source snapshot used to create this image. + - 'In order to create an image, you must provide the full or partial URL of + one of the following: The selfLink URL This property The sourceImage URL The + rawDisk.source URL The sourceDisk URL .' + returned: success + type: dict sourceType: description: - The type of the image used to create this disk. The default and only value @@ -318,7 +334,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -337,7 +353,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/images".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/images".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py index c153127..afe46c2 100644 --- a/plugins/modules/gcp_compute_instance.py +++ b/plugins/modules/gcp_compute_instance.py @@ -33,7 +33,6 @@ module: gcp_compute_instance description: - An instance is a virtual machine (VM) hosted on Google's infrastructure. short_description: Creates a GCP Instance -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -62,7 +61,6 @@ options: - Whether the resource should be protected against deletion. required: false type: bool - version_added: '2.9' disks: description: - An array of disks that are associated with the instances that are created from @@ -233,13 +231,11 @@ options: when using zonal DNS. required: false type: str - version_added: '2.9' labels: description: - Labels to apply to this instance. A list of key->value pairs. required: false type: dict - version_added: '2.9' metadata: description: - The metadata key/value pairs to assign to instances that are created from this @@ -319,14 +315,12 @@ options: external IP address of the instance to a DNS domain name. required: false type: bool - version_added: '2.10' public_ptr_domain_name: description: - The DNS domain name for the public PTR record. You can set this field only if the setPublicPtr field is enabled. required: false type: str - version_added: '2.10' network_tier: description: - This signifies the networking tier used for configuring this access @@ -338,7 +332,6 @@ options: - 'Some valid choices include: "PREMIUM", "STANDARD"' required: false type: str - version_added: '2.10' alias_ip_ranges: description: - An array of alias IP ranges for this network interface. Can only be specified @@ -448,7 +441,6 @@ options: - Configuration for various parameters related to shielded instances. required: false type: dict - version_added: '2.9' suboptions: enable_secure_boot: description: @@ -475,7 +467,6 @@ options: "SUSPENDING", "SUSPENDED", "TERMINATED"' required: false type: str - version_added: '2.8' tags: description: - A list of tags to apply to this instance. Tags are used to identify valid sources @@ -537,6 +528,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1217,7 +1209,7 @@ def update_fields(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}/zones/{zone}/instances/{name}/setLabels"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/instances/{name}/setLabels"]).format(**module.params), {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, ) @@ -1225,7 +1217,7 @@ def label_fingerprint_update(module, request, response): def machine_type_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/instances/{name}/setMachineType"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/instances/{name}/setMachineType"]).format(**module.params), {u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params)}, ) @@ -1270,11 +1262,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1350,25 +1342,25 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name def machine_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/machineTypes/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/machineTypes/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_instance_group.py b/plugins/modules/gcp_compute_instance_group.py index c9cb293..2a057a9 100644 --- a/plugins/modules/gcp_compute_instance_group.py +++ b/plugins/modules/gcp_compute_instance_group.py @@ -36,7 +36,6 @@ description: 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 @@ -126,7 +125,6 @@ options: elements: dict required: false type: list - version_added: '2.8' project: description: - The Google Cloud Platform project to use. @@ -158,6 +156,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -378,11 +377,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -442,16 +441,16 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_instance_group_info.py b/plugins/modules/gcp_compute_instance_group_info.py index ee29929..f1d8325 100644 --- a/plugins/modules/gcp_compute_instance_group_info.py +++ b/plugins/modules/gcp_compute_instance_group_info.py @@ -33,7 +33,6 @@ module: gcp_compute_instance_group_info description: - Gather info for GCP InstanceGroup short_description: Gather info for GCP InstanceGroup -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - A reference to the zone where the instance group resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -196,7 +197,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -215,7 +216,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_instance_group_manager.py b/plugins/modules/gcp_compute_instance_group_manager.py index dc3beb5..5aacaa8 100644 --- a/plugins/modules/gcp_compute_instance_group_manager.py +++ b/plugins/modules/gcp_compute_instance_group_manager.py @@ -38,7 +38,6 @@ description: 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 @@ -155,6 +154,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -475,11 +475,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -543,16 +543,16 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_instance_group_manager_info.py b/plugins/modules/gcp_compute_instance_group_manager_info.py index beca92b..4659c4b 100644 --- a/plugins/modules/gcp_compute_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_instance_group_manager_info.py @@ -33,7 +33,6 @@ module: gcp_compute_instance_group_manager_info description: - Gather info for GCP InstanceGroupManager short_description: Gather info for GCP InstanceGroupManager -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - The zone the managed instance group resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -271,7 +272,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -290,7 +291,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_instance_info.py b/plugins/modules/gcp_compute_instance_info.py index 9d91b19..606aa6d 100644 --- a/plugins/modules/gcp_compute_instance_info.py +++ b/plugins/modules/gcp_compute_instance_info.py @@ -33,7 +33,6 @@ module: gcp_compute_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - A reference to the zone where the machine resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -580,7 +581,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -599,7 +600,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_instance_template.py b/plugins/modules/gcp_compute_instance_template.py index d75d815..eb486d8 100644 --- a/plugins/modules/gcp_compute_instance_template.py +++ b/plugins/modules/gcp_compute_instance_template.py @@ -39,7 +39,6 @@ description: - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left behind on machine deletion.' short_description: Creates a GCP InstanceTemplate -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -236,7 +235,6 @@ options: - Labels to apply to this address. A list of key->value pairs. required: false type: dict - version_added: '2.9' machine_type: description: - The machine type to use in the VM instance template. @@ -326,14 +324,12 @@ options: the external IP address of the instance to a DNS domain name. required: false type: bool - version_added: '2.10' public_ptr_domain_name: description: - The DNS domain name for the public PTR record. You can set this field only if the setPublicPtr field is enabled. required: false type: str - version_added: '2.10' network_tier: description: - This signifies the networking tier used for configuring this access @@ -345,7 +341,6 @@ options: - 'Some valid choices include: "PREMIUM", "STANDARD"' required: false type: str - version_added: '2.10' alias_ip_ranges: description: - An array of alias IP ranges for this network interface. Can only be @@ -508,6 +503,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1143,11 +1139,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1207,16 +1203,16 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_instance_template_info.py b/plugins/modules/gcp_compute_instance_template_info.py index 8f3de71..5e6e684 100644 --- a/plugins/modules/gcp_compute_instance_template_info.py +++ b/plugins/modules/gcp_compute_instance_template_info.py @@ -33,7 +33,6 @@ module: gcp_compute_instance_template_info description: - Gather info for GCP InstanceTemplate short_description: Gather info for GCP InstanceTemplate -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -543,7 +544,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -562,7 +563,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_interconnect_attachment.py b/plugins/modules/gcp_compute_interconnect_attachment.py index 2cec2a2..4c72879 100644 --- a/plugins/modules/gcp_compute_interconnect_attachment.py +++ b/plugins/modules/gcp_compute_interconnect_attachment.py @@ -34,7 +34,6 @@ description: - Represents an InterconnectAttachment (VLAN attachment) resource. For more information, see Creating VLAN Attachments. short_description: Creates a GCP InterconnectAttachment -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -56,7 +55,6 @@ options: required: false default: 'true' type: bool - version_added: '2.9' interconnect: description: - URL of the underlying Interconnect object that this attachment's traffic will @@ -82,7 +80,6 @@ options: "BPS_50G"' required: false type: str - version_added: '2.9' edge_availability_domain: description: - Desired availability domain for the attachment. Only available for type PARTNER, @@ -176,6 +173,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -458,11 +456,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -533,16 +531,16 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_interconnect_attachment_info.py b/plugins/modules/gcp_compute_interconnect_attachment_info.py index 819d952..6c3d387 100644 --- a/plugins/modules/gcp_compute_interconnect_attachment_info.py +++ b/plugins/modules/gcp_compute_interconnect_attachment_info.py @@ -33,7 +33,6 @@ module: gcp_compute_interconnect_attachment_info description: - Gather info for GCP InterconnectAttachment short_description: Gather info for GCP InterconnectAttachment -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - Region where the regional interconnect attachment resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -267,7 +268,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -286,7 +287,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_network.py b/plugins/modules/gcp_compute_network.py index 7a3f030..8609214 100644 --- a/plugins/modules/gcp_compute_network.py +++ b/plugins/modules/gcp_compute_network.py @@ -33,7 +33,6 @@ module: gcp_compute_network description: - Manages a VPC network or legacy network resource on GCP. short_description: Creates a GCP Network -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -79,7 +78,6 @@ options: to determine what type of network-wide routing behavior to enforce. required: false type: dict - version_added: '2.8' suboptions: routing_mode: description: @@ -122,6 +120,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -300,7 +299,7 @@ def update_fields(module, request, response): def routing_config_update(module, request, response): auth = GcpSession(module, 'compute') auth.patch( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/networks/{name}"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/networks/{name}"]).format(**module.params), {u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request()}, ) @@ -332,11 +331,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/networks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/networks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/networks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -396,7 +395,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_network_endpoint_group.py b/plugins/modules/gcp_compute_network_endpoint_group.py index 9771000..a59856e 100644 --- a/plugins/modules/gcp_compute_network_endpoint_group.py +++ b/plugins/modules/gcp_compute_network_endpoint_group.py @@ -40,7 +40,6 @@ description: you can distribute traffic in a granular fashion among applications or containers running within VM instances. short_description: Creates a GCP NetworkEndpointGroup -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -140,6 +139,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -351,11 +351,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -415,7 +415,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_network_endpoint_group_info.py b/plugins/modules/gcp_compute_network_endpoint_group_info.py index 53d6587..64fb657 100644 --- a/plugins/modules/gcp_compute_network_endpoint_group_info.py +++ b/plugins/modules/gcp_compute_network_endpoint_group_info.py @@ -33,7 +33,6 @@ module: gcp_compute_network_endpoint_group_info description: - Gather info for GCP NetworkEndpointGroup short_description: Gather info for GCP NetworkEndpointGroup -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - Zone where the network endpoint group is located. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -175,7 +176,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -194,7 +195,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/networkEndpointGroups".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_network_info.py b/plugins/modules/gcp_compute_network_info.py index 5de6884..b58edd6 100644 --- a/plugins/modules/gcp_compute_network_info.py +++ b/plugins/modules/gcp_compute_network_info.py @@ -33,7 +33,6 @@ module: gcp_compute_network_info description: - Gather info for GCP Network short_description: Gather info for GCP Network -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -179,7 +180,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -198,7 +199,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/networks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/networks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_node_group.py b/plugins/modules/gcp_compute_node_group.py index adc465f..5c5c0ec 100644 --- a/plugins/modules/gcp_compute_node_group.py +++ b/plugins/modules/gcp_compute_node_group.py @@ -33,7 +33,6 @@ module: gcp_compute_node_group description: - Represents a NodeGroup resource to manage a group of sole-tenant nodes. short_description: Creates a GCP NodeGroup -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -109,6 +108,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -265,7 +265,7 @@ def update_fields(module, request, response): def node_template_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/nodeGroups/{name}/setNodeTemplate"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/nodeGroups/{name}/setNodeTemplate"]).format(**module.params), {u'nodeTemplate': replace_resource_dict(module.params.get(u'node_template', {}), 'selfLink')}, ) @@ -297,15 +297,15 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups".format(**module.params) def create_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups?initialNodeCount={size}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups?initialNodeCount={size}".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -362,25 +362,25 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def zone_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_node_group_info.py b/plugins/modules/gcp_compute_node_group_info.py index f85939d..d87516c 100644 --- a/plugins/modules/gcp_compute_node_group_info.py +++ b/plugins/modules/gcp_compute_node_group_info.py @@ -33,7 +33,6 @@ module: gcp_compute_node_group_info description: - Gather info for GCP NodeGroup short_description: Gather info for GCP NodeGroup -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - Zone where this node group is located . @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -153,7 +154,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -172,7 +173,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/nodeGroups".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_node_template.py b/plugins/modules/gcp_compute_node_template.py index 4a9aaa9..b81a181 100644 --- a/plugins/modules/gcp_compute_node_template.py +++ b/plugins/modules/gcp_compute_node_template.py @@ -35,7 +35,6 @@ description: sole-tenant nodes, such as node type, vCPU and memory requirements, node affinity labels, and region. short_description: Creates a GCP NodeTemplate -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -125,6 +124,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -321,11 +321,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -383,16 +383,16 @@ def response_to_hash(module, response): def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_node_template_info.py b/plugins/modules/gcp_compute_node_template_info.py index c4ad2da..43553d9 100644 --- a/plugins/modules/gcp_compute_node_template_info.py +++ b/plugins/modules/gcp_compute_node_template_info.py @@ -33,7 +33,6 @@ module: gcp_compute_node_template_info description: - Gather info for GCP NodeTemplate short_description: Gather info for GCP NodeTemplate -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - Region where nodes using the node template will be created . @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -177,7 +178,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -196,7 +197,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/nodeTemplates".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_autoscaler.py b/plugins/modules/gcp_compute_region_autoscaler.py index c36a255..2017b0e 100644 --- a/plugins/modules/gcp_compute_region_autoscaler.py +++ b/plugins/modules/gcp_compute_region_autoscaler.py @@ -35,7 +35,6 @@ description: - Autoscalers allow you to automatically scale virtual machine instances in managed instance groups according to an autoscaling policy that you define. short_description: Creates a GCP RegionAutoscaler -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -213,6 +212,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -563,11 +563,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -625,7 +625,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_autoscaler_info.py b/plugins/modules/gcp_compute_region_autoscaler_info.py index b5a037a..5f12368 100644 --- a/plugins/modules/gcp_compute_region_autoscaler_info.py +++ b/plugins/modules/gcp_compute_region_autoscaler_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_autoscaler_info description: - Gather info for GCP RegionAutoscaler short_description: Gather info for GCP RegionAutoscaler -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - URL of the region where the instance group resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -261,7 +262,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -280,7 +281,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/autoscalers".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_backend_service.py b/plugins/modules/gcp_compute_region_backend_service.py index e341151..ed8009f 100644 --- a/plugins/modules/gcp_compute_region_backend_service.py +++ b/plugins/modules/gcp_compute_region_backend_service.py @@ -34,7 +34,6 @@ description: - A Region Backend Service defines a regionally-scoped group of virtual machines that will serve traffic for load balancing. short_description: Creates a GCP RegionBackendService -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -339,9 +338,11 @@ options: health_checks: description: - The set of URLs to HealthCheck resources for health checking this RegionBackendService. - Currently at most one health check can be specified, and a health check is required. + Currently at most one health check can be specified. A health check must be + specified unless the backend service uses an internet or serverless NEG as a + backend. elements: str - required: true + required: false type: list load_balancing_scheme: description: @@ -529,7 +530,8 @@ options: - The protocol this RegionBackendService uses to communicate with backends. - 'The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer types and may result in errors if used with the GA API.' - - 'Some valid choices include: "HTTP", "HTTPS", "HTTP2", "SSL", "TCP", "UDP"' + - 'Some valid choices include: "HTTP", "HTTPS", "HTTP2", "SSL", "TCP", "UDP", + "GRPC"' required: false type: str session_affinity: @@ -616,6 +618,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -959,7 +962,8 @@ fingerprint: healthChecks: description: - The set of URLs to HealthCheck resources for health checking this RegionBackendService. - Currently at most one health check can be specified, and a health check is required. + Currently at most one health check can be specified. A health check must be specified + unless the backend service uses an internet or serverless NEG as a backend. returned: success type: list id: @@ -1267,7 +1271,7 @@ def main(): disable_connection_drain_on_failover=dict(type='bool'), drop_traffic_if_unhealthy=dict(type='bool'), failover_ratio=dict(type='str') ), ), - health_checks=dict(required=True, type='list', elements='str'), + health_checks=dict(type='list', elements='str'), load_balancing_scheme=dict(default='INTERNAL', type='str'), locality_lb_policy=dict(type='str'), name=dict(required=True, type='str'), @@ -1379,11 +1383,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1456,7 +1460,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_backend_service_info.py b/plugins/modules/gcp_compute_region_backend_service_info.py index 1b40a89..a030fd8 100644 --- a/plugins/modules/gcp_compute_region_backend_service_info.py +++ b/plugins/modules/gcp_compute_region_backend_service_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_backend_service_info description: - Gather info for GCP RegionBackendService short_description: Gather info for GCP RegionBackendService -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - A reference to the region where the regional backend service resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -415,8 +416,9 @@ resources: healthChecks: description: - The set of URLs to HealthCheck resources for health checking this RegionBackendService. - Currently at most one health check can be specified, and a health check is - required. + Currently at most one health check can be specified. A health check must be + specified unless the backend service uses an internet or serverless NEG as + a backend. returned: success type: list id: @@ -655,7 +657,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -674,7 +676,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_disk.py b/plugins/modules/gcp_compute_region_disk.py index 459929a..cc240dc 100644 --- a/plugins/modules/gcp_compute_region_disk.py +++ b/plugins/modules/gcp_compute_region_disk.py @@ -43,7 +43,6 @@ description: - 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 @@ -195,6 +194,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -481,7 +481,7 @@ def update_fields(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}/disks/{name}/setLabels"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/setLabels"]).format(**module.params), {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, ) @@ -489,7 +489,7 @@ def label_fingerprint_update(module, request, response): def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/resize"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/resize"]).format(**module.params), {u'sizeGb': module.params.get('size_gb')}, ) @@ -527,11 +527,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -597,25 +597,25 @@ def response_to_hash(module, response): def zone_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/%s".format(**params) % name return name def region_disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*/diskTypes/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*/diskTypes/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/diskTypes/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/diskTypes/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_disk_info.py b/plugins/modules/gcp_compute_region_disk_info.py index e3112e2..fd45ea7 100644 --- a/plugins/modules/gcp_compute_region_disk_info.py +++ b/plugins/modules/gcp_compute_region_disk_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_disk_info description: - Gather info for GCP RegionDisk short_description: Gather info for GCP RegionDisk -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - A reference to the region where the disk resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -276,7 +277,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -295,7 +296,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_health_check.py b/plugins/modules/gcp_compute_region_health_check.py index 0a4832c..1dd49bf 100644 --- a/plugins/modules/gcp_compute_region_health_check.py +++ b/plugins/modules/gcp_compute_region_health_check.py @@ -41,7 +41,6 @@ description: successfully to some number of consecutive probes, it is marked healthy again and can receive new connections. short_description: Creates a GCP RegionHealthCheck -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -399,6 +398,49 @@ options: - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' required: false type: str + grpc_health_check: + description: + - A nested object resource. + required: false + type: dict + suboptions: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + required: false + type: int + port_name: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + required: false + type: str + port_specification: + description: + - 'Specifies how port is selected for health checking, can be one of the following + values: * `USE_FIXED_PORT`: The port number in `port` is used for health + checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for + each network endpoint is used for health checking. For other backends, the + port or named port specified in the Backend Service is used for health checking." + - If not specified, gRPC health check follows behavior specified in `port` + and `portName` fields. + - 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"' + required: false + type: str + grpc_service_name: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the + overall status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + required: false + type: str region: description: - The region where the regional health check resides. @@ -435,6 +477,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -796,6 +839,47 @@ http2HealthCheck: and `portName` fields. returned: success type: str +grpcHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + 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 + portSpecification: + description: + - 'Specifies how port is selected for health checking, can be one of the following + values: * `USE_FIXED_PORT`: The port number in `port` is used for health checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for each + network endpoint is used for health checking. For other backends, the port + or named port specified in the Backend Service is used for health checking." + - If not specified, gRPC health check follows behavior specified in `port` and + `portName` fields. + returned: success + type: str + grpcServiceName: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the overall + status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + returned: success + type: str region: description: - The region where the regional health check resides. @@ -895,6 +979,10 @@ def main(): port_specification=dict(type='str'), ), ), + grpc_health_check=dict( + type='dict', + options=dict(port=dict(type='int'), port_name=dict(type='str'), port_specification=dict(type='str'), grpc_service_name=dict(type='str')), + ), region=dict(type='str'), ) ) @@ -961,6 +1049,7 @@ def resource_to_request(module): u'tcpHealthCheck': RegionHealthCheckTcphealthcheck(module.params.get('tcp_health_check', {}), module).to_request(), u'sslHealthCheck': RegionHealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request(), u'http2HealthCheck': RegionHealthCheckHttp2healthcheck(module.params.get('http2_health_check', {}), module).to_request(), + u'grpcHealthCheck': RegionHealthCheckGrpchealthcheck(module.params.get('grpc_health_check', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -976,11 +1065,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -1040,22 +1129,23 @@ def response_to_hash(module, response): u'tcpHealthCheck': RegionHealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(), u'sslHealthCheck': RegionHealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response(), u'http2HealthCheck': RegionHealthCheckHttp2healthcheck(response.get(u'http2HealthCheck', {}), module).from_response(), + u'grpcHealthCheck': RegionHealthCheckGrpchealthcheck(response.get(u'grpcHealthCheck', {}), module).from_response(), } def region_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/.*" + url = r"https://compute.googleapis.com/compute/v1/projects/.*/regions/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) @@ -1258,5 +1348,34 @@ class RegionHealthCheckHttp2healthcheck(object): ) +class RegionHealthCheckGrpchealthcheck(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'port': self.request.get('port'), + u'portName': self.request.get('port_name'), + u'portSpecification': self.request.get('port_specification'), + u'grpcServiceName': self.request.get('grpc_service_name'), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'port': self.request.get(u'port'), + u'portName': self.request.get(u'portName'), + u'portSpecification': self.request.get(u'portSpecification'), + u'grpcServiceName': self.request.get(u'grpcServiceName'), + } + ) + + if __name__ == '__main__': main() diff --git a/plugins/modules/gcp_compute_region_health_check_info.py b/plugins/modules/gcp_compute_region_health_check_info.py index dd6c982..68ca955 100644 --- a/plugins/modules/gcp_compute_region_health_check_info.py +++ b/plugins/modules/gcp_compute_region_health_check_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_health_check_info description: - Gather info for GCP RegionHealthCheck short_description: Gather info for GCP RegionHealthCheck -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region where the regional health check resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -456,6 +457,49 @@ resources: and `portName` fields. returned: success type: str + grpcHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + port: + description: + - The port number for the health check request. Must be specified if portName + and portSpecification are not set or if port_specification is USE_FIXED_PORT. + Valid values are 1 through 65535. + 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 + portSpecification: + description: + - 'Specifies how port is selected for health checking, can be one of the + following values: * `USE_FIXED_PORT`: The port number in `port` is used + for health checking.' + - "* `USE_NAMED_PORT`: The `portName` is used for health checking." + - "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for + each network endpoint is used for health checking. For other backends, + the port or named port specified in the Backend Service is used for health + checking." + - If not specified, gRPC health check follows behavior specified in `port` + and `portName` fields. + returned: success + type: str + grpcServiceName: + description: + - 'The gRPC service name for the health check. The value of grpcServiceName + has the following meanings by convention: - Empty serviceName means the + overall status of all services at the backend.' + - "- Non-empty serviceName means the health of that gRPC service, as defined + by the owner of the service." + - The grpcServiceName can only be ASCII. + returned: success + type: str region: description: - The region where the regional health check resides. @@ -466,7 +510,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -485,7 +529,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/healthChecks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_instance_group_manager.py b/plugins/modules/gcp_compute_region_instance_group_manager.py index 5a09173..ed33f9d 100644 --- a/plugins/modules/gcp_compute_region_instance_group_manager.py +++ b/plugins/modules/gcp_compute_region_instance_group_manager.py @@ -38,7 +38,6 @@ description: 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 RegionInstanceGroupManager -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -173,6 +172,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -506,11 +506,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -574,7 +574,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_instance_group_manager_info.py b/plugins/modules/gcp_compute_region_instance_group_manager_info.py index f181835..ca4426f 100644 --- a/plugins/modules/gcp_compute_region_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_region_instance_group_manager_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_instance_group_manager_info description: - Gather info for GCP RegionInstanceGroupManager short_description: Gather info for GCP RegionInstanceGroupManager -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region the managed instance group resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -284,7 +285,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -303,7 +304,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/instanceGroupManagers".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_target_http_proxy.py b/plugins/modules/gcp_compute_region_target_http_proxy.py index 26a2d66..476e0da 100644 --- a/plugins/modules/gcp_compute_region_target_http_proxy.py +++ b/plugins/modules/gcp_compute_region_target_http_proxy.py @@ -34,7 +34,6 @@ description: - Represents a RegionTargetHttpProxy resource, which is used by one or more forwarding rules to route incoming HTTP requests to a URL map. short_description: Creates a GCP RegionTargetHttpProxy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -111,6 +110,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -305,7 +305,9 @@ def update_fields(module, request, response): def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpProxies/{name}/setUrlMap"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpProxies/{name}/setUrlMap"]).format( + **module.params + ), {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -337,11 +339,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -398,7 +400,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_target_http_proxy_info.py b/plugins/modules/gcp_compute_region_target_http_proxy_info.py index c25edd6..67c6ca2 100644 --- a/plugins/modules/gcp_compute_region_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_http_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_target_http_proxy_info description: - Gather info for GCP RegionTargetHttpProxy short_description: Gather info for GCP RegionTargetHttpProxy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region where the regional proxy resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -159,7 +160,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -178,7 +179,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_target_https_proxy.py b/plugins/modules/gcp_compute_region_target_https_proxy.py index 13fe846..995ae78 100644 --- a/plugins/modules/gcp_compute_region_target_https_proxy.py +++ b/plugins/modules/gcp_compute_region_target_https_proxy.py @@ -34,7 +34,6 @@ description: - Represents a RegionTargetHttpsProxy resource, which is used by one or more forwarding rules to route incoming HTTPS requests to a URL map. short_description: Creates a GCP RegionTargetHttpsProxy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -119,6 +118,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -361,7 +361,7 @@ def update_fields(module, request, response): def ssl_certificates_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpsProxies/{name}/setSslCertificates"]).format( + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpsProxies/{name}/setSslCertificates"]).format( **module.params ), {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, @@ -371,7 +371,9 @@ def ssl_certificates_update(module, request, response): def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpsProxies/{name}/setUrlMap"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/targetHttpsProxies/{name}/setUrlMap"]).format( + **module.params + ), {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -404,11 +406,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -466,7 +468,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_target_https_proxy_info.py b/plugins/modules/gcp_compute_region_target_https_proxy_info.py index 31068a5..5eaff7f 100644 --- a/plugins/modules/gcp_compute_region_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_https_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_target_https_proxy_info description: - Gather info for GCP RegionTargetHttpsProxy short_description: Gather info for GCP RegionTargetHttpsProxy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region where the regional proxy resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -166,7 +167,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -185,7 +186,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetHttpsProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_region_url_map.py b/plugins/modules/gcp_compute_region_url_map.py index 7dfc081..50c3086 100644 --- a/plugins/modules/gcp_compute_region_url_map.py +++ b/plugins/modules/gcp_compute_region_url_map.py @@ -34,7 +34,6 @@ 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. short_description: Creates a GCP RegionUrlMap -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -1622,6 +1621,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -3528,11 +3528,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -3594,7 +3594,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_region_url_map_info.py b/plugins/modules/gcp_compute_region_url_map_info.py index 82c2329..09ab7b0 100644 --- a/plugins/modules/gcp_compute_region_url_map_info.py +++ b/plugins/modules/gcp_compute_region_url_map_info.py @@ -33,7 +33,6 @@ module: gcp_compute_region_url_map_info description: - Gather info for GCP RegionUrlMap short_description: Gather info for GCP RegionUrlMap -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - A reference to the region where the url map resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1587,7 +1588,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -1606,7 +1607,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/urlMaps".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_reservation.py b/plugins/modules/gcp_compute_reservation.py index 101539f..82076d9 100644 --- a/plugins/modules/gcp_compute_reservation.py +++ b/plugins/modules/gcp_compute_reservation.py @@ -38,7 +38,6 @@ description: preemptible VMs, sole tenant nodes, or other services not listed above like Cloud SQL and Dataflow. short_description: Creates a GCP Reservation -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -181,6 +180,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -445,7 +445,7 @@ def update_fields(module, request, response): def specific_reservation_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/reservations/{name}/resize"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/reservations/{name}/resize"]).format(**module.params), {u'specificReservation': ReservationSpecificreservation(module.params.get('specific_reservation', {}), module).to_request()}, ) @@ -477,11 +477,11 @@ def fetch_resource(module, link, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations".format(**module.params) def return_if_object(module, response, allow_not_found=False): @@ -541,7 +541,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_reservation_info.py b/plugins/modules/gcp_compute_reservation_info.py index 23267d2..deb809d 100644 --- a/plugins/modules/gcp_compute_reservation_info.py +++ b/plugins/modules/gcp_compute_reservation_info.py @@ -33,7 +33,6 @@ module: gcp_compute_reservation_info description: - Gather info for GCP Reservation short_description: Gather info for GCP Reservation -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - The zone where the reservation is made. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -241,7 +242,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -260,7 +261,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/reservations".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_resource_policy.py b/plugins/modules/gcp_compute_resource_policy.py index f90f3d8..b9cc5f1 100644 --- a/plugins/modules/gcp_compute_resource_policy.py +++ b/plugins/modules/gcp_compute_resource_policy.py @@ -34,7 +34,6 @@ description: - A policy that can be attached to a resource to specify or schedule actions on that resource. short_description: Creates a GCP ResourcePolicy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -243,6 +242,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -561,11 +561,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -620,7 +620,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_resource_policy_info.py b/plugins/modules/gcp_compute_resource_policy_info.py index bb2e30e..6acd7d7 100644 --- a/plugins/modules/gcp_compute_resource_policy_info.py +++ b/plugins/modules/gcp_compute_resource_policy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_resource_policy_info description: - Gather info for GCP ResourcePolicy short_description: Gather info for GCP ResourcePolicy -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - Region where resource policy resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -279,7 +280,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -298,7 +299,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/resourcePolicies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_route.py b/plugins/modules/gcp_compute_route.py index 56c9571..4e01928 100644 --- a/plugins/modules/gcp_compute_route.py +++ b/plugins/modules/gcp_compute_route.py @@ -48,7 +48,6 @@ description: - A Route resource must have exactly one specification of either nextHopGateway, nextHopInstance, nextHopIp, nextHopVpnTunnel, or nextHopIlb. short_description: Creates a GCP Route -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -75,7 +74,6 @@ options: the resource. required: false type: str - version_added: '2.7' name: description: - Name of the resource. Provided by the client when the resource is created. The @@ -163,7 +161,6 @@ options: field to "{{ name-of-resource }}"' required: false type: dict - version_added: '2.10' project: description: - The Google Cloud Platform project to use. @@ -195,6 +192,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -435,11 +433,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/routes/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/routes/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/routes".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/routes".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -503,7 +501,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_route_info.py b/plugins/modules/gcp_compute_route_info.py index e46fd87..1436333 100644 --- a/plugins/modules/gcp_compute_route_info.py +++ b/plugins/modules/gcp_compute_route_info.py @@ -33,7 +33,6 @@ module: gcp_compute_route_info description: - Gather info for GCP Route short_description: Gather info for GCP Route -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -200,7 +201,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -219,7 +220,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/routes".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/routes".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_router.py b/plugins/modules/gcp_compute_router.py index cf876d9..4fd8030 100644 --- a/plugins/modules/gcp_compute_router.py +++ b/plugins/modules/gcp_compute_router.py @@ -33,7 +33,6 @@ module: gcp_compute_router description: - Represents a Router resource. short_description: Creates a GCP Router -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -160,6 +159,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -405,11 +405,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -467,7 +467,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_router_info.py b/plugins/modules/gcp_compute_router_info.py index f08d857..6b5e2f3 100644 --- a/plugins/modules/gcp_compute_router_info.py +++ b/plugins/modules/gcp_compute_router_info.py @@ -33,7 +33,6 @@ module: gcp_compute_router_info description: - Gather info for GCP Router short_description: Gather info for GCP Router -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - Region where the router resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -205,7 +206,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -224,7 +225,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_snapshot.py b/plugins/modules/gcp_compute_snapshot.py index e33d436..428bef0 100644 --- a/plugins/modules/gcp_compute_snapshot.py +++ b/plugins/modules/gcp_compute_snapshot.py @@ -41,7 +41,6 @@ description: faster and at a much lower cost than if you regularly created a full image of the disk. short_description: Creates a GCP Snapshot -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,12 @@ options: - An optional description of this resource. required: false type: str + storage_locations: + description: + - Cloud Storage bucket storage location of the snapshot (regional or multi-regional). + elements: str + required: false + type: list labels: description: - Labels to apply to this Snapshot. @@ -109,6 +114,12 @@ options: - The name of the encryption key that is stored in Google Cloud KMS. required: false type: str + kms_key_service_account: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + required: false + type: str source_disk_encryption_key: description: - The customer-supplied encryption key of the source snapshot. Required if the @@ -127,6 +138,12 @@ options: - The name of the encryption key that is stored in Google Cloud KMS. required: false type: str + kms_key_service_account: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + required: false + type: str project: description: - The Google Cloud Platform project to use. @@ -158,6 +175,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -240,6 +258,11 @@ storageBytes: is expected to change with snapshot creation/deletion. returned: success type: int +storageLocations: + description: + - Cloud Storage bucket storage location of the snapshot (regional or multi-regional). + returned: success + type: list licenses: description: - A list of public visible licenses that apply to this snapshot. This can be because @@ -292,6 +315,12 @@ snapshotEncryptionKey: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -310,6 +339,12 @@ sourceDiskEncryptionKey: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str ''' ################################################################################ @@ -341,11 +376,16 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), description=dict(type='str'), + storage_locations=dict(type='list', elements='str'), labels=dict(type='dict'), source_disk=dict(required=True, type='dict'), zone=dict(type='str'), - snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), - source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), + snapshot_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str')) + ), + source_disk_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str')) + ), ) ) @@ -398,7 +438,7 @@ def update_fields(module, request, response): def labels_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/snapshots/{name}/setLabels"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/snapshots/{name}/setLabels"]).format(**module.params), {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, ) @@ -415,6 +455,7 @@ def resource_to_request(module): u'zone': module.params.get('zone'), u'name': module.params.get('name'), u'description': module.params.get('description'), + u'storageLocations': module.params.get('storage_locations'), u'labels': module.params.get('labels'), } return_vals = {} @@ -431,16 +472,16 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/snapshots/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/snapshots/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/snapshots".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/snapshots".format(**module.params) def create_link(module): res = {'project': module.params['project'], 'zone': module.params['zone'], 'source_disk': replace_resource_dict(module.params['source_disk'], 'name')} - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{source_disk}/createSnapshot".format(**res) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{source_disk}/createSnapshot".format(**res) def return_if_object(module, response, kind, allow_not_found=False): @@ -492,6 +533,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'description': module.params.get('description'), u'storageBytes': response.get(u'storageBytes'), + u'storageLocations': response.get(u'storageLocations'), u'licenses': response.get(u'licenses'), u'labels': response.get(u'labels'), u'labelFingerprint': response.get(u'labelFingerprint'), @@ -501,16 +543,16 @@ def response_to_hash(module, response): def license_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1//projects/.*/global/licenses/.*" + url = r"https://compute.googleapis.com/compute/v1//projects/.*/global/licenses/.*" if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1//projects/{project}/global/licenses/%s".format(**params) % name + name = "https://compute.googleapis.com/compute/v1//projects/{project}/global/licenses/%s".format(**params) % name return name def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/" + url = "https://compute.googleapis.com/compute/v1/" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) @@ -551,10 +593,22 @@ class SnapshotSnapshotencryptionkey(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get('raw_key'), + u'kmsKeyName': self.request.get('kms_key_name'), + u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'), + } + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get(u'rawKey'), + u'kmsKeyName': self.request.get(u'kmsKeyName'), + u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'), + } + ) class SnapshotSourcediskencryptionkey(object): @@ -566,10 +620,22 @@ class SnapshotSourcediskencryptionkey(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get('raw_key'), + u'kmsKeyName': self.request.get('kms_key_name'), + u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'), + } + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) + return remove_nones_from_dict( + { + u'rawKey': self.request.get(u'rawKey'), + u'kmsKeyName': self.request.get(u'kmsKeyName'), + u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'), + } + ) if __name__ == '__main__': diff --git a/plugins/modules/gcp_compute_snapshot_info.py b/plugins/modules/gcp_compute_snapshot_info.py index cb75b48..88a12f3 100644 --- a/plugins/modules/gcp_compute_snapshot_info.py +++ b/plugins/modules/gcp_compute_snapshot_info.py @@ -33,7 +33,6 @@ module: gcp_compute_snapshot_info description: - Gather info for GCP Snapshot short_description: Gather info for GCP Snapshot -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -148,6 +149,11 @@ resources: number is expected to change with snapshot creation/deletion. returned: success type: int + storageLocations: + description: + - Cloud Storage bucket storage location of the snapshot (regional or multi-regional). + returned: success + type: list licenses: description: - A list of public visible licenses that apply to this snapshot. This can be @@ -201,6 +207,13 @@ resources: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS + key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the @@ -219,12 +232,19 @@ resources: - The name of the encryption key that is stored in Google Cloud KMS. returned: success type: str + kmsKeyServiceAccount: + description: + - The service account used for the encryption request for the given KMS + key. + - If absent, the Compute Engine Service Agent service account is used. + returned: success + type: str ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -243,7 +263,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/snapshots".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/snapshots".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_ssl_certificate.py b/plugins/modules/gcp_compute_ssl_certificate.py index b3fe270..dd87d0a 100644 --- a/plugins/modules/gcp_compute_ssl_certificate.py +++ b/plugins/modules/gcp_compute_ssl_certificate.py @@ -35,7 +35,6 @@ description: 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 @@ -108,6 +107,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -299,11 +299,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslCertificates/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslCertificates/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslCertificates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslCertificates".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -361,7 +361,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_ssl_certificate_info.py b/plugins/modules/gcp_compute_ssl_certificate_info.py index 59efe3c..748f671 100644 --- a/plugins/modules/gcp_compute_ssl_certificate_info.py +++ b/plugins/modules/gcp_compute_ssl_certificate_info.py @@ -33,7 +33,6 @@ module: gcp_compute_ssl_certificate_info description: - Gather info for GCP SslCertificate short_description: Gather info for GCP SslCertificate -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -154,7 +155,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -173,7 +174,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslCertificates".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslCertificates".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_ssl_policy.py b/plugins/modules/gcp_compute_ssl_policy.py index d24ad21..7004e19 100644 --- a/plugins/modules/gcp_compute_ssl_policy.py +++ b/plugins/modules/gcp_compute_ssl_policy.py @@ -34,7 +34,6 @@ 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. short_description: Creates a GCP SslPolicy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -118,6 +117,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -333,11 +333,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslPolicies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslPolicies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslPolicies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslPolicies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -399,7 +399,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_ssl_policy_info.py b/plugins/modules/gcp_compute_ssl_policy_info.py index 8bdbbe6..9104dac 100644 --- a/plugins/modules/gcp_compute_ssl_policy_info.py +++ b/plugins/modules/gcp_compute_ssl_policy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_ssl_policy_info description: - Gather info for GCP SslPolicy short_description: Gather info for GCP SslPolicy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -190,7 +191,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -209,7 +210,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslPolicies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/sslPolicies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_subnetwork.py b/plugins/modules/gcp_compute_subnetwork.py index 302fb94..c63ef6a 100644 --- a/plugins/modules/gcp_compute_subnetwork.py +++ b/plugins/modules/gcp_compute_subnetwork.py @@ -49,7 +49,6 @@ description: 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 @@ -107,7 +106,6 @@ options: elements: dict required: false type: list - version_added: '2.8' suboptions: range_name: description: @@ -166,6 +164,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -173,7 +172,7 @@ options: - This only alters the User Agent string for any API requests. type: str notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/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)' - for authentication, you can set service_account_file using the C(gcp_service_account_file) @@ -385,7 +384,9 @@ def update_fields(module, request, response): def ip_cidr_range_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange"]).format( + **module.params + ), {u'ipCidrRange': module.params.get('ip_cidr_range')}, ) @@ -393,7 +394,7 @@ def ip_cidr_range_update(module, request, response): def secondary_ip_ranges_update(module, request, response): auth = GcpSession(module, 'compute') auth.patch( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}"]).format(**module.params), {u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()}, ) @@ -401,7 +402,7 @@ def secondary_ip_ranges_update(module, request, response): def private_ip_google_access_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess"]).format( + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess"]).format( **module.params ), {u'privateIpGoogleAccess': module.params.get('private_ip_google_access')}, @@ -438,11 +439,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -504,7 +505,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_subnetwork_info.py b/plugins/modules/gcp_compute_subnetwork_info.py index 4f34e33..b0f5df5 100644 --- a/plugins/modules/gcp_compute_subnetwork_info.py +++ b/plugins/modules/gcp_compute_subnetwork_info.py @@ -33,7 +33,6 @@ module: gcp_compute_subnetwork_info description: - Gather info for GCP Subnetwork short_description: Gather info for GCP Subnetwork -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The GCP region for this subnetwork. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -204,7 +205,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -223,7 +224,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_http_proxy.py b/plugins/modules/gcp_compute_target_http_proxy.py index 6b784b4..71aac21 100644 --- a/plugins/modules/gcp_compute_target_http_proxy.py +++ b/plugins/modules/gcp_compute_target_http_proxy.py @@ -34,7 +34,6 @@ description: - 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 @@ -106,6 +105,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -292,7 +292,7 @@ def update_fields(module, request, response): def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpProxies/{name}/setUrlMap"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/targetHttpProxies/{name}/setUrlMap"]).format(**module.params), {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -323,11 +323,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -384,7 +384,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_http_proxy_info.py b/plugins/modules/gcp_compute_target_http_proxy_info.py index 6d66927..aa767cb 100644 --- a/plugins/modules/gcp_compute_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_target_http_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_http_proxy_info description: - Gather info for GCP TargetHttpProxy short_description: Gather info for GCP TargetHttpProxy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -148,7 +149,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -167,7 +168,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_https_proxy.py b/plugins/modules/gcp_compute_target_https_proxy.py index f7c2843..d45531c 100644 --- a/plugins/modules/gcp_compute_target_https_proxy.py +++ b/plugins/modules/gcp_compute_target_https_proxy.py @@ -34,7 +34,6 @@ description: - 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 @@ -73,7 +72,6 @@ options: - 'Some valid choices include: "NONE", "ENABLE", "DISABLE"' required: false type: str - version_added: '2.7' ssl_certificates: description: - A list of SslCertificate resources that are used to authenticate connections @@ -93,7 +91,6 @@ options: }}"' required: false type: dict - version_added: '2.8' url_map: description: - A reference to the UrlMap resource that defines the mapping from URL to the @@ -136,6 +133,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -388,7 +386,7 @@ def update_fields(module, request, response): def quic_override_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride"]).format(**module.params), {u'quicOverride': module.params.get('quic_override')}, ) @@ -396,7 +394,7 @@ def quic_override_update(module, request, response): def ssl_certificates_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setSslCertificates"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setSslCertificates"]).format(**module.params), {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, ) @@ -404,7 +402,7 @@ def ssl_certificates_update(module, request, response): def ssl_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy"]).format(**module.params), {u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')}, ) @@ -412,7 +410,7 @@ def ssl_policy_update(module, request, response): def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setUrlMap"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setUrlMap"]).format(**module.params), {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -446,11 +444,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -510,7 +508,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_https_proxy_info.py b/plugins/modules/gcp_compute_target_https_proxy_info.py index 62143ff..fb01605 100644 --- a/plugins/modules/gcp_compute_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_target_https_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_https_proxy_info description: - Gather info for GCP TargetHttpsProxy short_description: Gather info for GCP TargetHttpsProxy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -170,7 +171,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -189,7 +190,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_instance.py b/plugins/modules/gcp_compute_target_instance.py index 9b843b7..30de4a2 100644 --- a/plugins/modules/gcp_compute_target_instance.py +++ b/plugins/modules/gcp_compute_target_instance.py @@ -37,7 +37,6 @@ description: instance contains a single virtual machine instance that receives and handles traffic from the corresponding forwarding rules. short_description: Creates a GCP TargetInstance -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -123,6 +122,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -322,11 +322,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -383,7 +383,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_instance_info.py b/plugins/modules/gcp_compute_target_instance_info.py index 5ceb6d6..2d0fba7 100644 --- a/plugins/modules/gcp_compute_target_instance_info.py +++ b/plugins/modules/gcp_compute_target_instance_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_instance_info description: - Gather info for GCP TargetInstance short_description: Gather info for GCP TargetInstance -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str zone: description: - URL of the zone where the target instance resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -161,7 +162,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -180,7 +181,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/targetInstances".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_pool.py b/plugins/modules/gcp_compute_target_pool.py index c3c9ab8..06dadcd 100644 --- a/plugins/modules/gcp_compute_target_pool.py +++ b/plugins/modules/gcp_compute_target_pool.py @@ -33,7 +33,6 @@ module: gcp_compute_target_pool description: - 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 @@ -165,6 +164,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -386,11 +386,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -454,7 +454,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_pool_info.py b/plugins/modules/gcp_compute_target_pool_info.py index a89ce1b..c19532a 100644 --- a/plugins/modules/gcp_compute_target_pool_info.py +++ b/plugins/modules/gcp_compute_target_pool_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_pool_info description: - Gather info for GCP TargetPool short_description: Gather info for GCP TargetPool -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region where the target pool resides. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -207,7 +208,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -226,7 +227,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_ssl_proxy.py b/plugins/modules/gcp_compute_target_ssl_proxy.py index 029742f..8894c1e 100644 --- a/plugins/modules/gcp_compute_target_ssl_proxy.py +++ b/plugins/modules/gcp_compute_target_ssl_proxy.py @@ -34,7 +34,6 @@ description: - 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 @@ -100,7 +99,6 @@ options: }}"' required: false type: dict - version_added: '2.8' project: description: - The Google Cloud Platform project to use. @@ -132,6 +130,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -375,7 +374,7 @@ def update_fields(module, request, response): def proxy_header_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setProxyHeader"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setProxyHeader"]).format(**module.params), {u'proxyHeader': module.params.get('proxy_header')}, ) @@ -383,7 +382,7 @@ def proxy_header_update(module, request, response): 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), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setBackendService"]).format(**module.params), {u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')}, ) @@ -391,7 +390,7 @@ def service_update(module, request, response): 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), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setSslCertificates"]).format(**module.params), {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, ) @@ -399,7 +398,7 @@ def ssl_certificates_update(module, request, response): def ssl_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setSslPolicy"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setSslPolicy"]).format(**module.params), {u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')}, ) @@ -433,11 +432,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -497,7 +496,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_ssl_proxy_info.py b/plugins/modules/gcp_compute_target_ssl_proxy_info.py index a284961..29386a5 100644 --- a/plugins/modules/gcp_compute_target_ssl_proxy_info.py +++ b/plugins/modules/gcp_compute_target_ssl_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_ssl_proxy_info description: - Gather info for GCP TargetSslProxy short_description: Gather info for GCP TargetSslProxy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -166,7 +167,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -185,7 +186,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_tcp_proxy.py b/plugins/modules/gcp_compute_target_tcp_proxy.py index 52540e9..4e69308 100644 --- a/plugins/modules/gcp_compute_target_tcp_proxy.py +++ b/plugins/modules/gcp_compute_target_tcp_proxy.py @@ -34,7 +34,6 @@ description: - 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 @@ -111,6 +110,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -300,7 +300,7 @@ def update_fields(module, request, response): def proxy_header_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader"]).format(**module.params), {u'proxyHeader': module.params.get('proxy_header')}, ) @@ -308,7 +308,7 @@ def proxy_header_update(module, request, response): def service_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setBackendService"]).format(**module.params), + ''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setBackendService"]).format(**module.params), {u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')}, ) @@ -340,11 +340,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -402,7 +402,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_tcp_proxy_info.py b/plugins/modules/gcp_compute_target_tcp_proxy_info.py index 40e2ece..68b352c 100644 --- a/plugins/modules/gcp_compute_target_tcp_proxy_info.py +++ b/plugins/modules/gcp_compute_target_tcp_proxy_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_tcp_proxy_info description: - Gather info for GCP TargetTcpProxy short_description: Gather info for GCP TargetTcpProxy -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -152,7 +153,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -171,7 +172,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_target_vpn_gateway.py b/plugins/modules/gcp_compute_target_vpn_gateway.py index 52454b6..a176ef0 100644 --- a/plugins/modules/gcp_compute_target_vpn_gateway.py +++ b/plugins/modules/gcp_compute_target_vpn_gateway.py @@ -34,7 +34,6 @@ description: - 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 @@ -110,6 +109,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -303,11 +303,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -366,7 +366,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_target_vpn_gateway_info.py b/plugins/modules/gcp_compute_target_vpn_gateway_info.py index 2de42dc..1d56ffd 100644 --- a/plugins/modules/gcp_compute_target_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_target_vpn_gateway_info.py @@ -33,7 +33,6 @@ module: gcp_compute_target_vpn_gateway_info description: - Gather info for GCP TargetVpnGateway short_description: Gather info for GCP TargetVpnGateway -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region this gateway should sit in. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -169,7 +170,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -188,7 +189,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_url_map.py b/plugins/modules/gcp_compute_url_map.py index 8f0bc72..a597e3d 100644 --- a/plugins/modules/gcp_compute_url_map.py +++ b/plugins/modules/gcp_compute_url_map.py @@ -34,7 +34,6 @@ 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. short_description: Creates a GCP UrlMap -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -78,7 +77,6 @@ options: headerAction specified under pathMatcher. required: false type: dict - version_added: '2.10' suboptions: request_headers_to_add: description: @@ -224,7 +222,6 @@ options: in the UrlMap . required: false type: dict - version_added: '2.10' suboptions: request_headers_to_add: description: @@ -344,7 +341,6 @@ options: Only one of routeAction or urlRedirect must be set. required: false type: dict - version_added: '2.10' suboptions: cors_policy: description: @@ -724,7 +720,6 @@ options: must not be set. required: false type: dict - version_added: '2.10' suboptions: host_redirect: description: @@ -798,7 +793,6 @@ options: elements: dict required: false type: list - version_added: '2.10' suboptions: priority: description: @@ -1585,7 +1579,6 @@ options: defaultService or defaultRouteAction must not be set. required: false type: dict - version_added: '2.10' suboptions: host_redirect: description: @@ -1658,7 +1651,6 @@ options: - Only one of defaultRouteAction or defaultUrlRedirect must be set. required: false type: dict - version_added: '2.10' suboptions: weighted_backend_services: description: @@ -2089,7 +2081,6 @@ options: or defaultRouteAction must not be set. required: false type: dict - version_added: '2.10' suboptions: host_redirect: description: @@ -2159,7 +2150,6 @@ options: - Only one of defaultRouteAction or defaultUrlRedirect must be set. required: false type: dict - version_added: '2.10' suboptions: weighted_backend_services: description: @@ -2575,6 +2565,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -5558,11 +5549,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/urlMaps/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/urlMaps/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/urlMaps".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/urlMaps".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -5626,7 +5617,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/global/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_url_map_info.py b/plugins/modules/gcp_compute_url_map_info.py index 06e68d6..69df04d 100644 --- a/plugins/modules/gcp_compute_url_map_info.py +++ b/plugins/modules/gcp_compute_url_map_info.py @@ -33,7 +33,6 @@ module: gcp_compute_url_map_info description: - Gather info for GCP UrlMap short_description: Gather info for GCP UrlMap -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -77,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -2469,7 +2470,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -2488,7 +2489,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/global/urlMaps".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/urlMaps".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_compute_vpn_tunnel.py b/plugins/modules/gcp_compute_vpn_tunnel.py index 5377ce2..271c560 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel.py +++ b/plugins/modules/gcp_compute_vpn_tunnel.py @@ -33,7 +33,6 @@ module: gcp_compute_vpn_tunnel description: - VPN tunnel resource. short_description: Creates a GCP VpnTunnel -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -154,6 +153,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -414,11 +414,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): @@ -482,7 +482,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + url = "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) diff --git a/plugins/modules/gcp_compute_vpn_tunnel_info.py b/plugins/modules/gcp_compute_vpn_tunnel_info.py index 4077f3f..ce9f223 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel_info.py +++ b/plugins/modules/gcp_compute_vpn_tunnel_info.py @@ -33,7 +33,6 @@ module: gcp_compute_vpn_tunnel_info description: - Gather info for GCP VpnTunnel short_description: Gather info for GCP VpnTunnel -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,6 +45,7 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list + elements: str region: description: - The region where the tunnel is located. @@ -82,6 +82,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -202,7 +203,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -221,7 +222,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index 80a06ca..ee65a85 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -33,7 +33,6 @@ module: gcp_container_cluster description: - A Google Container Engine cluster. short_description: Creates a GCP Cluster -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -179,7 +178,6 @@ options: elements: dict required: false type: list - version_added: '2.9' suboptions: accelerator_count: description: @@ -197,14 +195,12 @@ options: If unspecified, the default disk type is 'pd-standard' . required: false type: str - version_added: '2.9' min_cpu_platform: description: - Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform. required: false type: str - version_added: '2.9' taints: description: - List of kubernetes taints to be applied to each node. @@ -213,7 +209,6 @@ options: elements: dict required: false type: list - version_added: '2.9' suboptions: key: description: @@ -237,7 +232,6 @@ options: - Shielded Instance options. required: false type: dict - version_added: '2.10' suboptions: enable_secure_boot: description: @@ -281,7 +275,6 @@ options: is issued. required: false type: dict - version_added: '2.9' suboptions: issue_client_certificate: description: @@ -318,7 +311,6 @@ options: - Configuration for a private cluster. required: false type: dict - version_added: '2.8' suboptions: enable_private_nodes: description: @@ -354,7 +346,6 @@ options: . required: false type: bool - version_added: '2.9' addons_config: description: - Configurations for the various addons available to run in the cluster. @@ -397,7 +388,6 @@ options: for the nodes. required: false type: dict - version_added: '2.9' suboptions: disabled: description: @@ -418,20 +408,17 @@ options: type: list aliases: - nodeLocations - version_added: '2.9' resource_labels: description: - The resource labels for the cluster to use to annotate any related Google Compute Engine resources. required: false type: dict - version_added: '2.9' legacy_abac: description: - Configuration for the legacy ABAC authorization mode. required: false type: dict - version_added: '2.9' suboptions: enabled: description: @@ -446,7 +433,6 @@ options: - Configuration options for the NetworkPolicy feature. required: false type: dict - version_added: '2.9' suboptions: provider: description: @@ -466,7 +452,6 @@ options: - Only honored if cluster created with IP Alias support. required: false type: dict - version_added: '2.9' suboptions: max_pods_per_node: description: @@ -478,7 +463,6 @@ options: - Configuration for controlling how IPs are allocated in the cluster. required: false type: dict - version_added: '2.9' suboptions: use_ip_aliases: description: @@ -553,13 +537,11 @@ options: when it was first created. The version can be upgraded over time. required: false type: str - version_added: '2.10' master_authorized_networks_config: description: - Configuration for controlling how IPs are allocated in the cluster. required: false type: dict - version_added: '2.10' suboptions: enabled: description: @@ -589,7 +571,6 @@ options: - Configuration for the BinaryAuthorization feature. required: false type: dict - version_added: '2.10' suboptions: enabled: description: @@ -603,7 +584,6 @@ options: type: str aliases: - zone - version_added: '2.8' kubectl_path: description: - The path that the kubectl config file will be written to. @@ -612,14 +592,12 @@ options: - This requires the PyYaml library. required: false type: str - version_added: '2.9' kubectl_context: description: - The name of the context for the kubectl config file. Will default to the cluster name. required: false type: str - version_added: '2.9' project: description: - The Google Cloud Platform project to use. @@ -651,6 +629,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -1717,9 +1696,7 @@ class Kubectl(object): return { 'apiVersion': 'v1', - 'clusters': [ - {'name': context, 'cluster': {'certificate-authority-data': str(self.fetch['masterAuth']['clusterCaCertificate']), 'server': endpoint,}} - ], + 'clusters': [{'name': context, 'cluster': {'certificate-authority-data': str(self.fetch['masterAuth']['clusterCaCertificate'])}}], 'contexts': [{'name': context, 'context': {'cluster': context, 'user': context}}], 'current-context': context, 'kind': 'Config', diff --git a/plugins/modules/gcp_container_cluster_info.py b/plugins/modules/gcp_container_cluster_info.py index 3581299..b906f19 100644 --- a/plugins/modules/gcp_container_cluster_info.py +++ b/plugins/modules/gcp_container_cluster_info.py @@ -33,7 +33,6 @@ module: gcp_container_cluster_info description: - Gather info for GCP Cluster short_description: Gather info for GCP Cluster -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +47,6 @@ options: aliases: - region - zone - version_added: '2.8' project: description: - The Google Cloud Platform project to use. @@ -80,6 +78,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -763,7 +762,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_container_node_pool.py b/plugins/modules/gcp_container_node_pool.py index af2c354..351428e 100644 --- a/plugins/modules/gcp_container_node_pool.py +++ b/plugins/modules/gcp_container_node_pool.py @@ -37,7 +37,6 @@ description: 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 @@ -158,7 +157,6 @@ options: elements: dict required: false type: list - version_added: '2.9' suboptions: accelerator_count: description: @@ -176,21 +174,18 @@ options: If unspecified, the default disk type is 'pd-standard' . required: false type: str - version_added: '2.9' min_cpu_platform: description: - Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform . required: false type: str - version_added: '2.9' taints: description: - List of kubernetes taints to be applied to each node. elements: dict required: false type: list - version_added: '2.9' suboptions: key: description: @@ -212,7 +207,6 @@ options: - Shielded Instance options. required: false type: dict - version_added: '2.10' suboptions: enable_secure_boot: description: @@ -243,7 +237,6 @@ options: - The version of the Kubernetes of this node. required: false type: str - version_added: '2.8' autoscaling: description: - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a @@ -300,7 +293,6 @@ options: on a node in the node pool. required: false type: dict - version_added: '2.9' suboptions: max_pods_per_node: description: @@ -313,7 +305,6 @@ options: elements: dict required: false type: list - version_added: '2.9' suboptions: code: description: @@ -340,7 +331,6 @@ options: aliases: - region - zone - version_added: '2.8' project: description: - The Google Cloud Platform project to use. @@ -372,6 +362,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_container_node_pool_info.py b/plugins/modules/gcp_container_node_pool_info.py index 8d2eb8c..e2bceab 100644 --- a/plugins/modules/gcp_container_node_pool_info.py +++ b/plugins/modules/gcp_container_node_pool_info.py @@ -33,7 +33,6 @@ module: gcp_container_node_pool_info description: - Gather info for GCP NodePool short_description: Gather info for GCP NodePool -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +47,6 @@ options: aliases: - region - zone - version_added: '2.8' cluster: description: - The cluster this node pool belongs to. @@ -90,6 +88,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -422,7 +421,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_dns_managed_zone.py b/plugins/modules/gcp_dns_managed_zone.py index 6ca0439..f12da7e 100644 --- a/plugins/modules/gcp_dns_managed_zone.py +++ b/plugins/modules/gcp_dns_managed_zone.py @@ -34,7 +34,6 @@ 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. short_description: Creates a GCP ManagedZone -version_added: '2.5' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -65,7 +64,6 @@ options: - DNSSEC configuration. required: false type: dict - version_added: '2.9' suboptions: kind: description: @@ -143,7 +141,6 @@ options: - A set of key/value label pairs to assign to this ManagedZone. required: false type: dict - version_added: '2.8' visibility: description: - 'The zone''s visibility: public zones are exposed to the Internet, while private @@ -152,14 +149,12 @@ options: required: false default: public type: str - version_added: '2.8' private_visibility_config: description: - For privately visible zones, the set of Virtual Private Cloud resources that the zone is visible from. required: false type: dict - version_added: '2.8' suboptions: networks: description: @@ -182,7 +177,6 @@ options: to. required: false type: dict - version_added: '2.10' suboptions: target_name_servers: description: @@ -213,7 +207,6 @@ options: The value of this field contains the network to peer with. required: false type: dict - version_added: '2.10' suboptions: target_network: description: @@ -259,6 +252,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -612,11 +606,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{name}".format(**module.params) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones/{name}".format(**module.params) def collection(module): - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_dns_managed_zone_info.py b/plugins/modules/gcp_dns_managed_zone_info.py index 1dc7178..401094b 100644 --- a/plugins/modules/gcp_dns_managed_zone_info.py +++ b/plugins/modules/gcp_dns_managed_zone_info.py @@ -33,7 +33,6 @@ module: gcp_dns_managed_zone_info description: - Gather info for GCP ManagedZone short_description: Gather info for GCP ManagedZone -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -44,6 +43,7 @@ options: description: - Restricts the list to return only zones with this domain name. type: list + elements: str project: description: - The Google Cloud Platform project to use. @@ -75,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -291,7 +292,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ @@ -310,7 +311,7 @@ def main(): def collection(module): - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) def fetch_list(module, link, query): diff --git a/plugins/modules/gcp_dns_resource_record_set.py b/plugins/modules/gcp_dns_resource_record_set.py index 4e0abfe..5718efc 100644 --- a/plugins/modules/gcp_dns_resource_record_set.py +++ b/plugins/modules/gcp_dns_resource_record_set.py @@ -37,7 +37,6 @@ description: - 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 @@ -113,6 +112,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -309,12 +309,12 @@ def self_link(module): 'name': module.params['name'], 'type': module.params['type'], } - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets?name={name}&type={type}".format(**res) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets?name={name}&type={type}".format(**res) def collection(module): res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_dns_resource_record_set_info.py b/plugins/modules/gcp_dns_resource_record_set_info.py index a63519c..45f3675 100644 --- a/plugins/modules/gcp_dns_resource_record_set_info.py +++ b/plugins/modules/gcp_dns_resource_record_set_info.py @@ -33,7 +33,6 @@ module: gcp_dns_resource_record_set_info description: - Gather info for GCP ResourceRecordSet short_description: Gather info for GCP ResourceRecordSet -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -78,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -144,7 +144,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json ################################################################################ @@ -164,7 +164,7 @@ def main(): def collection(module): res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) + return "https://dns.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) def fetch_list(module, link): diff --git a/plugins/modules/gcp_filestore_instance.py b/plugins/modules/gcp_filestore_instance.py index 350fe60..a327017 100644 --- a/plugins/modules/gcp_filestore_instance.py +++ b/plugins/modules/gcp_filestore_instance.py @@ -33,7 +33,6 @@ module: gcp_filestore_instance description: - A Google Cloud Filestore instance. short_description: Creates a GCP Instance -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -150,6 +149,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_filestore_instance_info.py b/plugins/modules/gcp_filestore_instance_info.py index 6c97d11..a5f7722 100644 --- a/plugins/modules/gcp_filestore_instance_info.py +++ b/plugins/modules/gcp_filestore_instance_info.py @@ -33,7 +33,6 @@ module: gcp_filestore_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -197,7 +197,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index 98a690d..9dd0c9c 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -33,7 +33,6 @@ module: gcp_iam_role description: - A role in the Identity and Access Management API . short_description: Creates a GCP Role -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -108,6 +107,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_iam_role_info.py b/plugins/modules/gcp_iam_role_info.py index 15172c9..c15a561 100644 --- a/plugins/modules/gcp_iam_role_info.py +++ b/plugins/modules/gcp_iam_role_info.py @@ -33,7 +33,6 @@ module: gcp_iam_role_info description: - Gather info for GCP Role short_description: Gather info for GCP Role -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -140,7 +140,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_iam_service_account.py b/plugins/modules/gcp_iam_service_account.py index ff0f290..bdbfd5a 100644 --- a/plugins/modules/gcp_iam_service_account.py +++ b/plugins/modules/gcp_iam_service_account.py @@ -33,7 +33,6 @@ module: gcp_iam_service_account description: - A service account in the Identity and Access Management API. short_description: Creates a GCP ServiceAccount -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -89,6 +88,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_iam_service_account_info.py b/plugins/modules/gcp_iam_service_account_info.py index 579fac7..d1898a4 100644 --- a/plugins/modules/gcp_iam_service_account_info.py +++ b/plugins/modules/gcp_iam_service_account_info.py @@ -33,7 +33,6 @@ module: gcp_iam_service_account_info description: - Gather info for GCP ServiceAccount short_description: Gather info for GCP ServiceAccount -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -139,7 +139,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_iam_service_account_key.py b/plugins/modules/gcp_iam_service_account_key.py index 3ed3fb9..53a9a90 100644 --- a/plugins/modules/gcp_iam_service_account_key.py +++ b/plugins/modules/gcp_iam_service_account_key.py @@ -33,7 +33,6 @@ module: gcp_iam_service_account_key description: - A service account in the Identity and Access Management API. short_description: Creates a GCP ServiceAccountKey -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -108,6 +107,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -198,7 +198,7 @@ path: # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict from ansible.module_utils._text import to_native import json import os diff --git a/plugins/modules/gcp_kms_crypto_key.py b/plugins/modules/gcp_kms_crypto_key.py index 2662e89..f22eb68 100644 --- a/plugins/modules/gcp_kms_crypto_key.py +++ b/plugins/modules/gcp_kms_crypto_key.py @@ -33,7 +33,6 @@ module: gcp_kms_crypto_key description: - A `CryptoKey` represents a logical key that can be used for cryptographic operations. short_description: Creates a GCP CryptoKey -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -131,6 +130,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_kms_crypto_key_info.py b/plugins/modules/gcp_kms_crypto_key_info.py index 1908c8b..3e7e131 100644 --- a/plugins/modules/gcp_kms_crypto_key_info.py +++ b/plugins/modules/gcp_kms_crypto_key_info.py @@ -33,7 +33,6 @@ module: gcp_kms_crypto_key_info description: - Gather info for GCP CryptoKey short_description: Gather info for GCP CryptoKey -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -77,6 +76,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -176,7 +176,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_kms_key_ring.py b/plugins/modules/gcp_kms_key_ring.py index 665881f..2043f66 100644 --- a/plugins/modules/gcp_kms_key_ring.py +++ b/plugins/modules/gcp_kms_key_ring.py @@ -33,7 +33,6 @@ module: gcp_kms_key_ring description: - A `KeyRing` is a toplevel logical grouping of `CryptoKeys`. short_description: Creates a GCP KeyRing -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -91,6 +90,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_kms_key_ring_info.py b/plugins/modules/gcp_kms_key_ring_info.py index c7bc16b..231e500 100644 --- a/plugins/modules/gcp_kms_key_ring_info.py +++ b/plugins/modules/gcp_kms_key_ring_info.py @@ -33,7 +33,6 @@ module: gcp_kms_key_ring_info description: - Gather info for GCP KeyRing short_description: Gather info for GCP KeyRing -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -78,6 +77,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -135,7 +135,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_logging_metric.py b/plugins/modules/gcp_logging_metric.py index f1d3c16..9a2f4b9 100644 --- a/plugins/modules/gcp_logging_metric.py +++ b/plugins/modules/gcp_logging_metric.py @@ -35,7 +35,6 @@ description: of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options. short_description: Creates a GCP Metric -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -258,6 +257,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_logging_metric_info.py b/plugins/modules/gcp_logging_metric_info.py index 6d34668..c00ef6d 100644 --- a/plugins/modules/gcp_logging_metric_info.py +++ b/plugins/modules/gcp_logging_metric_info.py @@ -33,7 +33,6 @@ module: gcp_logging_metric_info description: - Gather info for GCP Metric short_description: Gather info for GCP Metric -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -286,7 +286,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_mlengine_model.py b/plugins/modules/gcp_mlengine_model.py index 5d947bf..f657169 100644 --- a/plugins/modules/gcp_mlengine_model.py +++ b/plugins/modules/gcp_mlengine_model.py @@ -35,7 +35,6 @@ description: - A model can have multiple versions, each of which is a deployed, trained model ready to receive prediction requests. The model itself is just a container. short_description: Creates a GCP Model -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -126,6 +125,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_mlengine_model_info.py b/plugins/modules/gcp_mlengine_model_info.py index 8cb48a3..8aaa74a 100644 --- a/plugins/modules/gcp_mlengine_model_info.py +++ b/plugins/modules/gcp_mlengine_model_info.py @@ -33,7 +33,6 @@ module: gcp_mlengine_model_info description: - Gather info for GCP Model short_description: Gather info for GCP Model -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -153,7 +153,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_mlengine_version.py b/plugins/modules/gcp_mlengine_version.py index 8042d82..27ee91a 100644 --- a/plugins/modules/gcp_mlengine_version.py +++ b/plugins/modules/gcp_mlengine_version.py @@ -34,7 +34,6 @@ description: - Each version is a trained model deployed in the cloud, ready to handle prediction requests. A model can have multiple versions . short_description: Creates a GCP Version -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -189,6 +188,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_mlengine_version_info.py b/plugins/modules/gcp_mlengine_version_info.py index 1385382..440881c 100644 --- a/plugins/modules/gcp_mlengine_version_info.py +++ b/plugins/modules/gcp_mlengine_version_info.py @@ -33,7 +33,6 @@ module: gcp_mlengine_version_info description: - Gather info for GCP Version short_description: Gather info for GCP Version -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -81,6 +80,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -244,7 +244,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_pubsub_subscription.py b/plugins/modules/gcp_pubsub_subscription.py index c016a92..c9763c1 100644 --- a/plugins/modules/gcp_pubsub_subscription.py +++ b/plugins/modules/gcp_pubsub_subscription.py @@ -34,7 +34,6 @@ description: - 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 @@ -69,7 +68,6 @@ options: - A set of key/value label pairs to assign to this Subscription. required: false type: dict - version_added: '2.8' push_config: description: - If push delivery is used with this subscription, this field is used to configure @@ -84,7 +82,6 @@ options: header in the HTTP request for every pushed message. required: false type: dict - version_added: '2.10' suboptions: service_account_email: description: @@ -160,7 +157,6 @@ options: required: false default: 604800s type: str - version_added: '2.8' retain_acked_messages: description: - Indicates whether to retain acknowledged messages. If `true`, then messages @@ -168,7 +164,6 @@ options: until they fall out of the messageRetentionDuration window. required: false type: bool - version_added: '2.8' expiration_policy: description: - A policy that specifies the conditions for this subscription's expiration. @@ -179,7 +174,6 @@ options: value for expirationPolicy.ttl is 1 day. required: false type: dict - version_added: '2.9' suboptions: ttl: description: @@ -190,6 +184,14 @@ options: - Example - "3.5s". required: true type: str + filter: + description: + - The subscription only delivers the messages that match the filter. Pub/Sub automatically + acknowledges the messages that don't match the filter. You can filter messages + by their attributes. The maximum length of a filter is 256 bytes. After creating + the subscription, you can't modify the filter. + required: false + type: str dead_letter_policy: description: - A policy that specifies the conditions for dead lettering messages in this subscription. @@ -199,13 +201,12 @@ options: must have permission to Acknowledge() messages on this subscription. required: false type: dict - version_added: '2.10' suboptions: dead_letter_topic: description: - The name of the topic to which dead letter messages should be published. - Format is `projects/{project}/topics/{topic}`. - - The Cloud Pub/Sub service\naccount associated with the enclosing subscription's + - The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. - The operation will fail if the topic does not exist. @@ -226,6 +227,39 @@ options: - If this parameter is 0, a default value of 5 is used. required: false type: int + retry_policy: + description: + - A policy that specifies how Pub/Sub retries message delivery for this subscription. + - If not set, the default retry policy is applied. This generally implies that + messages will be retried as soon as possible for healthy subscribers. RetryPolicy + will be triggered on NACKs or acknowledgement deadline exceeded events for a + given message . + required: false + type: dict + suboptions: + minimum_backoff: + description: + - The minimum delay between consecutive deliveries of a given message. Value + should be between 0 and 600 seconds. Defaults to 10 seconds. + - 'A duration in seconds with up to nine fractional digits, terminated by + ''s''. Example: "3.5s".' + required: false + type: str + maximum_backoff: + description: + - 'The maximum delay between consecutive deliveries of a given message. Value + should be between 0 and 600 seconds. Defaults to 600 seconds. A duration + in seconds with up to nine fractional digits, terminated by ''s''. Example: + "3.5s".' + required: false + type: str + enable_message_ordering: + description: + - If `true`, messages published with the same orderingKey in PubsubMessage will + be delivered to the subscribers in the order in which they are received by the + Pub/Sub system. Otherwise, they may be delivered in any order. + required: false + type: bool project: description: - The Google Cloud Platform project to use. @@ -257,6 +291,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -429,6 +464,14 @@ expirationPolicy: - Example - "3.5s". returned: success type: str +filter: + description: + - The subscription only delivers the messages that match the filter. Pub/Sub automatically + acknowledges the messages that don't match the filter. You can filter messages + by their attributes. The maximum length of a filter is 256 bytes. After creating + the subscription, you can't modify the filter. + returned: success + type: str deadLetterPolicy: description: - A policy that specifies the conditions for dead lettering messages in this subscription. @@ -443,7 +486,7 @@ deadLetterPolicy: description: - The name of the topic to which dead letter messages should be published. - Format is `projects/{project}/topics/{topic}`. - - The Cloud Pub/Sub service\naccount associated with the enclosing subscription's + - The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. - The operation will fail if the topic does not exist. @@ -464,6 +507,38 @@ deadLetterPolicy: - If this parameter is 0, a default value of 5 is used. returned: success type: int +retryPolicy: + description: + - A policy that specifies how Pub/Sub retries message delivery for this subscription. + - If not set, the default retry policy is applied. This generally implies that messages + will be retried as soon as possible for healthy subscribers. RetryPolicy will + be triggered on NACKs or acknowledgement deadline exceeded events for a given + message . + returned: success + type: complex + contains: + minimumBackoff: + description: + - The minimum delay between consecutive deliveries of a given message. Value + should be between 0 and 600 seconds. Defaults to 10 seconds. + - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. + Example: "3.5s".' + returned: success + type: str + maximumBackoff: + description: + - 'The maximum delay between consecutive deliveries of a given message. Value + should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in + seconds with up to nine fractional digits, terminated by ''s''. Example: "3.5s".' + returned: success + type: str +enableMessageOrdering: + description: + - If `true`, messages published with the same orderingKey in PubsubMessage will + be delivered to the subscribers in the order in which they are received by the + Pub/Sub system. Otherwise, they may be delivered in any order. + returned: success + type: bool ''' ################################################################################ @@ -507,7 +582,10 @@ def main(): message_retention_duration=dict(default='604800s', type='str'), retain_acked_messages=dict(type='bool'), expiration_policy=dict(type='dict', options=dict(ttl=dict(required=True, type='str'))), + filter=dict(type='str'), dead_letter_policy=dict(type='dict', options=dict(dead_letter_topic=dict(type='str'), max_delivery_attempts=dict(type='int'))), + retry_policy=dict(type='dict', options=dict(minimum_backoff=dict(type='str'), maximum_backoff=dict(type='str'))), + enable_message_ordering=dict(type='bool'), ) ) @@ -570,6 +648,10 @@ def updateMask(request, response): update_mask.append('expirationPolicy') if request.get('deadLetterPolicy') != response.get('deadLetterPolicy'): update_mask.append('deadLetterPolicy') + if request.get('retryPolicy') != response.get('retryPolicy'): + update_mask.append('retryPolicy') + if request.get('enableMessageOrdering') != response.get('enableMessageOrdering'): + update_mask.append('enableMessageOrdering') return ','.join(update_mask) @@ -588,7 +670,10 @@ def resource_to_request(module): u'messageRetentionDuration': module.params.get('message_retention_duration'), u'retainAckedMessages': module.params.get('retain_acked_messages'), u'expirationPolicy': SubscriptionExpirationpolicy(module.params.get('expiration_policy', {}), module).to_request(), + u'filter': module.params.get('filter'), u'deadLetterPolicy': SubscriptionDeadletterpolicy(module.params.get('dead_letter_policy', {}), module).to_request(), + u'retryPolicy': SubscriptionRetrypolicy(module.params.get('retry_policy', {}), module).to_request(), + u'enableMessageOrdering': module.params.get('enable_message_ordering'), } return_vals = {} for k, v in request.items(): @@ -662,7 +747,10 @@ def response_to_hash(module, response): u'messageRetentionDuration': response.get(u'messageRetentionDuration'), u'retainAckedMessages': response.get(u'retainAckedMessages'), u'expirationPolicy': SubscriptionExpirationpolicy(response.get(u'expirationPolicy', {}), module).from_response(), + u'filter': module.params.get('filter'), u'deadLetterPolicy': SubscriptionDeadletterpolicy(response.get(u'deadLetterPolicy', {}), module).from_response(), + u'retryPolicy': SubscriptionRetrypolicy(response.get(u'retryPolicy', {}), module).from_response(), + u'enableMessageOrdering': response.get(u'enableMessageOrdering'), } @@ -770,5 +858,20 @@ class SubscriptionDeadletterpolicy(object): ) +class SubscriptionRetrypolicy(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({u'minimumBackoff': self.request.get('minimum_backoff'), u'maximumBackoff': self.request.get('maximum_backoff')}) + + def from_response(self): + return remove_nones_from_dict({u'minimumBackoff': self.request.get(u'minimumBackoff'), u'maximumBackoff': self.request.get(u'maximumBackoff')}) + + if __name__ == '__main__': main() diff --git a/plugins/modules/gcp_pubsub_subscription_info.py b/plugins/modules/gcp_pubsub_subscription_info.py index d29e3c7..1c162da 100644 --- a/plugins/modules/gcp_pubsub_subscription_info.py +++ b/plugins/modules/gcp_pubsub_subscription_info.py @@ -33,7 +33,6 @@ module: gcp_pubsub_subscription_info description: - Gather info for GCP Subscription short_description: Gather info for GCP Subscription -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -236,6 +236,14 @@ resources: - Example - "3.5s". returned: success type: str + filter: + description: + - The subscription only delivers the messages that match the filter. Pub/Sub + automatically acknowledges the messages that don't match the filter. You can + filter messages by their attributes. The maximum length of a filter is 256 + bytes. After creating the subscription, you can't modify the filter. + returned: success + type: str deadLetterPolicy: description: - A policy that specifies the conditions for dead lettering messages in this @@ -250,7 +258,7 @@ resources: description: - The name of the topic to which dead letter messages should be published. - Format is `projects/{project}/topics/{topic}`. - - The Cloud Pub/Sub service\naccount associated with the enclosing subscription's + - The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. - The operation will fail if the topic does not exist. @@ -271,12 +279,45 @@ resources: - If this parameter is 0, a default value of 5 is used. returned: success type: int + retryPolicy: + description: + - A policy that specifies how Pub/Sub retries message delivery for this subscription. + - If not set, the default retry policy is applied. This generally implies that + messages will be retried as soon as possible for healthy subscribers. RetryPolicy + will be triggered on NACKs or acknowledgement deadline exceeded events for + a given message . + returned: success + type: complex + contains: + minimumBackoff: + description: + - The minimum delay between consecutive deliveries of a given message. Value + should be between 0 and 600 seconds. Defaults to 10 seconds. + - 'A duration in seconds with up to nine fractional digits, terminated by + ''s''. Example: "3.5s".' + returned: success + type: str + maximumBackoff: + description: + - 'The maximum delay between consecutive deliveries of a given message. + Value should be between 0 and 600 seconds. Defaults to 600 seconds. A + duration in seconds with up to nine fractional digits, terminated by ''s''. + Example: "3.5s".' + returned: success + type: str + enableMessageOrdering: + description: + - If `true`, messages published with the same orderingKey in PubsubMessage will + be delivered to the subscribers in the order in which they are received by + the Pub/Sub system. Otherwise, they may be delivered in any order. + returned: success + type: bool ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_pubsub_topic.py b/plugins/modules/gcp_pubsub_topic.py index 5defd26..105fa41 100644 --- a/plugins/modules/gcp_pubsub_topic.py +++ b/plugins/modules/gcp_pubsub_topic.py @@ -33,7 +33,6 @@ module: gcp_pubsub_topic description: - 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 @@ -61,13 +60,11 @@ options: - The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*` . required: false type: str - version_added: '2.9' labels: description: - A set of key/value label pairs to assign to this Topic. required: false type: dict - version_added: '2.8' message_storage_policy: description: - Policy constraining the set of Google Cloud Platform regions where messages @@ -75,7 +72,6 @@ options: in effect. required: false type: dict - version_added: '2.9' suboptions: allowed_persistence_regions: description: @@ -118,6 +114,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_pubsub_topic_info.py b/plugins/modules/gcp_pubsub_topic_info.py index d0d70c8..dc628b7 100644 --- a/plugins/modules/gcp_pubsub_topic_info.py +++ b/plugins/modules/gcp_pubsub_topic_info.py @@ -33,7 +33,6 @@ module: gcp_pubsub_topic_info description: - Gather info for GCP Topic short_description: Gather info for GCP Topic -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -145,7 +145,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_redis_instance.py b/plugins/modules/gcp_redis_instance.py index 2eb25a8..a0ad0aa 100644 --- a/plugins/modules/gcp_redis_instance.py +++ b/plugins/modules/gcp_redis_instance.py @@ -33,7 +33,6 @@ module: gcp_redis_instance description: - A Google Cloud Redis instance. short_description: Creates a GCP Instance -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -68,7 +67,6 @@ options: required: false default: DIRECT_PEERING type: str - version_added: '2.10' display_name: description: - An arbitrary and optional user-provided name for the instance. @@ -165,6 +163,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -514,7 +513,7 @@ def response_to_hash(module, response): u'authorizedNetwork': module.params.get('authorized_network'), u'connectMode': module.params.get('connect_mode'), u'createTime': response.get(u'createTime'), - u'currentLocationId': module.params.get('current_location_id'), + u'currentLocationId': response.get(u'currentLocationId'), u'displayName': response.get(u'displayName'), u'host': response.get(u'host'), u'labels': response.get(u'labels'), diff --git a/plugins/modules/gcp_redis_instance_info.py b/plugins/modules/gcp_redis_instance_info.py index 92de1cb..c4d06ac 100644 --- a/plugins/modules/gcp_redis_instance_info.py +++ b/plugins/modules/gcp_redis_instance_info.py @@ -33,7 +33,6 @@ module: gcp_redis_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -230,7 +230,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index d0e579a..a9b0f5a 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -34,7 +34,6 @@ description: - Represents a GCP Project. A project is a container for ACLs, APIs, App Engine Apps, VMs, and other Google Cloud Platform resources. short_description: Creates a GCP Project -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -122,6 +121,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_resourcemanager_project_info.py b/plugins/modules/gcp_resourcemanager_project_info.py index 161d9fb..039071d 100644 --- a/plugins/modules/gcp_resourcemanager_project_info.py +++ b/plugins/modules/gcp_resourcemanager_project_info.py @@ -33,7 +33,6 @@ module: gcp_resourcemanager_project_info description: - Gather info for GCP Project short_description: Gather info for GCP Project -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -166,7 +166,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_runtimeconfig_config.py b/plugins/modules/gcp_runtimeconfig_config.py index 0d210be..20ae1eb 100644 --- a/plugins/modules/gcp_runtimeconfig_config.py +++ b/plugins/modules/gcp_runtimeconfig_config.py @@ -34,7 +34,6 @@ description: - A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig service. - A RuntimeConfig resource consists of metadata and a hierarchy of variables. short_description: Creates a GCP Config -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -90,6 +89,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_runtimeconfig_config_info.py b/plugins/modules/gcp_runtimeconfig_config_info.py index 38a5349..0adfe83 100644 --- a/plugins/modules/gcp_runtimeconfig_config_info.py +++ b/plugins/modules/gcp_runtimeconfig_config_info.py @@ -33,7 +33,6 @@ module: gcp_runtimeconfig_config_info description: - Gather info for GCP Config short_description: Gather info for GCP Config -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -119,7 +119,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_runtimeconfig_variable.py b/plugins/modules/gcp_runtimeconfig_variable.py index fa4c1f6..20460af 100644 --- a/plugins/modules/gcp_runtimeconfig_variable.py +++ b/plugins/modules/gcp_runtimeconfig_variable.py @@ -33,7 +33,6 @@ module: gcp_runtimeconfig_variable description: - Describes a single variable within a runtime config resource. short_description: Creates a GCP Variable -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -99,6 +98,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_runtimeconfig_variable_info.py b/plugins/modules/gcp_runtimeconfig_variable_info.py index d06e7ee..d97b6d2 100644 --- a/plugins/modules/gcp_runtimeconfig_variable_info.py +++ b/plugins/modules/gcp_runtimeconfig_variable_info.py @@ -33,7 +33,6 @@ module: gcp_runtimeconfig_variable_info description: - Gather info for GCP Variable short_description: Gather info for GCP Variable -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -135,7 +135,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_serviceusage_service.py b/plugins/modules/gcp_serviceusage_service.py index 5ec12a6..0bccc0e 100644 --- a/plugins/modules/gcp_serviceusage_service.py +++ b/plugins/modules/gcp_serviceusage_service.py @@ -33,7 +33,6 @@ module: gcp_serviceusage_service description: - A service that is available for use . short_description: Creates a GCP Service -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -90,6 +89,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_serviceusage_service_info.py b/plugins/modules/gcp_serviceusage_service_info.py index 291344e..5651384 100644 --- a/plugins/modules/gcp_serviceusage_service_info.py +++ b/plugins/modules/gcp_serviceusage_service_info.py @@ -33,7 +33,6 @@ module: gcp_serviceusage_service_info description: - Gather info for GCP Service short_description: Gather info for GCP Service -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -162,7 +162,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_sourcerepo_repository.py b/plugins/modules/gcp_sourcerepo_repository.py index 1fae597..052872d 100644 --- a/plugins/modules/gcp_sourcerepo_repository.py +++ b/plugins/modules/gcp_sourcerepo_repository.py @@ -33,7 +33,6 @@ module: gcp_sourcerepo_repository description: - A repository (or repo) is a Git repository storing versioned source content. short_description: Creates a GCP Repository -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -86,6 +85,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_sourcerepo_repository_info.py b/plugins/modules/gcp_sourcerepo_repository_info.py index 7f630b7..536b970 100644 --- a/plugins/modules/gcp_sourcerepo_repository_info.py +++ b/plugins/modules/gcp_sourcerepo_repository_info.py @@ -33,7 +33,6 @@ module: gcp_sourcerepo_repository_info description: - Gather info for GCP Repository short_description: Gather info for GCP Repository -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -126,7 +126,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_spanner_database.py b/plugins/modules/gcp_spanner_database.py index 333c7a7..7e0ffea 100644 --- a/plugins/modules/gcp_spanner_database.py +++ b/plugins/modules/gcp_spanner_database.py @@ -33,7 +33,6 @@ module: gcp_spanner_database description: - 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 @@ -104,6 +103,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -211,7 +211,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module)) + update(module, self_link(module), fetch) fetch = fetch_resource(module, self_link(module)) changed = True else: @@ -235,13 +235,26 @@ def create(module, link): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link): +def update(module, link, fetch): module.fail_json(msg="Spanner objects can't be updated to ensure data safety") +def update_fields(module, request, response): + if response.get('extraStatements') != request.get('extraStatements'): + extra_statements_update(module, request, response) + + +def extra_statements_update(module, request, response): + auth = GcpSession(module, 'spanner') + auth.patch( + ''.join(["https://spanner.googleapis.com/v1/", "projects/{project}/instances/{instance}/databases/{name}/ddl"]).format(**module.params), + {u'extraStatements': module.params.get('extra_statements')}, + ) + + def delete(module, link): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.delete(link)) + return wait_for_operation(module, auth.delete(link)) def resource_to_request(module): @@ -315,7 +328,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. 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': response.get(u'extraStatements')} def async_op_url(module, extra_data=None): diff --git a/plugins/modules/gcp_spanner_database_info.py b/plugins/modules/gcp_spanner_database_info.py index 223086b..fd6b760 100644 --- a/plugins/modules/gcp_spanner_database_info.py +++ b/plugins/modules/gcp_spanner_database_info.py @@ -33,7 +33,6 @@ module: gcp_spanner_database_info description: - Gather info for GCP Database short_description: Gather info for GCP Database -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -81,6 +80,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -139,7 +139,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_spanner_instance.py b/plugins/modules/gcp_spanner_instance.py index 3e2bdb0..268ecbf 100644 --- a/plugins/modules/gcp_spanner_instance.py +++ b/plugins/modules/gcp_spanner_instance.py @@ -33,7 +33,6 @@ module: gcp_spanner_instance description: - 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 @@ -113,6 +112,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_spanner_instance_info.py b/plugins/modules/gcp_spanner_instance_info.py index 35ae75b..abb5e8e 100644 --- a/plugins/modules/gcp_spanner_instance_info.py +++ b/plugins/modules/gcp_spanner_instance_info.py @@ -33,7 +33,6 @@ module: gcp_spanner_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -142,7 +142,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_sql_database.py b/plugins/modules/gcp_sql_database.py index 7242890..cad8e76 100644 --- a/plugins/modules/gcp_sql_database.py +++ b/plugins/modules/gcp_sql_database.py @@ -33,7 +33,6 @@ module: gcp_sql_database description: - 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 @@ -106,6 +105,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_sql_database_info.py b/plugins/modules/gcp_sql_database_info.py index a3a54cf..f832da3 100644 --- a/plugins/modules/gcp_sql_database_info.py +++ b/plugins/modules/gcp_sql_database_info.py @@ -33,7 +33,6 @@ module: gcp_sql_database_info description: - Gather info for GCP Database short_description: Gather info for GCP Database -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -142,7 +142,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_sql_instance.py b/plugins/modules/gcp_sql_instance.py index 8653644..b2504f1 100644 --- a/plugins/modules/gcp_sql_instance.py +++ b/plugins/modules/gcp_sql_instance.py @@ -35,7 +35,6 @@ description: Google's cloud. The Instances resource provides methods for common configuration and management tasks. short_description: Creates a GCP Instance -version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -229,7 +228,6 @@ options: elements: dict required: false type: list - version_added: '2.9' suboptions: name: description: @@ -331,13 +329,11 @@ options: single key value pair. required: false type: dict - version_added: '2.10' disk_encryption_configuration: description: - Disk encyption settings. required: false type: dict - version_added: '2.10' suboptions: kms_key_name: description: @@ -349,7 +345,6 @@ options: - Disk encyption status. required: false type: dict - version_added: '2.10' suboptions: kms_key_version_name: description: @@ -387,6 +382,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_sql_instance_info.py b/plugins/modules/gcp_sql_instance_info.py index c827494..7d336a1 100644 --- a/plugins/modules/gcp_sql_instance_info.py +++ b/plugins/modules/gcp_sql_instance_info.py @@ -33,7 +33,6 @@ module: gcp_sql_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -71,6 +70,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -497,7 +497,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_sql_ssl_cert.py b/plugins/modules/gcp_sql_ssl_cert.py index 3280a3d..45609be 100644 --- a/plugins/modules/gcp_sql_ssl_cert.py +++ b/plugins/modules/gcp_sql_ssl_cert.py @@ -36,7 +36,6 @@ description: Client Key can be downloaded only when the SSL certificate is created with the insert method. short_description: Creates a GCP SslCert -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -122,6 +121,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_sql_user.py b/plugins/modules/gcp_sql_user.py index d6fd728..50e5ed4 100644 --- a/plugins/modules/gcp_sql_user.py +++ b/plugins/modules/gcp_sql_user.py @@ -33,7 +33,6 @@ module: gcp_sql_user description: - 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 @@ -106,6 +105,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. diff --git a/plugins/modules/gcp_sql_user_info.py b/plugins/modules/gcp_sql_user_info.py index f2ddc6c..c0545a5 100644 --- a/plugins/modules/gcp_sql_user_info.py +++ b/plugins/modules/gcp_sql_user_info.py @@ -33,7 +33,6 @@ module: gcp_sql_user_info description: - Gather info for GCP User short_description: Gather info for GCP User -version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -81,6 +80,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -142,7 +142,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_storage_bucket.py b/plugins/modules/gcp_storage_bucket.py index 385843a..313bf22 100644 --- a/plugins/modules/gcp_storage_bucket.py +++ b/plugins/modules/gcp_storage_bucket.py @@ -38,7 +38,6 @@ description: manipulation of an existing bucket's access controls. - A bucket is always owned by the project team owners group. short_description: Creates a GCP Bucket -version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -150,14 +149,12 @@ options: to the bucket. required: false type: bool - version_added: '2.10' default_object_acl: description: - Default access controls to apply to new objects when no ACL is provided. elements: dict required: false type: list - version_added: '2.7' suboptions: bucket: description: @@ -252,7 +249,7 @@ options: description: - Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, - COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. + COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. elements: str required: false type: list @@ -313,11 +310,11 @@ options: - The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. - - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. - If this value is not specified when the bucket is created, it will default to - STANDARD. For more information, see storage classes. + - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, + and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket + is created, it will default to STANDARD. For more information, see storage classes. - 'Some valid choices include: "MULTI_REGIONAL", "REGIONAL", "STANDARD", "NEARLINE", - "COLDLINE", "DURABLE_REDUCED_AVAILABILITY"' + "COLDLINE", "ARCHIVE", "DURABLE_REDUCED_AVAILABILITY"' required: false type: str versioning: @@ -359,7 +356,6 @@ options: - Labels applied to this bucket. A list of key->value pairs. required: false type: dict - version_added: '2.10' project: description: - The Google Cloud Platform project to use. @@ -408,6 +404,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -662,7 +659,7 @@ lifecycle: description: - Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, - COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. + COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. returned: success type: list numNewerVersions: @@ -732,9 +729,9 @@ storageClass: - The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. - - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. - If this value is not specified when the bucket is created, it will default to - STANDARD. For more information, see storage classes. + - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, + and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket + is created, it will default to STANDARD. For more information, see storage classes. returned: success type: str timeCreated: @@ -980,11 +977,11 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/storage/v1/b/{name}?projection=full".format(**module.params) + return "https://storage.googleapis.com/storage/v1/b/{name}?projection=full".format(**module.params) def collection(module): - return "https://www.googleapis.com/storage/v1/b?project={project}".format(**module.params) + return "https://storage.googleapis.com/storage/v1/b?project={project}".format(**module.params) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_storage_bucket_access_control.py b/plugins/modules/gcp_storage_bucket_access_control.py index afd20c9..b3ea9bf 100644 --- a/plugins/modules/gcp_storage_bucket_access_control.py +++ b/plugins/modules/gcp_storage_bucket_access_control.py @@ -42,7 +42,6 @@ description: 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 @@ -114,6 +113,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -314,12 +314,12 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): res = {'bucket': replace_resource_dict(module.params['bucket'], 'name'), 'entity': module.params['entity']} - return "https://www.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**res) + return "https://storage.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**res) def collection(module): res = {'bucket': replace_resource_dict(module.params['bucket'], 'name')} - return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**res) + return "https://storage.googleapis.com/storage/v1/b/{bucket}/acl".format(**res) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_storage_default_object_acl.py b/plugins/modules/gcp_storage_default_object_acl.py index d1cedf9..e031654 100644 --- a/plugins/modules/gcp_storage_default_object_acl.py +++ b/plugins/modules/gcp_storage_default_object_acl.py @@ -43,7 +43,6 @@ description: - For more information, see Access Control, with the caveat that this API uses READER and OWNER instead of READ and FULL_CONTROL. short_description: Creates a GCP DefaultObjectACL -version_added: '2.10' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -118,6 +117,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -330,12 +330,12 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): res = {'bucket': replace_resource_dict(module.params['bucket'], 'name'), 'entity': module.params['entity']} - return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".format(**res) + return "https://storage.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".format(**res) def collection(module): res = {'bucket': replace_resource_dict(module.params['bucket'], 'name')} - return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl".format(**res) + return "https://storage.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl".format(**res) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/plugins/modules/gcp_tpu_node.py b/plugins/modules/gcp_tpu_node.py index 799ffa4..95d2335 100644 --- a/plugins/modules/gcp_tpu_node.py +++ b/plugins/modules/gcp_tpu_node.py @@ -33,7 +33,6 @@ module: gcp_tpu_node description: - A Cloud TPU instance. short_description: Creates a GCP Node -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -85,8 +84,18 @@ options: TPU node, the CIDR block conflicts with any subnetworks in the user's provided network, or the provided network is peered with another network that is using that CIDR block. - required: true + required: false type: str + use_service_networking: + description: + - Whether the VPC peering for the node is set up through Service Networking API. + - The VPC Peering should be set up before provisioning the node. If this field + is set, cidr_block field should not be specified. If the network that you want + to peer the TPU Node to is a Shared VPC network, the node must be created with + this this field enabled. + required: false + default: 'false' + type: bool scheduling_config: description: - Sets the scheduling options for this TPU instance. @@ -139,6 +148,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -146,7 +156,7 @@ options: - This only alters the User Agent string for any API requests. type: str notes: -- 'API Reference: U(https://cloud.google.com/tpu/docs/reference/rest/)' +- 'API Reference: U(https://cloud.google.com/tpu/docs/reference/rest/v1/projects.locations.nodes)' - 'Official Documentation: U(https://cloud.google.com/tpu/docs/)' - for authentication, you can set service_account_file using the C(gcp_service_account_file) env variable. @@ -220,6 +230,15 @@ serviceAccount: in the Node, this account must have permissions to that data. returned: success type: str +useServiceNetworking: + description: + - Whether the VPC peering for the node is set up through Service Networking API. + - The VPC Peering should be set up before provisioning the node. If this field is + set, cidr_block field should not be specified. If the network that you want to + peer the TPU Node to is a Shared VPC network, the node must be created with this + this field enabled. + returned: success + type: bool schedulingConfig: description: - Sets the scheduling options for this TPU instance. @@ -292,11 +311,13 @@ def main(): accelerator_type=dict(required=True, type='str'), tensorflow_version=dict(required=True, type='str'), network=dict(type='str'), - cidr_block=dict(required=True, type='str'), + cidr_block=dict(type='str'), + use_service_networking=dict(type='bool'), scheduling_config=dict(type='dict', options=dict(preemptible=dict(required=True, type='bool'))), labels=dict(type='dict'), zone=dict(required=True, type='str'), - ) + ), + mutually_exclusive=[['cidr_block', 'use_service_networking']], ) if not module.params['scopes']: @@ -365,6 +386,7 @@ def resource_to_request(module): u'tensorflowVersion': module.params.get('tensorflow_version'), u'network': module.params.get('network'), u'cidrBlock': module.params.get('cidr_block'), + u'useServiceNetworking': module.params.get('use_service_networking'), u'schedulingConfig': NodeSchedulingconfig(module.params.get('scheduling_config', {}), module).to_request(), u'labels': module.params.get('labels'), } @@ -443,6 +465,7 @@ def response_to_hash(module, response): u'network': module.params.get('network'), u'cidrBlock': module.params.get('cidr_block'), u'serviceAccount': response.get(u'serviceAccount'), + u'useServiceNetworking': module.params.get('use_service_networking'), u'schedulingConfig': NodeSchedulingconfig(module.params.get('scheduling_config', {}), module).to_request(), u'networkEndpoints': NodeNetworkendpointsArray(response.get(u'networkEndpoints', []), module).from_response(), u'labels': module.params.get('labels'), diff --git a/plugins/modules/gcp_tpu_node_info.py b/plugins/modules/gcp_tpu_node_info.py index b7f6fbf..4112966 100644 --- a/plugins/modules/gcp_tpu_node_info.py +++ b/plugins/modules/gcp_tpu_node_info.py @@ -33,7 +33,6 @@ module: gcp_tpu_node_info description: - Gather info for GCP Node short_description: Gather info for GCP Node -version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,6 +75,7 @@ options: description: - Array of scopes to be used type: list + elements: str env_type: description: - Specifies which Ansible environment you're running this module within. @@ -156,6 +156,16 @@ resources: job running in the Node, this account must have permissions to that data. returned: success type: str + useServiceNetworking: + description: + - Whether the VPC peering for the node is set up through Service Networking + API. + - The VPC Peering should be set up before provisioning the node. If this field + is set, cidr_block field should not be specified. If the network that you + want to peer the TPU Node to is a Shared VPC network, the node must be created + with this this field enabled. + returned: success + type: bool schedulingConfig: description: - Sets the scheduling options for this TPU instance. @@ -200,7 +210,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################