Bug fixes for GCP modules (#58041)

This commit is contained in:
The Magician 2019-06-19 11:20:44 -07:00 committed by ansibot
parent 18feeb51a8
commit 8b6c6cf302
2 changed files with 78 additions and 0 deletions

View file

@ -72,6 +72,13 @@ options:
`IPV6`. The default value is `IPV4`.
- 'Some valid choices include: "IPV4", "IPV6"'
required: false
prefix_length:
description:
- The prefix length of the IP range. If not present, it means the address field
is a single IP address.
- This field is not applicable to addresses with addressType=EXTERNAL.
required: false
version_added: 2.9
address_type:
description:
- The type of the address to reserve, default is EXTERNAL.
@ -81,6 +88,26 @@ options:
required: false
default: EXTERNAL
version_added: 2.8
purpose:
description:
- The purpose of the resource. For global internal addresses it can be * VPC_PEERING
- for peer networks This should only be set when using an Internal address.
- 'Some valid choices include: "VPC_PEERING"'
required: false
version_added: 2.9
network:
description:
- The URL of the network in which to reserve the IP range. The IP range must be
in RFC1918 space. The network cannot be deleted if there are any reserved IP
ranges referring to it.
- This should only be set when using an Internal address.
- 'This field represents a link to a Network 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_network task and then set this network field to "{{ name-of-resource
}}"'
required: false
version_added: 2.9
extends_documentation_fragment: gcp
notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/globalAddresses)'
@ -139,6 +166,13 @@ region:
- A reference to the region where the regional address resides.
returned: success
type: str
prefixLength:
description:
- The prefix length of the IP range. If not present, it means the address field
is a single IP address.
- This field is not applicable to addresses with addressType=EXTERNAL.
returned: success
type: int
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
@ -146,6 +180,20 @@ addressType:
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
purpose:
description:
- The purpose of the resource. For global internal addresses it can be * VPC_PEERING
- for peer networks This should only be set when using an Internal address.
returned: success
type: str
network:
description:
- The URL of the network in which to reserve the IP range. The IP range must be
in RFC1918 space. The network cannot be deleted if there are any reserved IP ranges
referring to it.
- This should only be set when using an Internal address.
returned: success
type: dict
'''
################################################################################
@ -172,7 +220,10 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
ip_version=dict(type='str'),
prefix_length=dict(type='int'),
address_type=dict(default='EXTERNAL', type='str'),
purpose=dict(type='str'),
network=dict(type='dict'),
)
)
@ -229,7 +280,10 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'name': module.params.get('name'),
u'ipVersion': module.params.get('ip_version'),
u'prefixLength': module.params.get('prefix_length'),
u'addressType': module.params.get('address_type'),
u'purpose': module.params.get('purpose'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
}
return_vals = {}
for k, v in request.items():
@ -302,7 +356,10 @@ def response_to_hash(module, response):
u'name': response.get(u'name'),
u'ipVersion': response.get(u'ipVersion'),
u'region': response.get(u'region'),
u'prefixLength': response.get(u'prefixLength'),
u'addressType': response.get(u'addressType'),
u'purpose': response.get(u'purpose'),
u'network': response.get(u'network'),
}

View file

@ -107,6 +107,13 @@ resources:
- A reference to the region where the regional address resides.
returned: success
type: str
prefixLength:
description:
- The prefix length of the IP range. If not present, it means the address field
is a single IP address.
- This field is not applicable to addresses with addressType=EXTERNAL.
returned: success
type: int
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
@ -114,6 +121,20 @@ resources:
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
purpose:
description:
- The purpose of the resource. For global internal addresses it can be * VPC_PEERING
- for peer networks This should only be set when using an Internal address.
returned: success
type: str
network:
description:
- The URL of the network in which to reserve the IP range. The IP range must
be in RFC1918 space. The network cannot be deleted if there are any reserved
IP ranges referring to it.
- This should only be set when using an Internal address.
returned: success
type: dict
'''
################################################################################