
    	                         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 ej                   G d	 d
ej                               Zy)z.List keyhandles within a project and location.    )absolute_import)division)unicode_literals)
list_pager)base)flags)resource_argsc                   &    e Zd ZdZed        Zd Zy)Lista3  List KeyHandle resources within a project and location.

  Lists all KeyHandle resources within a given project and location.
  Addtionally, can filter the list.

  ## EXAMPLES

  The following command lists a maximum of five KeyHandle resources in the
  location `global`:

    $ {command} --location=global --limit=5

  The following command lists all KeyHandle resources in the location `global`
  that have a resource type selector of `compute.googleapis.com/Instance`:

    $ {command} --location=global
    --resource-type=compute.googleapis.com/Instance
  c                     t        j                  | dd       t        j                  | d       | j                  j                  d       y )NTz
--locationz)table(name, kmsKey, resourceTypeSelector))r	   AddKmsLocationResourceArgForKMSr   AddResourceTypeSelectorFlagdisplay_info	AddFormat)parsers    #lib/surface/kms/key_handles/list.pyArgsz	List.Args1   s9    11&$M	%%fd3
!!"MN    c                 X   t        j                         }t        j                         }|j                  j                  j                         }d|j                   d}|j                  |j                         |      }t        j                  |j                  |d|j                  d      S )Nzresource_type_selector="")parentfilter
keyHandlespageSize)fieldlimitbatch_size_attribute)cloudkms_baseGetClientInstanceGetMessagesModuleCONCEPTSlocationParseresource_type.CloudkmsProjectsLocationsKeyHandlesListRequestRelativeNamer   YieldFromListprojects_locations_keyHandlesr   )selfargsclientmessageslocation_ref
filter_strrequests          r   RunzList.Run8   s    ,,.F..0H==))//1L+D,>,>+?qAJEE((*: F G ##,,jj' r   N)__name__
__module____qualname____doc__staticmethodr   r0    r   r   r   r      s"    & O Or   r   N)r4   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.cloudkmsr   r   googlecloudsdk.calliopegooglecloudsdk.command_lib.kmsr   r	   UniverseCompatibleListCommandr   r6   r   r   <module>r>      sI    5 &  ' ' A ( 0 8 ,4 , ,r   