
                            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)z>List the subordinate 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 subordinate certificate authorities.

  List the subordinate certificate authorities within a project.

  ## EXAMPLES

  To list all subordinate certificate authorities in a project:

  $ {command}

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

  $ {command} --location=us-central1

  To list all subordinate 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
--locationa  Location of the certificate authorities. If omitted, subordinate CAs across all regions will be listed. Note that, if it is populated, the privateca/location property will be used if this flag is not specified. To ignore this property, specify "-" as the location.)helpz--poolz{ID of the CA Pool where the certificate authorities reside. If omitted, subordinate 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/subordinates/list.pyArgsz	List.Args8   s    MM *k&1MMM F#""63/%%f-
!! 	# 	 %%%<<$::'  ""%%I	KL    c           	      8   t        j                  d      }t        j                  d      }t        j                  j
                  j                  j                         }|j                  d      r|j                  }n|r|j                  d      r|}nd}|j                  d      r|j                  nd}|dk(  r'|j                  d      rt        j                  dd      dj                  t        j                  j                  j                  j                         ||      }|j!                  |d	t#        j$                  |j&                        
      }t)        j*                  |j,                  |d|j.                  d|j0                  t2        j4                        S )Nv1)api_versionlocationpool-r   zKIf a pool id is specified, you must also specify the location of that pool.z#projects/{}/locations/{}/caPools/{}ztype:SUBORDINATE)parentfilterorderBycertificateAuthoritiespageSize)fieldlimitbatch_size_attribute
batch_sizeget_field_func)privateca_baseGetClientInstanceGetMessagesModuler   VALUES	privatecar*   GetIsSpecifiedr+   r
   InvalidArgumentExceptionformatcoreproject	GetOrFailBPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesListRequestr	   ParseSortByArgsort_byr   YieldFromList1projects_locations_caPools_certificateAuthoritiesr3   	page_sizer   GetFieldAndLogUnreachable)	selfargsclientmessageslocation_property_fallbackr*   
ca_pool_idparent_resourcerequests	            r$   RunzList.Run\   s^   --$?F//DAH!+!2!2!<!<!E!E!I!I!K
#h	#(8(8(@+hh"..v6CJ34++F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%   rR    r&   r$   r   r   !   s$    * !L !LF#Ar&   r   N)rV   
__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   rX   r&   r$   <module>rd      so    E &  ' ' C ; 3 ( . ? ; * D%%(()]A4 ]A *]Ar&   