
                         X   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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dlmZ ddiZ ej:                  ej<                  j>                         G d dej@                               Z!y)z#List certificates within a project.    )absolute_import)division)unicode_literals)
list_pager)base)resource_utils)common_args)deps)filter_rewrite)resource_args)response_utils)
text_utils)concept_parsers)presentation_specs)log)resource_projection_specEXAMPLESa          To list all Certificates issued by a given Certificate Authority, run:

          $ {command} --issuer=my-ca --location=us-west1

        To list all Certificates issued by all Certificate Authorities in a
        location, run:

          $ {command} --location=us-west1

        You can omit the `--location` flag in both of the above examples if
        you've already set the ``privateca/location'' property. For example:

          $ {top_command} config set privateca/location us-west1
        +
          # The following is equivalent to the first example above.
          $ {command} --issuer=my-ca
        +
          # The following is equivalent to the second example above.
          $ {command}
        c                   &    e Zd ZdZed        Zd Zy)Lista  List certificates within a project.

  List certificates within a project. Note that listing certificates accross
  locations is not supported.

  ## EXAMPLES
  To list all Certificates issued by a given CA pool, run:

    $ {command} --issuer-pool=my-pool --location=us-west1

  To list all Certificates issued by all CA pools in a location, run:

    $ {command} --location=us-west1

  To list all Certificates issued directly under a CA, run:

    $ {command} --issuer-pool=my-pool --location=us-west1 \
        --filter="issuer_certificate_authority='projects/1234567890/locations/us-west1/caPools/my-pool/certificateAuthorities/my-ca'"

  You can omit the `--location` flag in both of the above examples if you've
  already set the ``privateca/location'' property. For example:

    $ {top_command} config set privateca/location us-west1
  +
    # The following is equivalent to the first example above.
    $ {command} --issuer-pool=my-pool
  +
    # The following is equivalent to the second example above.
    $ {command}
  c                    t        j                  t        j                  dt	        j
                  dt        j                  d ddd      g      dd	
      g      j                  |        t        j                  j                  | d       | j                  j                  d       | j                  j                  t        j                   t        j"                  d       | j                  j%                  t'        j(                  d             y )Nz--issuer-poolCA_POOLc                       y)N- r       *lib/surface/privateca/certificates/list.py<lambda>zList.Args.<locals>.<lambda>i   s    r   z.defaults to all CA pools in the given locationF)functionhintactiveplural)pool_id_fallthroughszrThe issuing CA pool. If this is omitted, Certificates issued by all CA pools in the given location will be listed.T)requiredd   a  
        table(
          name.basename(),
          name.scope().segment(-3):label=CA_POOL,
          name.scope().segment(-5):label=LOCATION,
          revocation_details.yesno(yes="REVOKED", no="ACTIVE"):label=REVOCATION_STATUS,
          certificate_description.subject_description.not_before_time():label=NOT_BEFORE,
          certificate_description.subject_description.not_after_time():label=NOT_AFTER)
        )not_before_timenot_after_timez1privateca.projects.locations.caPools.certificates)r   ConceptParserr   ResourcePresentationSpecr   CreateCaPoolResourceSpecr
   FallthroughAddToParserr   PAGE_SIZE_FLAG
SetDefaultdisplay_info	AddFormatAddTransformsr   TransformNotBeforeTimeTransformNotAfterTime
AddUriFuncr   MakeGetUriFunc)parsers    r   Argsz	List.Args`   s    !!3322$$!,/$$&&	' 	#   {6""63/
!! #  %%%<<$::'  ""%%?	ABr   c           	         t        j                  d      }t        j                  d      }|j                         }t	        j
                  |j                  |j                        }t        j                         j                  |j                  |      \  }}t        j                  d|j                  ||       ||_        |j                  j                  j!                         }|j#                  |j%                         t'        j(                  |j*                        |      }	t-        j.                  |j0                  |	d|j2                  d|j4                  t6        j8                  	      S )
Nv1)api_version)symbolsaliases)defaultsz6original_filter=%r, client_filter=%r, server_filter=%r)parentorderByfiltercertificatespageSize)fieldlimitbatch_size_attribute
batch_sizeget_field_func)privateca_baseGetClientInstanceGetMessagesModuleGetDisplayInfor   ProjectionSpec
transformsr;   r   BackendFilterRewriteRewriter?   r   infoCONCEPTSissuer_poolParse8PrivatecaProjectsLocationsCaPoolsCertificatesListRequestRelativeNamer	   ParseSortByArgsort_byr   YieldFromList'projects_locations_caPools_certificatesrC   	page_sizer   GetFieldAndLogUnreachable)
selfargsclientmessagesr.   r<   client_filterserver_filterr=   requests
             r   RunzList.Run   s5   --$?F//DAH&&(L'66''1E1EGH#1#F#F $gh  ( !M= HHE[[-8  DK]]&&,,.FOO""$**4<<8 P G
 ##66jj'>>%??A Ar   N)__name__
__module____qualname____doc__staticmethodr6   rb   r   r   r   r   r   ?   s$    > #B #BJAr   r   N)"rf   
__future__r   r   r   apitools.base.pyr    googlecloudsdk.api_lib.privatecar   rG   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.calliope googlecloudsdk.calliope.conceptsr
   $googlecloudsdk.command_lib.privatecar   r   r   r   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   googlecloudsdk.core.resourcer   _DETAILED_HELPReleaseTracksReleaseTrackGAListCommandr   r   r   r   <module>rw      s    * &  ' ' C ; 3 ( 1 ? > ? ; D G # A 	4 D%%(()aA4 aA *aAr   