
    \                     n    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  G d dej                        Z
y	)
zservices list command.    )absolute_import)division)unicode_literals)serviceusage)basec                   6    e Zd ZdZed        Zd Zed        Zy)Lista  List service quota metrics for a consumer.

  This command lists the service quota metrics for a consumer. The supported
  consumers can be projects, folders, or organizations.

  ## EXAMPLES

  To list the quota metrics for service 'example.googleapis.com' and consumer
  'projects/12321', run:

    $ {command} --service=example.googleapis.com --consumer=projects/12321

  To list the quota metrics for service 'example.googleapis.com' and consumer
  'projects/hello-world', run:

    $ {command} --service=example.googleapis.com --consumer=projects/helloworld

  To list the quota metrics for service 'example.googleapis.com' and consumer
  'folders/12345', run:

    $ {command} --service=example.googleapis.com --consumer=folders/12345

  To list the quota metrics for service 'example.googleapis.com' and consumer
  'organizations/54321', run:

    $ {command} --service=example.googleapis.com --consumer=organizations/54321
  c                 X    | j                  dddd       | j                  dddd       y	)
zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
    z	--serviceTSERVICEz The service to list metrics for.)requiredmetavarhelpz
--consumerCONSUMERz!The consumer to list metrics for.N)add_argument)parsers    "lib/surface/services/quota/list.pyArgsz	List.Args6   sD     /	  1 0	  2    c                     t        j                  |j                  |j                  |j                  |j
                        }|D cg c]  }| j                  |       c}S c c}w )zRun command.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      The list of quota metrics for the service and consumer.
    )r   ListQuotaMetricsconsumerservice	page_sizelimitdelete_resource_name)selfargsmetricsms       r   RunzList.RunJ   sQ     ++DMM4<<,0NNDJJHG29:'QD%%a(':::s   A c                 l    | j                  d       | j                  D ]  }|j                  d        | S )zDelete the name fields from metric message.

    Args:
      metric: The quota metric message.

    Returns:
      The updated metric message.
    name)resetconsumerQuotaLimits)metricls     r   r   zList.delete_resource_nameX   s0     LL''ggfo (Mr   N)__name__
__module____qualname____doc__staticmethodr   r    r    r   r   r	   r	      s4    8 2 2&;  r   r	   N)r*   
__future__r   r   r   googlecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   ListCommandr	   r,   r   r   <module>r1      s-     &  ' 8 (L4 Lr   