
    g&                     l   d Z ddlmZ ddlmZ ddlmZ ddl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ddZdZdZdZdZdZdZdZdZdZdZdZ G d dej6                        Z e
j:                  e
j<                  j>                        e
j@                   G d de
jB                                      Z"y)z/Command to describe a shared template revision.    )absolute_import)division)unicode_literalsN)shared_template_revisions)base)
exceptions)
properties$Describe a shared template revision.a           To describe the shared template revision `my-revision` in shared template `my-shared-template`, space `my-space`, project `my-project` and location `us-central1`, run:

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

        Or run:

          $ {command} projects/my-project/locations/us-central1/spaces/my-space/sharedTemplates/my-shared-template/revisions/my-revision

        To describe a shared template revision `my-revision` in shared template `google-template` from the Google Catalog and location `us-central1`, run:

          $ {command} my-revision --shared-template=google-template --google-catalog --location=us-central1
        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 REFERENCEzError parsing [revision].a  The [revision] resource is not properly specified.
Failed to find attribute [location]. The attribute can be set in the following ways:
- provide the argument `revision` on the command line with a fully specified name
- provide the argument `--location` on the command linea  The [revision] 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 `revision` on the command line with a fully specified name
- provide the argument `--project` on the command line
- set the property `core/project`a\  The [revision] resource is not properly specified.
Failed to find attribute [space]. [space] must be specified unless using --google-catalog or a full resource name. The attribute can be set in the following ways:
- provide the argument `revision` on the command line with a fully specified name
- provide the argument `--space` on the command linea  The [revision] resource is not properly specified.
Failed to find attribute [shared-template]. The attribute can be set in the following ways:
- provide the argument `revision` on the command line with a fully specified name
- provide the argument `--shared-template` on the command linea  ID of the revision or fully qualified identifier for the sharedTemplateRevision. Format: projects/$project/locations/$location/spaces/$space/sharedTemplates/$sharedTemplate/revisions/$revision
 To set the revision attribute:
  * provide the fully qualified identifier `revision` on the command line;
  * provide the argument `revision` which represents the revision id and the other arguments `--shared-template`, `--location`, `--project`, `--space` or `--google-catalog` on the command line.zThe sharedTemplate id of the revision resource.

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

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

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

To set the space attribute:
  * provide the argument `revision` on the command line with a fully specified name;
  * provide the argument `--space` on the command line.zIf provided, describes a shared template revision from the Google Catalog. This sets the project to "gcpdesigncenter" and space to "googlespace".c                       e Zd ZdZy)#SharedTemplateRevisionResourceErrorzAException for errors related to SharedTemplateRevision resources.N)__name__
__module____qualname____doc__     Glib/surface/design_center/spaces/shared_templates/revisions/describe.pyr   r      s    Ir   r   c                   :    e Zd ZdZeZed        Zed        Zd Z	y)DescribeAlphar
   c                 f   | j                  ddt               | j                  ddt               | j                  ddt               | j	                         }|j                  dd	t
        
       |j                  d      }|j                  ddt               |j                  ddt               y )NrevisionREVISION)metavarhelpz--shared-templateF)requiredr   z
--locationz--google-catalog
store_true)actionr   z:Specify --project and --space for custom shared templates.z	--projectz--space)	add_argument_REVISION_HELP_TEXT_SHARED_TEMPLATE_HELP_TEXT_LOCATION_HELP_TEXTadd_mutually_exclusive_group_GOOGLE_CATALOG_HELP_TEXTadd_argument_group_PROJECT_HELP_TEXT_SPACE_HELP_TEXT)parsergroupproject_space_groups      r   ArgszDescribeAlpha.Args   s         '       //1E	&    22D $$ % 
 $$ % r   c                 R    t        j                  d      }|j                  |       duS )z,Validates the shared template revision name.zV^projects/[^/]+/locations/[^/]+/spaces/[^/]+/sharedTemplates/[^/]+/revisions(/[^/]+)?$N)recompilematch)namepatterns     r   ValidSharedTemplateRevisionNamez-DescribeAlpha.ValidSharedTemplateRevisionName   s+     jjaG ==d**r   c                    t        j                  t        j                  j                        }| j                  |j                        r|j                  d      s?|j                  d      s.|j                  d      s|j                  d      s|j                  rt        j                  d      |j                  |j                        S |j                  d      st        t         dt               |j                  }|j                  rd	}d
}n|j                   xs2 t"        j$                  j&                  j                   j)                         }|st        t         dt*               |j                  d      st        t         dt,               |j.                  }|j                  d      st        t         dt0               |j2                  }dj5                  |||||j                        }|j                  |      S )zRun the describe command.)release_trackshared_templatelocationprojectspacez}--shared-template, --location, --project, --space, and --google-catalog cannot be used when a full resource name is provided.)r1   
gcpdesigncentergooglespacezBprojects/{}/locations/{}/spaces/{}/sharedTemplates/{}/revisions/{})apisSharedTemplateRevisionsClientr   ReleaseTrackALPHAr3   r   IsSpecifiedgoogle_catalogr   ConflictingArgumentsExceptionDescriber   _BASE_ERROR_MESSAGE_LOCATION_NOT_SPECIFIED_MESSAGEr7   r8   r	   VALUEScoreGet_PROJECT_NOT_SPECIFIED_MESSAGE_SPACE_NOT_SPECIFIED_MESSAGEr9   &_SHARED_TEMPLATE_NOT_SPECIFIED_MESSAGEr6   format)selfargsclientlocation_id
project_idspace_idshared_template_idshared_template_revision_names           r   RunzDescribeAlpha.Run   s   //''--F
 ++DMM:


,
-j)i(g&  66
 	

 __$--_00 J'/ !$C#D
E  --K$jh<<G:#4#4#9#9#A#A#E#E#Gj1"#2&D%EF
 	
 g&1"#2&B%CD
 	
 h-./ !$J#K
L  --
 	M	X/A4==

 " ?? =?>>r   N)
r   r   r   r   _DETAILED_HELPdetailed_helpstaticmethodr,   r3   rV   r   r   r   r   r      s8     - -( (T + +;?r   r   )#r   
__future__r   r   r   r.   $googlecloudsdk.api_lib.design_centerr   r=   googlecloudsdk.callioper   r   googlecloudsdk.corecore_exceptionsr	   rW   rE   rF   rJ   rK   rL   r!   r"   r#   r'   r(   r%   Errorr   ReleaseTracksr?   r@   UniverseCompatibleDescribeCommandr   r   r   r   <module>rc      s	   6 &  ' 	 R ( . = * :, 2 >  ( ; E '< H A + >  J/*?*? J D%%++,s?D(( s?  -s?r   