
    0                         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
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z	 	 	 	 ddZ	 	 	 d dZ	 	 	 	 	 d!dZ	 d"dZd#dZ	 	 	 	 d$dZ	 	 	 	 	 	 	 d%dZd&dZ y)'z7Shared resource flags for Certificate Manager commands.    )absolute_import)division)unicode_literals)base)concepts)deps)concept_parsers)presentation_specsc                  0    t        j                  dd      S )Nmapz'The certificate map for the {resource}.name	help_textr    ResourceParameterAttributeConfig     Clib/googlecloudsdk/command_lib/certificate_manager/resource_args.pyCertificateMapAttributeConfigr      s    		2	2E
G Gr   c                  0    t        j                  dd      S )Nentryz-The certificate map entry for the {resource}.r   r   r   r   r   "CertificateMapEntryAttributeConfigr   !   s    		2	2M
O Or   c                  0    t        j                  dd      S )Ncertificatez#The certificate for the {resource}.r   r   r   r   r   CertificateAttributeConfigr   &   s    		2	2$I
K Kr   c                  ^    t        j                  ddt        j                  d d      g      S )Nlocation&The Cloud location for the {resource}.c                       y)Nglobalr   r   r   r   <lambda>z)LocationAttributeConfig.<locals>.<lambda>0   s    8r   z%default value of location is [global]r   r   fallthroughsr   r   r   Fallthroughr   r   r   LocationAttributeConfigr&   +   s5    		2	28


+BD
	 	r   c                  ^    t        j                  ddt        j                  d d      g      S )Nr   r   c                       y)N-r   r   r   r   r!   z3AllDefaultLocationAttributeConfig.<locals>.<lambda>;   s    cr   z>if left empty, will use the wildcard '-' to list all locationsr"   r$   r   r   r   !AllDefaultLocationAttributeConfigr*   5   s5    		2	28


NP
	 	r   c                  0    t        j                  dd      S )N	operationz1Certificate Manager operation for the {resource}.r   r   r   r   r   OperationAttributeConfigr-   @   s    		2	2C
E Er   c                  t    t        j                  ddt               t               t         j                  d      S )Nz5certificatemanager.projects.locations.certificateMapszcertificate mapF)resource_namecertificateMapsIdlocationsId
projectsIddisable_auto_completers)r   ResourceSpecr   r&    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r   GetCertificateMapResourceSpecr6   F   s3    			=%57)+::#
% %r   c            	          t        j                  ddt               t               t	               t         j
                  d      S )NzKcertificatemanager.projects.locations.certificateMaps.certificateMapEntrieszcertificate map entryF)r/   certificateMapEntriesIdr0   r1   r2   r3   )r   r4   r   r   r&   r5   r   r   r   "GetCertificateMapEntryResourceSpecr9   P   s9    			S+@B57)+::#
% %r   c                  t    t        j                  ddt               t               t         j                  d      S )Nz2certificatemanager.projects.locations.certificatesr   F)r/   certificatesIdr1   r2   r3   )r   r4   r   r&   r5   r   r   r   GetCertificateResourceSpecr<   [   s3    			:!/1)+::#
% %r   c                  `    t        j                  ddt               t         j                        S Nz%certificatemanager.projects.locationsr   )r/   r1   r2   )r   r4   r&   r5   r   r   r   GetLocationResourceSpecr?   e   s*    			-)+::	
< <r   c                  `    t        j                  ddt               t         j                        S r>   )r   r4   r*   r5   r   r   r   !GetAllDefaultLocationResourceSpecrA   m   s*    			-35::	
< <r   c                  t    t        j                  ddt               t               t         j                  d      S )Nz0certificatemanager.projects.locations.operationsr,   F)r/   operationsIdr1   r2   r3   )r   r4   r-   r&   r5   r   r   r   GetOperationResourceSpecrD   u   s3    			8+-)+::#
% %r   Nc           	      |    i }|sd|d<   t        j                  | t               dj                  ||      ||||      S )a  Returns ResourcePresentationSpec for certificate resource.

  Args:
    flag: str, the flag name.
    noun: str, the resource; default: 'The certificate map'.
    verb: str, the verb to describe the resource, such as 'to update'.
    required: bool, if False, means that map ID is optional.
    plural: bool.
    group: args group.
    with_location: bool, if False, means that location flag is hidden.

  Returns:
    presentation_specs.ResourcePresentationSpec.
   r   {} {}.)requiredpluralgroupflag_name_overrides)r
   ResourcePresentationSpecr<   format)flagnounverbrH   rI   rJ   with_locationrK   s           r   '_GetCertificateResourcePresentationSpecrR      sN    * 	&(
#		4	4
 "oodD!-
/ /r   c                 h    t        j                  | t               dj                  ||      |||      S )NrG   )rH   rI   rJ   )r
   rL   r9   rM   )rN   rO   rP   rH   rI   rJ   s         r   /_GetCertificateMapEntryResourcePresentationSpecrT      s7     
	4	4
