Skip to content

Commit

Permalink
Inspec 1
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
slevenick authored and modular-magician committed Jan 2, 2020
1 parent c2c8faa commit c677857
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 45 deletions.
9 changes: 9 additions & 0 deletions plugins/modules/gcp_compute_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@
- The URLs of the resources that are using this address.
returned: success
type: list
status:
description:
- The status of the address, which can be one of RESERVING, RESERVED, or IN_USE.
- An address that is RESERVING is currently in the process of being reserved.
- A RESERVED address is currently reserved and available to use. An IN_USE address
is currently being used by another resource and is not available.
returned: success
type: str
region:
description:
- URL of the region where the regional address resides.
Expand Down Expand Up @@ -425,6 +433,7 @@ def response_to_hash(module, response):
u'networkTier': response.get(u'networkTier'),
u'subnetwork': response.get(u'subnetwork'),
u'users': response.get(u'users'),
u'status': response.get(u'status'),
}


Expand Down
8 changes: 8 additions & 0 deletions plugins/modules/gcp_compute_address_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@
- The URLs of the resources that are using this address.
returned: success
type: list
status:
description:
- The status of the address, which can be one of RESERVING, RESERVED, or IN_USE.
- An address that is RESERVING is currently in the process of being reserved.
- A RESERVED address is currently reserved and available to use. An IN_USE address
is currently being used by another resource and is not available.
returned: success
type: str
region:
description:
- URL of the region where the regional address resides.
Expand Down
60 changes: 28 additions & 32 deletions plugins/modules/gcp_compute_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,6 @@
required: false
type: bool
version_added: '2.8'
log_config:
description:
- This field denotes whether to enable logging for a particular firewall rule.
If logging is enabled, logs will be exported to Stackdriver.
required: false
type: dict
version_added: '2.10'
suboptions:
enable_logging:
description:
- This field denotes whether to enable logging for a particular firewall rule.
If logging is enabled, logs will be exported to Stackdriver.
required: false
type: bool
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
Expand Down Expand Up @@ -243,6 +229,18 @@
the specified network.
required: false
type: list
log_config:
description:
- A nested object resource.
required: false
type: dict
version_added: '2.10'
suboptions:
enable:
description:
- Whether logging is enabled for this firewall rule .
required: false
type: bool
project:
description:
- The Google Cloud Platform project to use.
Expand Down Expand Up @@ -394,19 +392,6 @@
rule will be enabled.
returned: success
type: bool
logConfig:
description:
- This field denotes whether to enable logging for a particular firewall rule. If
logging is enabled, logs will be exported to Stackdriver.
returned: success
type: complex
contains:
enableLogging:
description:
- This field denotes whether to enable logging for a particular firewall rule.
If logging is enabled, logs will be exported to Stackdriver.
returned: success
type: bool
id:
description:
- The unique identifier for the resource.
Expand Down Expand Up @@ -494,6 +479,17 @@
the specified network.
returned: success
type: list
logConfig:
description:
- A nested object resource.
returned: success
type: complex
contains:
enable:
description:
- Whether logging is enabled for this firewall rule .
returned: success
type: bool
'''

################################################################################
Expand Down Expand Up @@ -529,7 +525,6 @@ def main():
destination_ranges=dict(type='list', elements='str'),
direction=dict(type='str'),
disabled=dict(type='bool'),
log_config=dict(type='dict', options=dict(enable_logging=dict(type='bool'))),
name=dict(required=True, type='str'),
network=dict(default=dict(selfLink='global/networks/default'), type='dict'),
priority=dict(default=1000, type='int'),
Expand All @@ -538,6 +533,7 @@ def main():
source_tags=dict(type='list', elements='str'),
target_service_accounts=dict(type='list', elements='str'),
target_tags=dict(type='list', elements='str'),
log_config=dict(type='dict', options=dict(enable=dict(type='bool'))),
),
mutually_exclusive=[
['allowed', 'denied'],
Expand Down Expand Up @@ -605,7 +601,6 @@ def resource_to_request(module):
u'destinationRanges': module.params.get('destination_ranges'),
u'direction': module.params.get('direction'),
u'disabled': module.params.get('disabled'),
u'logConfig': FirewallLogconfig(module.params.get('log_config', {}), module).to_request(),
u'name': module.params.get('name'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'priority': module.params.get('priority'),
Expand All @@ -614,6 +609,7 @@ def resource_to_request(module):
u'sourceTags': module.params.get('source_tags'),
u'targetServiceAccounts': module.params.get('target_service_accounts'),
u'targetTags': module.params.get('target_tags'),
u'logConfig': FirewallLogconfig(module.params.get('log_config', {}), module).to_request(),
}
request = encode_request(request, module)
return_vals = {}
Expand Down Expand Up @@ -687,7 +683,6 @@ def response_to_hash(module, response):
u'destinationRanges': response.get(u'destinationRanges'),
u'direction': response.get(u'direction'),
u'disabled': response.get(u'disabled'),
u'logConfig': FirewallLogconfig(response.get(u'logConfig', {}), module).from_response(),
u'id': response.get(u'id'),
u'name': module.params.get('name'),
u'network': response.get(u'network'),
Expand All @@ -697,6 +692,7 @@ def response_to_hash(module, response):
u'sourceTags': response.get(u'sourceTags'),
u'targetServiceAccounts': response.get(u'targetServiceAccounts'),
u'targetTags': response.get(u'targetTags'),
u'logConfig': FirewallLogconfig(response.get(u'logConfig', {}), module).from_response(),
}


Expand Down Expand Up @@ -808,10 +804,10 @@ def __init__(self, request, module):
self.request = {}

def to_request(self):
return remove_nones_from_dict({u'enableLogging': self.request.get('enable_logging')})
return remove_nones_from_dict({u'enable': self.request.get('enable')})

def from_response(self):
return remove_nones_from_dict({u'enableLogging': self.request.get(u'enableLogging')})
return remove_nones_from_dict({u'enable': self.request.get(u'enable')})


if __name__ == '__main__':
Expand Down
24 changes: 11 additions & 13 deletions plugins/modules/gcp_compute_firewall_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,6 @@
firewall rule will be enabled.
returned: success
type: bool
logConfig:
description:
- This field denotes whether to enable logging for a particular firewall rule.
If logging is enabled, logs will be exported to Stackdriver.
returned: success
type: complex
contains:
enableLogging:
description:
- This field denotes whether to enable logging for a particular firewall
rule. If logging is enabled, logs will be exported to Stackdriver.
returned: success
type: bool
id:
description:
- The unique identifier for the resource.
Expand Down Expand Up @@ -294,6 +281,17 @@
on the specified network.
returned: success
type: list
logConfig:
description:
- A nested object resource.
returned: success
type: complex
contains:
enable:
description:
- Whether logging is enabled for this firewall rule .
returned: success
type: bool
'''

################################################################################
Expand Down
14 changes: 14 additions & 0 deletions plugins/modules/gcp_compute_instance_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
required: false
type: list
suboptions:
licenses:
description:
- Any applicable license URI.
required: false
type: list
version_added: '2.10'
auto_delete:
description:
- Specifies whether the disk will be auto-deleted when the instance is
Expand Down Expand Up @@ -600,6 +606,11 @@
returned: success
type: complex
contains:
licenses:
description:
- Any applicable license URI.
returned: success
type: list
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance is deleted
Expand Down Expand Up @@ -1002,6 +1013,7 @@ def main():
type='list',
elements='dict',
options=dict(
licenses=dict(type='list', elements='str'),
auto_delete=dict(type='bool'),
boot=dict(type='bool'),
device_name=dict(type='str'),
Expand Down Expand Up @@ -1358,6 +1370,7 @@ def from_response(self):
def _request_for_item(self, item):
return remove_nones_from_dict(
{
u'licenses': item.get('licenses'),
u'autoDelete': item.get('auto_delete'),
u'boot': item.get('boot'),
u'deviceName': item.get('device_name'),
Expand All @@ -1374,6 +1387,7 @@ def _request_for_item(self, item):
def _response_from_item(self, item):
return remove_nones_from_dict(
{
u'licenses': item.get(u'licenses'),
u'autoDelete': item.get(u'autoDelete'),
u'boot': item.get(u'boot'),
u'deviceName': item.get(u'deviceName'),
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/gcp_compute_instance_template_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@
returned: success
type: complex
contains:
licenses:
description:
- Any applicable license URI.
returned: success
type: list
autoDelete:
description:
- Specifies whether the disk will be auto-deleted when the instance
Expand Down

0 comments on commit c677857

Please sign in to comment.