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