mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-09 04:10:27 -07:00
Magic Modules changes.
This commit is contained in:
parent
66cfeb1147
commit
a940819003
1 changed files with 3 additions and 14 deletions
|
@ -437,11 +437,10 @@ def main():
|
||||||
if fetch:
|
if fetch:
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if is_different(module, fetch):
|
if is_different(module, fetch):
|
||||||
update(module, self_link(module), kind, fetch)
|
fetch = update(module, self_link(module), kind, fetch)
|
||||||
fetch = fetch_resource(module, self_link(module), kind)
|
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
delete(module, self_link(module), kind)
|
delete(module, self_link(module), kind, fetch)
|
||||||
fetch = {}
|
fetch = {}
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
@ -462,16 +461,6 @@ def create(module, link, kind):
|
||||||
|
|
||||||
|
|
||||||
def update(module, link, kind, fetch):
|
def update(module, link, kind, fetch):
|
||||||
update_fields(module, resource_to_request(module), response_to_hash(module, fetch))
|
|
||||||
return fetch_resource(module, self_link(module), kind)
|
|
||||||
|
|
||||||
|
|
||||||
def update_fields(module, request, response):
|
|
||||||
if response.get('target') != request.get('target'):
|
|
||||||
target_update(module, request, response)
|
|
||||||
|
|
||||||
|
|
||||||
def target_update(module, request, response):
|
|
||||||
auth = GcpSession(module, 'compute')
|
auth = GcpSession(module, 'compute')
|
||||||
auth.post(
|
auth.post(
|
||||||
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params),
|
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params),
|
||||||
|
@ -479,7 +468,7 @@ def target_update(module, request, response):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def delete(module, link, kind):
|
def delete(module, link, kind, fetch):
|
||||||
auth = GcpSession(module, 'compute')
|
auth = GcpSession(module, 'compute')
|
||||||
return wait_for_operation(module, auth.delete(link))
|
return wait_for_operation(module, auth.delete(link))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue