mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-23 11:21:22 -07:00
LIST method (to handle pagination) (#355)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
1c906b1c2c
commit
0c2b6efe52
61 changed files with 144 additions and 480 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue