
                            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  ej(                  ej*                  j,                         G d dej.                               Zy)z7List the root certificate authorities within a project.    )absolute_import)division)unicode_literals)
list_pager)base)resource_utils)common_args)
exceptions)response_utils)
text_utils)
propertiesc                   &    e Zd ZdZed        Zd Zy)Lista  List root certificate authorities.

  List the root certificate authorities within a project.

  ## EXAMPLES

  To list all root certificate authorities in a projects:

  $ {command}

  To list all root certificate authorities within a project and location
  'us-central1':

  $ {command} --location=us-central1

  To list all root certificate authorities within a CA Pool in location
  'us-central1':

  $ {command} --pool=my-pool --location=us-central1
  c                     t        j                  dd      j                  |        t        j                  dd      j                  |        t         j                  j	                  | d       t         j
                  j                  |        | j                  j                  d       | j                  j                  t        j                  t        j                  d       | j                  j                  t        j                  d	             y )
N
--locationzaLocation of the certificate authorities. If ommitted, root CAs across all regions will be listed.)helpz--poolzuID of the CA Pool where the certificate authorities reside. If ommitted, root CAs across all CA pools will be listed.d   a  
        table(
          name.basename(),
          name.scope().segment(-5):label=LOCATION,
          name.scope().segment(-3):label=POOL,
          state,
          state.regex("ENABLED","YES","NO"):label=INCLUDED_IN_POOL_ISSUANCE,
          ca_certificate_descriptions[0].subject_description.not_before_time():label=NOT_BEFORE,
          ca_certificate_descriptions[0].subject_description.not_after_time():label=NOT_AFTER)
        )not_before_timenot_after_timez;privateca.projects.locations.caPools.certificateAuthorities)r   ArgumentAddToParserPAGE_SIZE_FLAG
SetDefaultFILTER_FLAGRemoveFromParserdisplay_info	AddFormatAddTransformsr   TransformNotBeforeTimeTransformNotAfterTime
AddUriFuncr   MakeGetUriFunc)parsers    #lib/surface/privateca/roots/list.pyArgsz	List.Args8   s    MMp k&MM E k&""63/%%f-
!! 	# 	 %%%<<$::'  ""%%I	KL    c           	         t        j                  d      }t        j                  d      }|j                  d      r|j                  nd}|j                  d      r|j
                  nd}|dk(  r|dk7  rt        j                  dd      dj                  t        j                  j                  j                  j                         ||      }|j                  |d	t        j                   |j"                        
      }t%        j&                  |j(                  |d|j*                  d|j,                  t.        j0                        S )Nv1)api_versionlocation-poolr   zKIf a pool id is specified, you must also specify the location of that pool.z#projects/{}/locations/{}/caPools/{}ztype:SELF_SIGNED)parentfilterorderBycertificateAuthoritiespageSize)fieldlimitbatch_size_attribute
batch_sizeget_field_func)privateca_baseGetClientInstanceGetMessagesModuleIsSpecifiedr*   r,   r
   InvalidArgumentExceptionformatr   VALUEScoreproject	GetOrFailBPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesListRequestr	   ParseSortByArgsort_byr   YieldFromList1projects_locations_caPools_certificateAuthoritiesr3   	page_sizer   GetFieldAndLogUnreachable)selfargsclientmessagesr*   
ca_pool_idparent_resourcerequests           r$   RunzList.RunW   s   --$?F//DAH $ 0 0 <t}}#H"..v6CJ3:,//

W 
 <BB&&002HjJO YY!**4<<8 Z :G
 ##@@&jj'>>%??A Ar&   N)__name__
__module____qualname____doc__staticmethodr%   rO    r&   r$   r   r   !   s#    * L L<Ar&   r   N)rS   
__future__r   r   r   apitools.base.pyr    googlecloudsdk.api_lib.privatecar   r7   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.callioper
   $googlecloudsdk.command_lib.privatecar   r   googlecloudsdk.corer   ReleaseTracksReleaseTrackGAListCommandr   rU   r&   r$   <module>ra      sn    > &  ' ' C ; 3 ( . ? ; * D%%(()QA4 QA *QAr&   