From 21b14d95db06fc381a567ede3fa92c83cfdfd73a Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 21 Aug 2019 12:31:48 -0700 Subject: [PATCH] Bug fixes for GCP modules (#60995) --- .../gcp_compute_interconnect_attachment.py | 43 +++++++++++++++++++ ...cp_compute_interconnect_attachment_info.py | 16 +++++++ 2 files changed, 59 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 06fdd072984..ecac88da860 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -49,6 +49,13 @@ options: - absent default: present type: str + admin_enabled: + description: + - Whether the VLAN attachment is enabled or disabled. When using PARTNER type + this will Pre-Activate the interconnect attachment . + required: false + type: bool + version_added: 2.9 interconnect: description: - URL of the underlying Interconnect object that this attachment's traffic will @@ -61,6 +68,20 @@ options: - An optional description of this resource. required: false type: str + bandwidth: + description: + - Provisioned bandwidth capacity for the interconnect attachment. + - For attachments of type DEDICATED, the user can set the bandwidth. + - For attachments of type PARTNER, the Google Partner that is operating the interconnect + must set the bandwidth. + - Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED, Defaults + to BPS_10G . + - 'Some valid choices include: "BPS_50M", "BPS_100M", "BPS_200M", "BPS_300M", + "BPS_400M", "BPS_500M", "BPS_1G", "BPS_2G", "BPS_5G", "BPS_10G", "BPS_20G", + "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, @@ -140,6 +161,12 @@ EXAMPLES = ''' ''' RETURN = ''' +adminEnabled: + description: + - Whether the VLAN attachment is enabled or disabled. When using PARTNER type this + will Pre-Activate the interconnect attachment . + returned: success + type: bool cloudRouterIpAddress: description: - IPv4 address + prefix length to be configured on Cloud Router Interface for this @@ -163,6 +190,16 @@ description: - An optional description of this resource. returned: success type: str +bandwidth: + description: + - Provisioned bandwidth capacity for the interconnect attachment. + - For attachments of type DEDICATED, the user can set the bandwidth. + - For attachments of type PARTNER, the Google Partner that is operating the interconnect + must set the bandwidth. + - Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED, Defaults + to BPS_10G . + returned: success + type: str edgeAvailabilityDomain: description: - Desired availability domain for the attachment. Only available for type PARTNER, @@ -288,8 +325,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), + admin_enabled=dict(type='bool'), interconnect=dict(type='str'), description=dict(type='str'), + bandwidth=dict(type='str'), edge_availability_domain=dict(type='str'), type=dict(type='str'), router=dict(required=True, type='dict'), @@ -349,8 +388,10 @@ def delete(module, link, kind): def resource_to_request(module): request = { u'kind': 'compute#interconnectAttachment', + u'adminEnabled': module.params.get('admin_enabled'), u'interconnect': module.params.get('interconnect'), u'description': module.params.get('description'), + u'bandwidth': module.params.get('bandwidth'), u'edgeAvailabilityDomain': module.params.get('edge_availability_domain'), u'type': module.params.get('type'), u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), @@ -422,10 +463,12 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { + u'adminEnabled': response.get(u'adminEnabled'), u'cloudRouterIpAddress': response.get(u'cloudRouterIpAddress'), u'customerRouterIpAddress': response.get(u'customerRouterIpAddress'), u'interconnect': response.get(u'interconnect'), u'description': response.get(u'description'), + u'bandwidth': response.get(u'bandwidth'), u'edgeAvailabilityDomain': response.get(u'edgeAvailabilityDomain'), u'pairingKey': response.get(u'pairingKey'), u'partnerAsn': response.get(u'partnerAsn'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_info.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_info.py index 8ccb8aa919f..ff6c63e124c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_info.py @@ -73,6 +73,12 @@ resources: returned: always type: complex contains: + adminEnabled: + description: + - Whether the VLAN attachment is enabled or disabled. When using PARTNER type + this will Pre-Activate the interconnect attachment . + returned: success + type: bool cloudRouterIpAddress: description: - IPv4 address + prefix length to be configured on Cloud Router Interface for @@ -97,6 +103,16 @@ resources: - An optional description of this resource. returned: success type: str + bandwidth: + description: + - Provisioned bandwidth capacity for the interconnect attachment. + - For attachments of type DEDICATED, the user can set the bandwidth. + - For attachments of type PARTNER, the Google Partner that is operating the + interconnect must set the bandwidth. + - Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED, + Defaults to BPS_10G . + returned: success + type: str edgeAvailabilityDomain: description: - Desired availability domain for the attachment. Only available for type PARTNER,