
    A)                        S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r
  SSKJr  SS	KJr  SS	KJr  SS
KJr  SSSS.rSrSrSrSrSrSrSrSr " S S\R4                  5      r\R8                  " \R:                  R<                  5      \R>                   " S S\R@                  5      5       5       r!\R8                  " \R:                  RD                  5      \R>                   " S S\R@                  5      5       5       r#g)z!Command to list shared templates.    )absolute_import)division)unicode_literalsN)shared_templates)utils)base)
exceptions)
propertiesz'List shared templates in a given space.a           To list all shared templates in space `my-space`, project `my-project` and location `us-central1`, run:

          $ {command} --space=my-space --project=my-project --location=us-central1

        Or run:

          $ {command} --space=projects/my-project/locations/us-central1/spaces/my-space

        To list all shared templates from the Google Catalog in location `us-central1`, run:

          $ {command} --google-catalog --location=us-central1

        To filter and list shared templates that contain a `my-shared-template` prefix in the display name in space `my-space`, project `my-project` and location `us-central1`, run:

          $ {command} --space=my-space --project=my-project --location=us-central1 --filter="displayName:my-shared-template*"

        To list up to 10 shared templates in space `my-space`, project `my-project` and location `us-central1`, run:

          $ {command} --space=my-space --project=my-project --location=us-central1 --limit=10
        z         This command uses the designcenter/v1alpha API. The full documentation for
        this API can be found at:
        http://cloud.google.com/application-design-center/docs
        )DESCRIPTIONEXAMPLESzAPI REFERENCEzSpace resource - The parent space for which shared templates are listed in the following format: projects/$project/locations/$location/spaces/$space The following arguments in this group can be used to specify the attributes of this resource.zThe location id of the space resource.

To set the location attribute:
  * provide the argument `--space` on the command line with a fully specified name;
  * provide the argument `--location` on the command line.zThe project id of the space resource.

To set the project attribute:
  * provide the argument `--space` on the command line with a fully specified name;
  * provide the argument `--project` on the command line;
  * set the property `core/project`.zID of the space or fully qualified identifier for the space.

To set the space attribute:
  * provide the argument `--space` on the command line.zIf provided, lists all shared template from the Google Catalog. This sets the project to "gcpdesigncenter" and space to "googlespace".zError parsing [space].aW  The [space] resource is not properly specified.
