#NEWLINE# @ classmethod #NEWLINE# def _list( cls , client , filter_string = None , type_prefix = None ) : #NEWLINE# #INDENT# 'List all metric descriptors for the project.\n\n        :type client: :class:`gcloud.monitoring.client.Client`\n        :param client: The client to use.\n\n        :type filter_string: string or None\n        :param filter_string:\n            An optional filter expression describing the metric descriptors\n            to be returned. See the `filter documentation`_.\n\n        :type type_prefix: string or None\n        :param type_prefix: An optional prefix constraining the selected\n            metric types. This adds ``metric.type = starts_with("<prefix>")``\n            to the filter.\n\n        :rtype: list of :class:`MetricDescriptor`\n        :returns: A list of metric descriptor instances.\n\n        .. _filter documentation:\n            https://cloud.google.com/monitoring/api/v3/filters\n        ' #NEWLINE# path = '/projects/{project}/metricDescriptors/' . format ( project = client . project ) #NEWLINE# filters = [ ] #NEWLINE# if ( filter_string is not None ) : #NEWLINE# #INDENT# filters . append ( filter_string ) #NEWLINE# #UNINDENT# if ( type_prefix is not None ) : #NEWLINE# #INDENT# filters . append ( 'metric.type = starts_with("{prefix}")' . format ( prefix = type_prefix ) ) #NEWLINE# #UNINDENT# descriptors = [ ] #NEWLINE# page_token = None #NEWLINE# while True : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if filters : #NEWLINE# #INDENT# params [ 'filter' ] = ' AND ' . join ( filters ) #NEWLINE# #UNINDENT# if ( path is not None ) : #NEWLINE# #INDENT# params [ 'pageToken' ] = page_token #NEWLINE# #UNINDENT# response = client . connection . api_request ( method = 'GET' , path = path , query_params = params ) #NEWLINE# for info in response . get ( 'metricDescriptors' , ( ) ) : #NEWLINE# #INDENT# descriptors . append ( cls . _from_dict ( info ) ) #NEWLINE# #UNINDENT# page_token = response . get ( 'nextPageToken' ) #NEWLINE# if ( not page_token ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return descriptors