
                         p    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 Zd Z	d	 Z
d
 Zd Zd ZddZy)z.Shared flags for Certificate Manager commands.    )absolute_import)division)unicode_literals)arg_parsers)basec                 B    t         j                  j                  |        y)zHAdds async flag. It's not marked as go/gcloud-style#commonly-used-flags.N)r   
ASYNC_FLAGAddToParserparsers    ;lib/googlecloudsdk/command_lib/certificate_manager/flags.pyAddAsyncFlagToParserr      s    //f%    c                     t        j                  ddj                  |      t         j                        j	                  |        y)zAdds description flag.z--descriptionzText description of a {}.)helpcategoryN)r   ArgumentformatCOMMONLY_USED_FLAGSr
   )r   resource_names     r   AddDescriptionFlagToParserr      s4    --&--m<'') *5V)<r   c                    t        j                  ddd      }t        j                  dd      }t        j                  dd	d	t         j                  
      }|j	                  |       |j	                  |       |j                  |        y)z2Adds flags defining certificate map entry matcher.z--set-primaryzcThe certificate will be used as the default cert if no other certificate in the map matches on SNI.
store_true)r   actionz
--hostnamezA domain name (FQDN), which controls when list of certificates specified in the resource will be taken under consideration for certificate selection.)r   z=Arguments to configure matcher for the certificate map entry.T)r   requiredmutexr   N)r   r   ArgumentGroupr   AddArgumentr
   )r   is_primary_flaghostname_flaggroups       r   AddMapEntryMatcherFlagsToParserr"   &   s    MMp/ -- c- 

J''	)%
 O$M"Fr   c                 j   t        j                  ddt        j                         d      }t        j                  ddt        j                         d      }t        j                  d||st         j
                  nd	      }|j                  |       |j                  |       |j                  |        y)
z1Adds certificate file and private key file flags.z--certificate-filez)The certificate data in PEM-encoded form.T)r   typer   z--private-key-filez)The private key data in PEM-encoded form.z5Arguments to configure self-managed certificate data.N)r   r   r   )r   r   r   FileContentsr   r   r   r
   )r   is_required	cert_flagkey_flagr!   s        r   *AddSelfManagedCertificateDataFlagsToParserr)   :   s    
 mm6##%	)
 ]]6##%	( 

B/:t''F% IHFr   c           	          g d}t        j                  ddt        j                         t        j                  dj                  |      d      j                  |        y)z(Makes the base.Argument for --tags flag.)z%List of tags KEY=VALUE pairs to bind.zEach item must be expressed asz4`<tag-key-namespaced-name>=<tag-value-short-name>`.
z?Example: `123/environment=production,123/costCenter=marketing`
z--tagsz	KEY=VALUE
T)metavarr$   r   r   hiddenN)r   r   r   ArgDictUpdateActionjoinr
   )r   
help_partss     r   GetTagsr2   S   sM    * -- %%99Z  Kr   c                     t        |        y)zvAdds create command tags flags to an argparse parser.

  Args:
    parser: The argparse parser to add the flags to.
  N)r2   r   s    r   AddTagsFlagsr4   e   s     
&/r   c           
          t        | |      }|sy |t        |j                               D cg c]  \  }}|j                  ||       c}}      S c c}}w )zMakes the tags message object.N)keyvalue)additionalProperties)getattrsorteditemsAdditionalProperty)argstags_messagetags_arg_nametagsr6   r7   s         r   GetTagsFromArgsrA   n   s`    	}	%$		tzz|,,.,*#u %%#U%;,,. 
/ / ,.s   A
N)r@   )__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r   r   r"   r)   r2   r4   rA    r   r   <module>rF      s<    5 &  ' / (&
=(2$/r   