Failed to find attribute [location]. [location] must be specified unless using full resource name for [space]. The attribute can be set in the following ways:
- provide the argument `--space` on the command line with a fully specified name
- provide the argument `--location` on the command linea  The [space] resource is not properly specified.
Failed to find attribute [project]. [project] must be specified unless using --google-catalog, a full resource name, or the core/project property is set. The attribute can be set in the following ways:
- provide the argument `space` on the command line with a fully specified name
- provide the argument `--project` on the command line
- set the property `core/project`c                       \ rS rSrSrSrg)SpaceResourceErrorx   z0Exception for errors related to Space resources. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       9lib/surface/design_center/spaces/shared_templates/list.pyr   r   x   s    8r   r   c                   B    \ rS rSrSr\r\S 5       r\S 5       r	S r
Srg)List|   List shared templates.c                    U R                  S[        S9nUR                  SS[        S9  UR	                  S5      nUR                  S[
        S9  UR                  S	S[        S9  U R                  S
S[        S9  U R                  R                  S5        U R                  R                  [        R                  " S[        R                  R                  S95        gz Register flags for this command.T)requiredhelpz--google-catalog
store_true)actionr    z=Specify --project and/or --space for custom shared templates.z	--project)r    z--spacez
--locationFyamlz6designcenter.projects.locations.spaces.sharedTemplatesrelease_trackN)add_mutually_exclusive_group_REQUIRED_FLAGS_BASE_TEXTadd_argument_GOOGLE_CATALOG_HELP_TEXTadd_argument_group_PROJECT_HELP_TEXT_SPACE_HELP_TEXT_LOCATION_HELP_TEXTdisplay_info	AddFormat
AddUriFuncapi_lib_utilsMakeGetUriFuncr   ReleaseTrackALPHAparsergroupproject_space_groups      r   Args	List.Args   s     //& 0 E 
&  
  22G $$ %  $$ % 
    
 !!&)
""$$D++11	
r   c                 b    [         R                  " S5      n[        UR                  U 5      5      $ zValidates the space name.z,^projects/[^/]+/locations/[^/]+/spaces/[^/]+recompileboolmatchnamepatterns     r   ValidSpaceNameList.ValidSpaceName   '     jjHIGd#$$r   c                    [         R                  " [        R                  R                  S9nUR
                  (       ac  UR                  S5      (       d  [        [         S[         35      e[        R                  " 5       nSnSR                  X1R                  U5      nGO)U R                  UR                  5      (       aO  UR                  S5      (       d  UR                  S5      (       a  [         R"                  " S5      eUR                  nOUR                  S5      (       d  [        [         S[         35      eUR$                  =(       d2    [&        R(                  R*                  R$                  R-                  5       nU(       d  [        [         S[.         35      eUR                  nSR                  X1R                  U5      nUR1                  XQR2                  UR4                  S9$ 	zRun the list command.r$   location
googlespacez"projects/{}/locations/{}/spaces/{}projectzZ--location and --project cannot be used when a full resource name is provided for --space.)parentlimit	page_size)apisSharedTemplatesClientr   r3   r4   google_catalogIsSpecifiedr   _BASE_ERROR_MESSAGE_LOCATION_NOT_SPECIFIED_MESSAGEr1   GetGoogleCatalogProjectIdformatrJ   rE   spacer	   ConflictingArgumentsExceptionrM   r
   VALUEScoreGet_PROJECT_NOT_SPECIFIED_MESSAGEr   rO   rP   selfargsclient
project_idspace_idrN   s         r   RunList.Run   s   ''d6G6G6M6MNFj)) "#2&E%FG
 	
 !::<jh3::
mmXf 
		TZZ	(	(			*	%	%)9)9))D)D66(
 	
 zzfj)) "#2&E%FG
 	
 <<G:#4#4#9#9#A#A#E#E#Gj "#2&D%EF
 	
 h3::
mmXf ;;ZZ4>>   r   r   Nr   r   r   r   r   _DETAILED_HELPdetailed_helpstaticmethodr9   rE   re   r   r   r   r   r   r   |   8      -" "H % %
$r   r   c                   B    \ rS rSrSr\r\S 5       r\S 5       r	S r
Srg)ListGa   r   c                    U R                  S[        S9nUR                  SS[        S9  UR	                  S5      nUR                  S[
        S9  UR                  S	S[        S9  U R                  S
S[        S9  U R                  R                  S5        U R                  R                  [        R                  " S[        R                  R                  S95        gr   )r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r   r3   GAr5   s      r   r9   ListGa.Args   s     //& 0 E 
&  
  22G $$ %  $$ % 
    
 !!&)
""$$D++..	
r   c                 b    [         R                  " S5      n[        UR                  U 5      5      $ r<   r=   rB   s     r   rE   ListGa.ValidSpaceName  rG   r   c                    [         R                  " [        R                  R                  S9nUR
                  (       ac  UR                  S5      (       d  [        [         S[         35      e[        R                  " 5       nSnSR                  X1R                  U5      nGO)U R                  UR                  5      (       aO  UR                  S5      (       d  UR                  S5      (       a  [         R"                  " S5      eUR                  nOUR                  S5      (       d  [        [         S[         35      eUR$                  =(       d2    [&        R(                  R*                  R$                  R-                  5       nU(       d  [        [         S[.         35      eUR                  nSR                  X1R                  U5      nUR1                  XQR2                  UR4                  S9$ rI   )rQ   rR   r   r3   rp   rS   rT   r   rU   rV   r1   rW   rX   rJ   rE   rY   r	   rZ   rM   r
   r[   r\   r]   r^   r   rO   rP   r_   s         r   re   
ListGa.Run  s   ''d6G6G6J6JKFj)) "#2&E%FG
 	
 !::<jh3::
mmXf 
		TZZ	(	(			*	%	%)9)9))D)D66(
 	
 zzfj)) "#2&E%FG
 	
 <<G:#4#4#9#9#A#A#E#E#Gj "#2&D%EF
 	
 h3::
mmXf ;;ZZ4>>   r   r   Nrg   r   r   r   rm   rm      rk   r   rm   )$r   
__future__r   r   r   r>   $googlecloudsdk.api_lib.design_centerr   rQ   r   r1   googlecloudsdk.callioper   r	   googlecloudsdk.corecore_exceptionsr
   rh   r'   r-   r+   r,   r)   rU   rV   r^   Errorr   ReleaseTracksr3   r4   UniverseCompatibleListCommandr   rp   rm   r   r   r   <module>r      s2   ( &  ' 	 I G ( . = * =*/>$ A + >   / >  ( 9.. 9 D%%++,T4 T  -Tn D%%(()TT T  *Tr   