|
|
|
@ -214,12 +214,7 @@ def main():
|
|
|
|
|
if not module.params['scopes']:
|
|
|
|
|
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']
|
|
|
|
|
|
|
|
|
|
items = fetch_list(module, collection(module), module.params['dns_name'])
|
|
|
|
|
if items.get('managedZones'):
|
|
|
|
|
items = items.get('managedZones')
|
|
|
|
|
else:
|
|
|
|
|
items = []
|
|
|
|
|
return_value = {'resources': items}
|
|
|
|
|
return_value = {'resources': fetch_list(module, collection(module), module.params['dns_name'])}
|
|
|
|
|
module.exit_json(**return_value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -229,8 +224,7 @@ def collection(module):
|
|
|
|
|
|
|
|
|
|
def fetch_list(module, link, query):
|
|
|
|
|
auth = GcpSession(module, 'dns')
|
|
|
|
|
response = auth.get(link, params={'dnsName': query})
|
|
|
|
|
return return_if_object(module, response)
|
|
|
|
|
return auth.list(link, return_if_object, array_name='managedZones', params={'dnsName': query})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def return_if_object(module, response):
|
|
|
|
|