mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-06-03 23:49:10 -07:00
remove min_version from a bunch of fields that are in GA now
This commit is contained in:
parent
91dcd0d6f5
commit
f1a96adf23
111 changed files with 3604 additions and 3448 deletions
|
@ -139,7 +139,34 @@ options:
|
|||
set this network to a dictionary with the selfLink key where the value is the selfLink
|
||||
of your Network.'
|
||||
required: true
|
||||
ip_cidr_range:
|
||||
enable_flow_logs:
|
||||
description:
|
||||
- Whether to enable flow logging for this subnetwork.
|
||||
required: false
|
||||
type: bool
|
||||
version_added: 2.8
|
||||
secondary_ip_ranges:
|
||||
description:
|
||||
- An array of configurations for secondary IP ranges for VM instances contained in
|
||||
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
|
||||
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
|
||||
required: false
|
||||
version_added: 2.8
|
||||
suboptions:
|
||||
range_name:
|
||||
description:
|
||||
- The name associated with this subnetwork secondary range, used when adding an alias
|
||||
IP range to a VM instance. The name must be 1-63 characters long, and comply with
|
||||
RFC1035. The name must be unique within the subnetwork.
|
||||
required: true
|
||||
ip_cidr_range:
|
||||
description:
|
||||
- The range of IP addresses belonging to this subnetwork secondary range. Provide
|
||||
this property when you create the subnetwork.
|
||||
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
|
||||
within a network. Only IPv4 is supported.
|
||||
required: true
|
||||
private_ip_google_access:
|
||||
description:
|
||||
- The range of IP addresses belonging to this subnetwork secondary range.
|
||||
Provide this property when you create the subnetwork.
|
||||
|
@ -233,6 +260,40 @@ RETURN = '''
|
|||
- Only networks that are in the distributed mode can have subnetworks.
|
||||
returned: success
|
||||
type: dict
|
||||
enableFlowLogs:
|
||||
description:
|
||||
- Whether to enable flow logging for this subnetwork.
|
||||
returned: success
|
||||
type: bool
|
||||
fingerprint:
|
||||
description:
|
||||
- Fingerprint of this resource. This field is used internally during updates of this
|
||||
resource.
|
||||
returned: success
|
||||
type: str
|
||||
secondaryIpRanges:
|
||||
description:
|
||||
- An array of configurations for secondary IP ranges for VM instances contained in
|
||||
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
|
||||
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
rangeName:
|
||||
description:
|
||||
- The name associated with this subnetwork secondary range, used when adding an alias
|
||||
IP range to a VM instance. The name must be 1-63 characters long, and comply with
|
||||
RFC1035. The name must be unique within the subnetwork.
|
||||
returned: success
|
||||
type: str
|
||||
ipCidrRange:
|
||||
description:
|
||||
- The range of IP addresses belonging to this subnetwork secondary range. Provide
|
||||
this property when you create the subnetwork.
|
||||
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
|
||||
within a network. Only IPv4 is supported.
|
||||
returned: success
|
||||
type: str
|
||||
privateIpGoogleAccess:
|
||||
description:
|
||||
- Whether the VMs in this subnet can access Google services without assigned external
|
||||
|
@ -270,9 +331,10 @@ def main():
|
|||
name=dict(required=True, type='str'),
|
||||
network=dict(required=True, type='dict'),
|
||||
enable_flow_logs=dict(type='bool'),
|
||||
secondary_ip_ranges=dict(
|
||||
type='list', elements='dict', options=dict(range_name=dict(required=True, type='str'), ip_cidr_range=dict(required=True, type='str'))
|
||||
),
|
||||
secondary_ip_ranges=dict(type='list', elements='dict', options=dict(
|
||||
range_name=dict(required=True, type='str'),
|
||||
ip_cidr_range=dict(required=True, type='str')
|
||||
)),
|
||||
private_ip_google_access=dict(type='bool'),
|
||||
region=dict(required=True, type='str'),
|
||||
)
|
||||
|
@ -323,6 +385,8 @@ def update(module, link, kind, fetch):
|
|||
def update_fields(module, request, response):
|
||||
if response.get('ipCidrRange') != request.get('ipCidrRange'):
|
||||
ip_cidr_range_update(module, request, response)
|
||||
if response.get('enableFlowLogs') != request.get('enableFlowLogs') or response.get('secondaryIpRanges') != request.get('secondaryIpRanges'):
|
||||
enable_flow_logs_update(module, request, response)
|
||||
if response.get('privateIpGoogleAccess') != request.get('privateIpGoogleAccess'):
|
||||
private_ip_google_access_update(module, request, response)
|
||||
|
||||
|
@ -340,6 +404,21 @@ def ip_cidr_range_update(module, request, response):
|
|||
)
|
||||
|
||||
|
||||
def enable_flow_logs_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),
|
||||
{
|
||||
u'enableFlowLogs': module.params.get('enable_flow_logs'),
|
||||
u'fingerprint': response.get('fingerprint'),
|
||||
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def private_ip_google_access_update(module, request, response):
|
||||
auth = GcpSession(module, 'compute')
|
||||
auth.post(
|
||||
|
@ -366,7 +445,7 @@ def resource_to_request(module):
|
|||
u'name': module.params.get('name'),
|
||||
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
|
||||
u'enableFlowLogs': module.params.get('enable_flow_logs'),
|
||||
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
|
||||
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
|
||||
u'privateIpGoogleAccess': module.params.get('private_ip_google_access'),
|
||||
u'region': module.params.get('region'),
|
||||
}
|
||||
|
@ -443,7 +522,7 @@ def response_to_hash(module, response):
|
|||
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
|
||||
u'enableFlowLogs': response.get(u'enableFlowLogs'),
|
||||
u'fingerprint': response.get(u'fingerprint'),
|
||||
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
|
||||
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
|
||||
u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'),
|
||||
u'region': module.params.get('region'),
|
||||
}
|
||||
|
@ -484,7 +563,7 @@ def raise_if_errors(response, err_path, module):
|
|||
module.fail_json(msg=errors)
|
||||
|
||||
|
||||
class SubnetworkSecondaryiprangesArray(object):
|
||||
class SubnetworkSecondaryIpRangesArray(object):
|
||||
def __init__(self, request, module):
|
||||
self.module = module
|
||||
if request:
|
||||
|
@ -505,10 +584,16 @@ class SubnetworkSecondaryiprangesArray(object):
|
|||
return items
|
||||
|
||||
def _request_for_item(self, item):
|
||||
return remove_nones_from_dict({u'rangeName': item.get('range_name'), u'ipCidrRange': item.get('ip_cidr_range')})
|
||||
return remove_nones_from_dict({
|
||||
u'rangeName': item.get('range_name'),
|
||||
u'ipCidrRange': item.get('ip_cidr_range')
|
||||
})
|
||||
|
||||
def _response_from_item(self, item):
|
||||
return remove_nones_from_dict({u'rangeName': item.get(u'rangeName'), u'ipCidrRange': item.get(u'ipCidrRange')})
|
||||
return remove_nones_from_dict({
|
||||
u'rangeName': item.get(u'rangeName'),
|
||||
u'ipCidrRange': item.get(u'ipCidrRange')
|
||||
})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue