Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Reverting some ResourceRef changes (#226)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and rambleraptor committed Sep 5, 2019
1 parent 7953047 commit bbaf1a7
Show file tree
Hide file tree
Showing 64 changed files with 423 additions and 379 deletions.
9 changes: 1 addition & 8 deletions plugins/module_utils/gcp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,9 @@ def replace_resource_dict(item, value):
else:
if not item:
return item
if isinstance(item, dict):
else:
return item.get(value)

# Item could be a string or a string representing a dictionary.
try:
new_item = ast.literal_eval(item)
return replace_resource_dict(new_item, value)
except ValueError:
return item


# Handles all authentication and HTTP sessions for GCP API calls.
class GcpSession(object):
Expand Down
11 changes: 6 additions & 5 deletions plugins/modules/gcp_compute_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}"'
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_subnetwork task and then set this subnetwork field to "{{ name-of-resource
}}"'
required: false
version_added: 2.7
region:
Expand Down Expand Up @@ -181,7 +182,7 @@
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
returned: success
type: str
type: dict
users:
description:
- The URLs of the resources that are using this address.
Expand Down Expand Up @@ -219,7 +220,7 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']),
subnetwork=dict(),
subnetwork=dict(type='dict'),
region=dict(required=True, type='str'),
)
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/gcp_compute_address_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes.
returned: success
type: str
type: dict
users:
description:
- The URLs of the resources that are using this address.
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/gcp_compute_backend_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
- When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService.
- 'This field represents a link to a InstanceGroup resource in GCP. It can
be specified in two ways. First, you can place in the selfLink of the resource
here as a string Alternatively, you can add `register: name-of-resource`
to a gcp_compute_instance_group task and then set this group field to "{{
name-of-resource }}"'
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_instance_group task and then set this
group field to "{{ name-of-resource }}"'
required: false
max_connections:
description:
Expand Down Expand Up @@ -401,7 +401,7 @@
- When the BackendService has load balancing scheme INTERNAL, the instance group
must be in a zone within the same region as the BackendService.
returned: success
type: str
type: dict
maxConnections:
description:
- The max number of simultaneous connections for the group. Can be used with
Expand Down Expand Up @@ -658,7 +658,7 @@ def main():
balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']),
capacity_scaler=dict(default=1.0, type='str'),
description=dict(type='str'),
group=dict(),
group=dict(type='dict'),
max_connections=dict(type='int'),
max_connections_per_instance=dict(type='int'),
max_rate=dict(type='int'),
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/gcp_compute_backend_service_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
- When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService.
returned: success
type: str
type: dict
maxConnections:
description:
- The max number of simultaneous connections for the group. Can be used
Expand Down
11 changes: 6 additions & 5 deletions plugins/modules/gcp_compute_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}"'
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_snapshot task and then set this source_snapshot field to "{{
name-of-resource }}"'
required: false
source_snapshot_encryption_key:
description:
Expand Down Expand Up @@ -374,7 +375,7 @@
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: str
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
Expand Down Expand Up @@ -441,7 +442,7 @@ def main():
zone=dict(required=True, type='str'),
source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
source_snapshot=dict(),
source_snapshot=dict(type='dict'),
source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
)
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/gcp_compute_disk_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: str
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
Expand Down
11 changes: 6 additions & 5 deletions plugins/modules/gcp_compute_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}"'
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
default:
selfLink: global/networks/default
Expand Down Expand Up @@ -341,7 +342,7 @@
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
returned: success
type: str
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
Expand Down Expand Up @@ -433,7 +434,7 @@ def main():
direction=dict(type='str', choices=['INGRESS', 'EGRESS']),
disabled=dict(type='bool'),
name=dict(required=True, type='str'),
network=dict(default=dict(selfLink='global/networks/default')),
network=dict(default=dict(selfLink='global/networks/default'), type='dict'),
priority=dict(default=1000, type='int'),
source_ranges=dict(type='list', elements='str'),
source_service_accounts=dict(type='list', elements='str'),
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/gcp_compute_firewall_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
networks/my-network projects/myproject/global/networks/my-network global/networks/default
.'
returned: success
type: str
type: dict
priority:
description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive.
Expand Down
45 changes: 24 additions & 21 deletions plugins/modules/gcp_compute_forwarding_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
- This is used for internal load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. First, you can place in the selfLink of the resource
here as a string Alternatively, you can add `register: name-of-resource` to
a gcp_compute_backend_service task and then set this backend_service field to
"{{ name-of-resource }}"'
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_backend_service task and then set this backend_service
field to "{{ name-of-resource }}"'
required: false
ip_version:
description:
Expand Down Expand Up @@ -135,9 +135,10 @@
specified, the default network will be used.
- This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network
task and then set this network field to "{{ name-of-resource }}"'
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
port_range:
description:
Expand Down Expand Up @@ -170,9 +171,10 @@
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork
task and then set this subnetwork field to "{{ name-of-resource }}"'
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_subnetwork task and then set this subnetwork field to "{{ name-of-resource
}}"'
required: false
target:
description:
Expand All @@ -183,9 +185,10 @@
target object.
- This field is not used for internal load balancing.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this target field to "{{ name-of-resource }}"'
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_target_pool task and then set this target field to "{{ name-of-resource
}}"'
required: false
version_added: 2.7
all_ports:
Expand Down Expand Up @@ -317,7 +320,7 @@
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: str
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
Expand Down Expand Up @@ -350,7 +353,7 @@
the default network will be used.
- This field is not used for external load balancing.
returned: success
type: str
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
Expand Down Expand Up @@ -383,7 +386,7 @@
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: str
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
Expand All @@ -393,7 +396,7 @@
target object.
- This field is not used for internal load balancing.
returned: success
type: str
type: dict
allPorts:
description:
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range`
Expand Down Expand Up @@ -456,15 +459,15 @@ def main():
description=dict(type='str'),
ip_address=dict(type='str'),
ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']),
backend_service=dict(),
backend_service=dict(type='dict'),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']),
name=dict(required=True, type='str'),
network=dict(),
network=dict(type='dict'),
port_range=dict(type='str'),
ports=dict(type='list', elements='str'),
subnetwork=dict(),
target=dict(),
subnetwork=dict(type='dict'),
target=dict(type='dict'),
all_ports=dict(type='bool'),
network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']),
service_label=dict(type='str'),
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/gcp_compute_forwarding_rule_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: str
type: dict
ipVersion:
description:
- The IP Version that will be used by this forwarding rule. Valid options are
Expand Down Expand Up @@ -156,7 +156,7 @@
specified, the default network will be used.
- This field is not used for external load balancing.
returned: success
type: str
type: dict
portRange:
description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
Expand Down Expand Up @@ -191,7 +191,7 @@
if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success
type: str
type: dict
target:
description:
- A reference to a TargetPool resource to receive the matched traffic.
Expand All @@ -201,7 +201,7 @@
to the target object.
- This field is not used for internal load balancing.
returned: success
type: str
type: dict
allPorts:
description:
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range`
Expand Down
Loading

0 comments on commit bbaf1a7

Please sign in to comment.