mirror of
				https://github.com/ansible-collections/google.cloud.git
				synced 2025-10-24 21:14:08 -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
				
			
		|  | @ -224,12 +224,7 @@ def main(): | |||
|     if not module.params['scopes']: | ||||
|         module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] | ||||
| 
 | ||||
|     items = fetch_list(module, collection(module), query_options(module.params['filters'])) | ||||
|     if items.get('items'): | ||||
|         items = items.get('items') | ||||
|     else: | ||||
|         items = [] | ||||
|     return_value = {'resources': items} | ||||
|     return_value = {'resources': fetch_list(module, collection(module), query_options(module.params['filters']))} | ||||
|     module.exit_json(**return_value) | ||||
| 
 | ||||
| 
 | ||||
|  | @ -239,8 +234,7 @@ def collection(module): | |||
| 
 | ||||
| def fetch_list(module, link, query): | ||||
|     auth = GcpSession(module, 'compute') | ||||
|     response = auth.get(link, params={'filter': query}) | ||||
|     return return_if_object(module, response) | ||||
|     return auth.list(link, return_if_object, array_name='items', params={'filter': query}) | ||||
| 
 | ||||
| 
 | ||||
| def query_options(filters): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue