LIST method (to handle pagination) (#355)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-08-16 14:42:12 -07:00 committed by Alex Stephen
parent 1c906b1c2c
commit 0c2b6efe52
61 changed files with 144 additions and 480 deletions

View file

@ -391,12 +391,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
items = fetch_list(module, collection(module))
if items.get('items'):
items = items.get('items')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -406,8 +401,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'sql')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='items')
def return_if_object(module, response):