(*oodD!
 r   c                     i }|sd|d<   |xs d}t         j                  j                  |r|nd|z   t               dj	                  ||      ||      j                  |        y)ad  Add a resource argument for a Certificate Manager certificate map.

  NOTE: Must be used only if it's the only resource arg in the command.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    name: str, the name of the main arg for the resource.
    noun: str, the resource; default: 'The certificate map'.
    positional: bool, if True, means that the map ID is a positional arg rather
      than a flag.
    required: bool, if False, means that map ID is optional.
    with_location: bool, if False, means that location flag is hidden.
  rF   r   zThe certificate map--rG   )rH   rK   N)r	   ConceptParserForResourcer6   rM   AddToParser)parserrP   r   rO   
positionalrH   rQ   rK   s           r   AddCertificateMapResourceArgr\      sm    * 	&(
#		&&$++ddTk#%oodD!- , /
 0;{6/Br   c           	      T    t        j                  ddd|dj                  |             S )zDReturns the flag for clearing a Certificate Manager certificate map.z--clear-certificate-map
store_trueFz1Removes any attached certificate map from the {}.)actiondefaultrH   help)r   ArgumentrM   )resource_typerH   s     r   .GetClearCertificateMapArgumentForOtherResourcerd      s2     
>EE

 r   c                 x    |xs d}t        j                  t        |rdnd||      g      j                  |        y)a  Add a resource argument for a Certificate Manager certificate map entry.

  NOTE: Must be used only if it's the only resource arg in the command.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    noun: str, the resource; default: 'The certificate map'.
    positional: bool, if True, means that the map ID is a positional arg rather
      than a flag.
  The certificate map entryr   z--entryN)r	   rW   rT   rY   )rZ   rP   rO   r[   s       r   !AddCertificateMapEntryResourceArgrg      sA     
	,,$5'Yd<!  [r   c                     |xs d}|xs d}|xs d}t        j                  t        d||      t        d||dd|d      g      j	                  |        y	)
a\  Add a resource argument for a Certificate Manager certificate map entry and certificates.

  NOTE: Must be used only if these are the only resource args in the command.

  Args:
    parser: the parser for the command.
    entry_verb: str, the verb to describe the entry, such as 'to update'.
    entry_noun: str, the entry resource; default: 'The certificate map entry'.
    cert_verb: str, the verb to describe the cert, default: 'to be attached to
      the entry'.
    cert_noun: str, the certificate resources; default: 'The certificates'.
    cert_group: args group certificates should belong to.
  rf   zThe certificateszto be attached to the entryr   z--certificatesFT)rH   rI   rJ   rQ   N)r	   rW   rT   rR   rY   )rZ   
entry_verb
entry_noun	cert_verb	cert_noun
cert_groups         r   1AddCertificateMapEntryAndCertificatesResourceArgsrn      sq    & 88*--)88)5gz6@B-


!  [r   c	                     |xs d}t        j                  t        |rdnd|z   ||||||      g      j                  |        y)a  Add a resource argument for a Certificate Manager certificate.

  NOTE: Must be used only if it's the only resource arg in the command.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    noun: str, the resource; default: 'The certificate'.
    name: str, the name of the flag.
    positional: bool, if True, means that the certificate ID is a positional arg
      rather than a flag.
    required: bool, if True the flag is required.
    plural: bool, if True the flag is a list.
    group: args group.
    with_location: bool, if False, means that location flag is hidden.
  zThe certificater   rV   N)r	   rW   rR   rY   )	rZ   rP   rO   r   r[   rH   rI   rJ   rQ   s	            r   AddCertificateResourceArgrp     sS    6 
	""$-%-4$;






! 
 [r   c                     |rt               }n
t               }t        j                  j	                  d|dj                  |      d      j                  |        y)aT  Add a resource argument for a cloud location.

  NOTE: Must be used only if it's the only resource arg in the command.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    all_default_location: bool, if True, the default for the location flag will
    be set to '-'.
  z
--locationzThe Cloud location {}.T)rH   N)rA   r?   r	   rW   rX   rM   rY   )rZ   rP   all_default_locationresource_specs       r   AddLocationResourceArgrt   =  sS     57M+-M++%%d+	 ,  ![(r   )TFNT)TFN)r   NTTT)F)NT)NNNN)Nr   TTFNT)rF   F)!__doc__
__future__r   r   r   googlecloudsdk.callioper    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr	   r
   r   r   r   r&   r*   r-   r6   r9   r<   r?   rA   rD   rR   rT   r\   rd   rg   rn   rp   rt   r   r   r   <module>rz      s    > &  ' ( 5 1 D GG
O
K
		E%%%<<% 6:3826:>/J >B;@:>" ',&*,0*./3CD =B	* BF@D@DAE!N 
	
&R)r   