|
|
@ -138,12 +138,7 @@ def main():
|
|
|
|
if not module.params['scopes']:
|
|
|
|
if not module.params['scopes']:
|
|
|
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
|
|
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
|
|
|
|
|
|
|
|
|
|
|
items = fetch_list(module, collection(module))
|
|
|
|
return_value = {'resources': fetch_list(module, collection(module))}
|
|
|
|
if items.get('projects'):
|
|
|
|
|
|
|
|
items = items.get('projects')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
items = []
|
|
|
|
|
|
|
|
return_value = {'resources': items}
|
|
|
|
|
|
|
|
module.exit_json(**return_value)
|
|
|
|
module.exit_json(**return_value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -153,8 +148,7 @@ def collection(module):
|
|
|
|
|
|
|
|
|
|
|
|
def fetch_list(module, link):
|
|
|
|
def fetch_list(module, link):
|
|
|
|
auth = GcpSession(module, 'resourcemanager')
|
|
|
|
auth = GcpSession(module, 'resourcemanager')
|
|
|
|
response = auth.get(link)
|
|
|
|
return auth.list(link, return_if_object, array_name='projects')
|
|
|
|
return return_if_object(module, response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def return_if_object(module, response):
|
|
|
|
def return_if_object(module, response):
|
|
|
|