From 8013a6bde0471f445df84dfdb1bbd6786d2b17b6 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Wed, 16 Oct 2019 20:56:34 +0000 Subject: [PATCH] adding fields to compute#instance.accessConfigs[] Signed-off-by: Modular Magician --- plugins/modules/gcp_compute_instance.py | 76 +++++++++++++++++- plugins/modules/gcp_compute_instance_info.py | 22 ++++++ .../modules/gcp_compute_instance_template.py | 77 ++++++++++++++++++- .../gcp_compute_instance_template_info.py | 22 ++++++ 4 files changed, 191 insertions(+), 6 deletions(-) diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py index e5f58e9..286dfaa 100644 --- a/plugins/modules/gcp_compute_instance.py +++ b/plugins/modules/gcp_compute_instance.py @@ -309,6 +309,32 @@ options: - 'Some valid choices include: "ONE_TO_ONE_NAT"' required: true type: str + set_public_ptr: + description: + - Specifies whether a public DNS PTR record should be created to map 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 + configuration. If an AccessConfig is specified without a valid external + IP address, an ephemeral IP will be created with this networkTier. If + an AccessConfig with a valid external IP address is specified, it must + match that of the networkTier associated with the Address resource owning + that IP. + - '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 @@ -841,6 +867,27 @@ networkInterfaces: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str + setPublicPtr: + description: + - Specifies whether a public DNS PTR record should be created to map the + external IP address of the instance to a DNS domain name. + returned: success + type: bool + publicPtrDomainName: + description: + - The DNS domain name for the public PTR record. You can set this field + only if the setPublicPtr field is enabled. + returned: success + type: str + networkTier: + description: + - This signifies the networking tier used for configuring this access configuration. + If an AccessConfig is specified without a valid external IP address, an + ephemeral IP will be created with this networkTier. If an AccessConfig + with a valid external IP address is specified, it must match that of the + networkTier associated with the Address resource owning that IP. + returned: success + type: str aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified @@ -1069,7 +1116,14 @@ def main(): access_configs=dict( type='list', elements='dict', - options=dict(name=dict(required=True, type='str'), nat_ip=dict(type='dict'), type=dict(required=True, type='str')), + options=dict( + name=dict(required=True, type='str'), + nat_ip=dict(type='dict'), + type=dict(required=True, type='str'), + set_public_ptr=dict(type='bool'), + public_ptr_domain_name=dict(type='str'), + network_tier=dict(type='str'), + ), ), alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))), network=dict(type='dict'), @@ -1648,11 +1702,27 @@ class InstanceAccessconfigsArray(object): def _request_for_item(self, item): return remove_nones_from_dict( - {u'name': item.get('name'), u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), u'type': item.get('type')} + { + u'name': item.get('name'), + u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), + u'type': item.get('type'), + u'setPublicPtr': item.get('set_public_ptr'), + u'publicPtrDomainName': item.get('public_ptr_domain_name'), + u'networkTier': item.get('network_tier'), + } ) def _response_from_item(self, item): - return remove_nones_from_dict({u'name': item.get(u'name'), u'natIP': item.get(u'natIP'), u'type': item.get(u'type')}) + return remove_nones_from_dict( + { + u'name': item.get(u'name'), + u'natIP': item.get(u'natIP'), + u'type': item.get(u'type'), + u'setPublicPtr': item.get(u'setPublicPtr'), + u'publicPtrDomainName': item.get(u'publicPtrDomainName'), + u'networkTier': item.get(u'networkTier'), + } + ) class InstanceAliasiprangesArray(object): diff --git a/plugins/modules/gcp_compute_instance_info.py b/plugins/modules/gcp_compute_instance_info.py index 7f7d91d..3adf7f3 100644 --- a/plugins/modules/gcp_compute_instance_info.py +++ b/plugins/modules/gcp_compute_instance_info.py @@ -393,6 +393,28 @@ resources: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str + setPublicPtr: + description: + - Specifies whether a public DNS PTR record should be created to map + the external IP address of the instance to a DNS domain name. + returned: success + type: bool + publicPtrDomainName: + description: + - The DNS domain name for the public PTR record. You can set this field + only if the setPublicPtr field is enabled. + returned: success + type: str + networkTier: + description: + - This signifies the networking tier used for configuring this access + configuration. If an AccessConfig is specified without a valid external + IP address, an ephemeral IP will be created with this networkTier. + If an AccessConfig with a valid external IP address is specified, + it must match that of the networkTier associated with the Address + resource owning that IP. + returned: success + type: str aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified diff --git a/plugins/modules/gcp_compute_instance_template.py b/plugins/modules/gcp_compute_instance_template.py index dccb8b9..38bb071 100644 --- a/plugins/modules/gcp_compute_instance_template.py +++ b/plugins/modules/gcp_compute_instance_template.py @@ -316,6 +316,32 @@ options: - 'Some valid choices include: "ONE_TO_ONE_NAT"' required: true type: str + set_public_ptr: + description: + - Specifies whether a public DNS PTR record should be created to map + 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 + configuration. If an AccessConfig is specified without a valid external + IP address, an ephemeral IP will be created with this networkTier. + If an AccessConfig with a valid external IP address is specified, + it must match that of the networkTier associated with the Address + resource owning that IP. + - '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 @@ -792,6 +818,28 @@ properties: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str + setPublicPtr: + description: + - Specifies whether a public DNS PTR record should be created to map + the external IP address of the instance to a DNS domain name. + returned: success + type: bool + publicPtrDomainName: + description: + - The DNS domain name for the public PTR record. You can set this field + only if the setPublicPtr field is enabled. + returned: success + type: str + networkTier: + description: + - This signifies the networking tier used for configuring this access + configuration. If an AccessConfig is specified without a valid external + IP address, an ephemeral IP will be created with this networkTier. + If an AccessConfig with a valid external IP address is specified, + it must match that of the networkTier associated with the Address + resource owning that IP. + returned: success + type: str aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified @@ -987,7 +1035,14 @@ def main(): access_configs=dict( type='list', elements='dict', - options=dict(name=dict(required=True, type='str'), nat_ip=dict(type='dict'), type=dict(required=True, type='str')), + options=dict( + name=dict(required=True, type='str'), + nat_ip=dict(type='dict'), + type=dict(required=True, type='str'), + set_public_ptr=dict(type='bool'), + public_ptr_domain_name=dict(type='str'), + network_tier=dict(type='str'), + ), ), alias_ip_ranges=dict( type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str')) @@ -1490,11 +1545,27 @@ class InstanceTemplateAccessconfigsArray(object): def _request_for_item(self, item): return remove_nones_from_dict( - {u'name': item.get('name'), u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), u'type': item.get('type')} + { + u'name': item.get('name'), + u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), + u'type': item.get('type'), + u'setPublicPtr': item.get('set_public_ptr'), + u'publicPtrDomainName': item.get('public_ptr_domain_name'), + u'networkTier': item.get('network_tier'), + } ) def _response_from_item(self, item): - return remove_nones_from_dict({u'name': item.get(u'name'), u'natIP': item.get(u'natIP'), u'type': item.get(u'type')}) + return remove_nones_from_dict( + { + u'name': item.get(u'name'), + u'natIP': item.get(u'natIP'), + u'type': item.get(u'type'), + u'setPublicPtr': item.get(u'setPublicPtr'), + u'publicPtrDomainName': item.get(u'publicPtrDomainName'), + u'networkTier': item.get(u'networkTier'), + } + ) class InstanceTemplateAliasiprangesArray(object): diff --git a/plugins/modules/gcp_compute_instance_template_info.py b/plugins/modules/gcp_compute_instance_template_info.py index 4029468..20e22af 100644 --- a/plugins/modules/gcp_compute_instance_template_info.py +++ b/plugins/modules/gcp_compute_instance_template_info.py @@ -385,6 +385,28 @@ resources: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str + setPublicPtr: + description: + - Specifies whether a public DNS PTR record should be created to + map the external IP address of the instance to a DNS domain name. + returned: success + type: bool + publicPtrDomainName: + description: + - The DNS domain name for the public PTR record. You can set this + field only if the setPublicPtr field is enabled. + returned: success + type: str + networkTier: + description: + - This signifies the networking tier used for configuring this access + configuration. If an AccessConfig is specified without a valid + external IP address, an ephemeral IP will be created with this + networkTier. If an AccessConfig with a valid external IP address + is specified, it must match that of the networkTier associated + with the Address resource owning that IP. + returned: success + type: str aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be