
                          .   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ddZdZdZdZdZdZdZdZdZdZ e
j0                  e
j2                  j4                        e
j6                   G d de
j8                                      Zy)z&Command to describe a shared template.    )absolute_import)division)unicode_literalsN)shared_templates)base)
exceptions)
propertiesDescribe a shared template.a>           To describe the shared template `my-shared-template` in space `my-space`, project `my-project` and location `us-central1`, run:

          $ {command} 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

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

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

To set the location attribute:
  * provide the argument `shared_template` on the command line with a fully specified name;
  * provide the argument `--location` on the command line.a  The project id of the sharedTemplate resource.

To set the project attribute:
  * provide the argument `shared_template` 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 sharedTemplate resource.

To set the space attribute:
  * provide the argument `shared_template` on the command line with a fully specified name;
  * provide the argument `--space` on the command line.zIf provided, describes a shared template from the Google Catalog. This sets the project to "gcpdesigncenter" and space to "googlespace".c                   :    e Zd ZdZeZed        Zed        Zd Z	y)DescribeAlphar
   c                 6   | 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shared_templateSHARED_TEMPLATE)metavarhelpz
--locationF)requiredr   z--google-catalog
store_true)actionr   z:Specify --project and --space for custom shared templates.z	--projectz--space)add_argument_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      =lib/surface/design_center/spaces/shared_templates/describe.pyArgszDescribeAlpha.Args   s     !'       //1E	&    22D $$ % 
 $$ %     c                 R    t        j                  d      }|j                  |       duS )z#Validates the shared template name.zF^projects/[^/]+/locations/[^/]+/spaces/[^/]+/sharedTemplates(/[^/]+)?$N)recompilematch)namepatterns     r"   ValidSharedTemplateNamez%DescribeAlpha.ValidSharedTemplateName   s+     jjQG ==d**r$   c                    t        j                  t        j                  j                        }| j                  |j                        rp|j                  d      s.|j                  d      s|j                  d      s|j                  rt        j                  d      |j                  |j                        S |j                  d      s"t        j                  t         dt               |j                  }|j                  rd}d	}n|j                   xs2 t"        j$                  j&                  j                   j)                         }|s"t        j                  t         dt*               |j                  d      s"t        j                  t         dt,               |j.                  }d
j1                  ||||j                        }|j                  |      S )zRun the describe command.)release_tracklocationprojectspacezj--location, --project, --space, and --google-catalog cannot be used when a full resource name is provided.)r)   
gcpdesigncentergooglespacez5projects/{}/locations/{}/spaces/{}/sharedTemplates/{})apisSharedTemplatesClientr   ReleaseTrackALPHAr+   r   IsSpecifiedgoogle_catalogr   ConflictingArgumentsExceptionDescribeToolException_BASE_ERROR_MESSAGE_LOCATION_NOT_SPECIFIED_MESSAGEr.   r/   r	   VALUEScoreGet_PROJECT_NOT_SPECIFIED_MESSAGE_SPACE_NOT_SPECIFIED_MESSAGEr0   format)selfargsclientlocation_id
project_idspace_idshared_template_names          r"   RunzDescribeAlpha.Run   s   ''d6G6G6M6MNF ##D$8$89


:
&i(g&  66;
 	
 __$"6"6_77 J'$$ !$C#D
E  --K$jh<<G:#4#4#9#9#A#A#E#E#Gj&&"#2&D%EF
 	
 g&&&"#2&B%CD
 	
 h
 	@FFXt/C/C	
  ?? 4?55r$   N)
__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr#   r+   rL    r$   r"   r   r      s8     $ -" "H + +16r$   r   )rP   
__future__r   r   r   r&   $googlecloudsdk.api_lib.design_centerr   r4   googlecloudsdk.callioper   r   googlecloudsdk.corer	   rQ   r=   r>   rB   rC   r   r   r   r   r   ReleaseTracksr6   r7   UniverseCompatibleDescribeCommandr   rT   r$   r"   <module>r\      s    - &  ' 	 I ( . * 1, 9 >  ( ; I A + >   D%%++,c6D(( c6  -c6r$   