
    2                     v    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ ddl
mZ dd	l
mZ d
 ZddZy)zFThis file provides the implementation of the `functions list` command.    )absolute_import)division)unicode_literals)
list_pager)util)log)
properties)	resourcesc           	   #     K   d }| D ]s  }t         j                  j                  |d|id      }t        j                  |j
                  |j                  |j                         |      |dd|      D ]  }	|	  u y	w)
a  Yield the functions from the given locations.

  Args:
    locations: List[str], list of gcp regions.
    project: str, Name of the API to modify. E.g. "cloudfunctions"
    limit: int, List messages limit.
    messages: module, Generated messages module.
    client: base_api.BaseApiClient, cloud functions client library.
    filter_exp: Filter expression in list functions request.

  Yields:
    protorpc.message.Message, The resources listed by the service.
  c                     | j                   r/t        j                  ddj                  | j                                t	        | |      S )NzThe following regions were fully or partially unreachable for query: %s
This could be due to permission setup. Additional informationcan be found in: https://cloud.google.com/functions/docs/troubleshootingz, )unreachabler   warningjoingetattr)message	attributes     ;lib/googlecloudsdk/command_lib/functions/v2/list/command.py_ReadAttrAndLogUnreachablez7_YieldFromLocations.<locals>._ReadAttrAndLogUnreachable-   s@    	kkH ))G''
(	 7I&&    
projectsIdz!cloudfunctions.projects.locations)params
collection)parentfilter	functionspageSize)servicerequestlimitfieldbatch_size_attributeget_field_funcN)r
   REGISTRYParser   YieldFromListprojects_locations_functions3CloudfunctionsProjectsLocationsFunctionsListRequestRelativeName)
	locationsprojectr   messagesclient
filter_expr   locationlocation_reffunctions
             r   _YieldFromLocationsr1      s     "' h%%++g&6 , L
 ,,33LL,,.z M 
 '1	 n	 s   A=A?Nc                 
   t        j                  |      }t        j                  |      }t        j                  j
                  j                  j                         }| j                  }t        | j                  |||||      S )zList Google Cloud Functions.)release_track)api_utilGetClientInstanceGetMessagesModuler	   VALUEScorer*   	GetOrFailr   r1   regions)argsr3   r-   r,   r+   r*   r   s          r   Runr<   N   si    %%MB&''mD(""**446'
**%	
llGUHfj
 r   )N)__doc__
__future__r   r   r   apitools.base.pyr   #googlecloudsdk.api_lib.functions.v2r   r4   googlecloudsdk.corer   r	   r
   r1   r<    r   r   <module>rC      s.    M &  ' ' @ # * )/d	r   