
    !                         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 Z	 	 	 	 dd
Zd Zd Z	 	 	 	 ddZd ZddZ	 ddZd Zd Zd Zd Zd Zd Zd Zd Zy	)z Design Center Command Lib Flags.    )absolute_import)division)unicode_literals)arg_parsers)concepts)concept_parsersc                  N    t        j                  ddt         j                        S )Nzdesigncenter.projectsproject)resource_name
projectsId)r   ResourceSpec DEFAULT_PROJECT_ATTRIBUTE_CONFIG     5lib/googlecloudsdk/command_lib/design_center/flags.pyGetProjectResourceSpecr      s$    			::
 r   Nc                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z5Constructs and returns the Project Resource Argument.zProject ID.{}{} --required)r   ConceptParserForResourceformatr   arg_name	help_text
positionalr   s       r   GetProjectResourceArgr    "   sJ     (=)		&	&	2	2mm*B$9	 
3 
 r   c                  0    t        j                  dd      S )Nlocationz&The Cloud location for the {resource}.namer   r    ResourceParameterAttributeConfigr   r   r   LocationAttributeConfigr'   2   s    		2	28
 r   c                  `    t        j                  ddt               t         j                        S )Nzdesigncenter.projects.locationsr"   )r   locationsIdr   )r   r   r'   r   r   r   r   GetLocationResourceSpecr*   9   s*    			')+::	
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z6Constructs and returns the Location Resource Argument.z	Location.r   r   r   r   )r   r   r   r   r*   r   s       r   GetLocationResourceArgr,   B   sJ     &;)		&	&	2	2mm*B$9	 
3 
 r   c                 0    t        j                  | |      S )z9Helper function for constructing ResourceAttributeConfig.r#   r%   r   r   s     r   SpaceResourceAttributeConfigr/   T   s     
	2	2
 r   c                 v    t        j                  ddt        | |      t         j                  t	                     S )z<Constructs and returns the Resource specification for Space.z&designcenter.projects.locations.spacesspace)r   spacesIdr   r)   )r   r   r/   r   r'   r.   s     r   GetSpaceResourceSpecr3   ]   s6     
		.+Hi@::)+
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	        | |      ||      S )z6Constructs and returns the Space ID Resource Argument.zThe Space ID.r   r   r   r   )r   r   r   r   r3   r   s       r   GetSpaceResourceArgr5   i   sN    
 *?)		&	&	2	2mm*B$98Y/	 
3 
 r   c                  0    t        j                  dd      S )z,Creates an attribute config for the catalog.catalogzThe ID of the catalog.r#   r%   r   r   r   CatalogAttributeConfigr8   {   s    		2	2(
 r   c                  0    t        j                  dd      S )z-Creates an attribute config for the template.templatezThe ID of the template.r#   r%   r   r   r   CatalogTemplateAttributeConfigr;      s    		2	2)
 r   c                      t        j                  ddt        j                  dd      t               t	               t        dd      t               t         j                        S )z)Creates the resource spec for a revision.zCdesigncenter.projects.locations.spaces.catalogs.templates.revisionsrevisionz!The ID of the revision to create.r#   r1   zThe ID of the space.)r   revisionsIdtemplatesId
catalogsIdr2   r)   r   )r   r   r&   r;   r8   r/   r'   r   r   r   r   &GetCatalogTemplateRevisionResourceSpecrA      sW    			K;;%H 12')+G5KL)+::
 r   c                 :    t        d      j                  |        y )NT)r   )r,   AddToParserparsers    r   AddDescribeLocationFlagsrF      s    D)55f=r   c                 6    t               j                  |        y Nr5   rC   rD   s    r   AddGetIamPolicyFlagsrJ          ##F+r   c                 6    t               j                  |        y rH   rI   rD   s    r   AddSetIamPolicyFlagsrM      rK   r   c                 6    t               j                  |        y rH   rI   rD   s    r   AddTestIamPermissionsFlagsrO      rK   r   c                    t         j                  j                  dt               dd      j	                  |        | j                  dd       | j                  dd      }|j                  d	      }|j                  d
dd       |j                  ddd       |j                  ddd       |j                  d      }|j                  ddd       |j                  ddd       |j                  ddd       |j                  ddd       |j                  ddd       |j                  d      }|j                  ddd       |j                  d d!d       | j                  d"t        j                         d#$       y%)&zAdds all flags for the create revision command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in tests.
  r=   zThe revision to create.Tr   z--descriptionzA description for the revision.)help)mutexr   z#Flags for Developer Connect source.z--developer-connect-repozThe Developer Connect repository to use as a source. Example: projects/my-project/locations/us-central1/connections/my-connection/gitRepositoryLinks/my-repo)rQ   r   z--developer-connect-repo-refzThe Git ref (branch or tag) within the repository to use. Example: "refs/tags/v1.0.0" or "refs/heads/main" or "refs/commits/269b518b99d06b31ff938a2d182e75f5e41941c7".z--developer-connect-repo-dirzIThe directory within the repository to use. Example: "modules/my-product"zFlags for Git source.z--git-source-repozVGit repository for Git source. Example: GoogleCloudPlatform/terraform-google-cloud-runz--git-source-ref-tagz3Git reference tag for Git source. Example: "v1.0.0"z--git-source-dirzTGit directory for Git source. Example: "modules/my-product". This field is optional.Fz&--application-template-revision-sourcezApplication template revision to use as source. Example: projects/my-project/locations/us-central1/spaces/my-space/catalogs/my-catalog/templates/my-template/revisions/r1z--gcs-source-urizIGoogle Cloud Storage URI for source. Example: gs://my-bucket/my-template.zFlags for OCI Repo source.z--oci-repo-urizdOCI Repo URI for OCI Repo source. Example: oci://us-west1-docker.pkg.dev/my-project/my-repo/my-chartz--oci-repo-versionzOOCI Repo version for OCI Repo source. Example: "1.0.0". This field is optional.z
--metadataz]Path to a local YAML file containing the template metadata. Example: "path/to/metadata.yaml".)typerQ   N)	r   r   r   rA   rC   add_argument	add_groupr   YAMLFileContents)rE   source_groupdev_connect_groupgit_source_groupoci_repo_groups        r   %AddCreateCatalogTemplateRevisionFlagsr[      s#    ++,.	 , 
 Ko,MN!!t!<,",,0 -     '  !    $E  !    $"  !  "++" ,  8	    @   
 %     .~    )     ))/K)L.G        	'')&	  r   )r
   NFT)r"   NFT)r1   N)r1   NTT)__doc__
__future__r   r   r   googlecloudsdk.callioper    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r   r    r'   r*   r,   r/   r3   r5   r8   r;   rA   rF   rJ   rM   rO   r[   r   r   r   <module>ra      s    ' &  ' / 5 D 	  	$	 AE$ >,,,tr   