Ë
    €Ïu*  ã                   ó  — 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!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d"d„Zd"d„Zd"d„Zd"d„Zd!d„Z	 	 	 d#d„Z	 	 	 	 	 	 d$d„Zd„ Zd„ Zd„ Zd„ Z d„ Z!d „ Z"y)%z(Shared resource flags for kms resources.é    )Úabsolute_import)Údivision)Úunicode_literals)Úconcepts)Údeps)Úconcept_parsers)Úpresentation_specs)Ú
propertiesc                 ó<   — | rdnd}t        j                  |d¬«      S )Nzkms-key-versionzkey-versionz&The KMS key version of the {resource}.©ÚnameÚ	help_text©r   Ú ResourceParameterAttributeConfig©Ú
kms_prefixr   s     ú3lib/googlecloudsdk/command_lib/kms/resource_args.pyÚKeyVersionAttributeConfigr      s%   € Ù(Ñ	¨m€$Ü	×	2Ñ	2ØÐCô
ð ó    c                 ó<   — | rdnd}t        j                  |d¬«      S )Nzkms-keyÚkeyzThe KMS key of the {resource}.r   r   r   s     r   ÚKeyAttributeConfigr   #   s$   € Ù ‰ e€$Ü	×	2Ñ	2ØÐ;ô
ð r   c                 ó<   — | rdnd}t        j                  |d¬«      S )Nzkms-keyringÚkeyringz"The KMS keyring of the {resource}.r   r   r   s     r   ÚKeyringAttributeConfigr   *   s$   € Ù$‰¨)€$Ü	×	2Ñ	2ØÐ?ô
ð r   c                 ó<   — | rdnd}t        j                  |d¬«      S )Nzkms-key-handleú
key-handlez%The KMS key-handle of the {resource}.r   r   r   s     r   ÚKeyHandleAttributeConfigr   1   s%   € Ù'Ñ	¨\€$Ü	×	2Ñ	2ØÐBô
ð r   c                 ó<   — | rdnd}t        j                  |d¬«      S )Nzkms-ekmconnectionÚekmconnectionz)The KMS ekm connection of the {resource}.r   r   r   s     r   ÚEkmConnectionAttributeConfigr!   8   s%   € Ù *Ñ	°€$Ü	×	2Ñ	2ØÐFô
ð r   c                 óŽ   — | rdnd}g }|r$|j                  t        j                  d«      «       t        j                  |d|¬«      S )Nzkms-locationÚlocationz--regionz-The Google Cloud location for the {resource}.©r   r   Úfallthroughs)Úappendr   ÚArgFallthroughr   r   )r   Úregion_fallthroughr   r%   s       r   ÚLocationAttributeConfigr)   ?   sH   € Ù%‰¨:€$Ø€,ÙØ×Ñœ×+Ñ+¨JÓ7Ô8Ü	×	2Ñ	2ØØ?Øô
ð r   c                 óª   — | rdnd}t        j                  |dt        j                  t        j
                  j                  j                  «      g¬«      S )Nzkms-projectÚprojectz,The Google Cloud project for the {resource}.r$   )r   r   r   ÚPropertyFallthroughr
   ÚVALUESÚcorer+   r   s     r   ÚProjectAttributeConfigr/   K   sG   € Ù$‰¨)€$Ü	×	2Ñ	2ØØ>Ü×,Ñ,¬Z×->Ñ->×-CÑ-C×-KÑ-KÓLÐMô
ð r   c                 óš   — t        j                  ddt        | «      t        | «      t	        | «      t        | ¬«      t        | ¬«      d¬«      S )NzAcloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersionszkey version©r   F)Úresource_nameÚcryptoKeyVersionsIdÚcryptoKeysIdÚ
keyRingsIdÚlocationsIdÚ
projectsIdÚdisable_auto_completers)r   ÚResourceSpecr   r   r   r)   r/   r1   s    r   ÚGetKmsKeyVersionResourceSpecr:   T   sF   € Ü	×	Ñ	ØIØ!Ü3°JÓ?Ü% jÓ1Ü'¨
Ó3Ü)°ZÔ@Ü'°:Ô>Ø#ô	
ð 	r   c           
      ó†   — t        j                  ddt        | «      t        | «      t	        | |¬«      t        | «      d¬«      S )Nz/cloudkms.projects.locations.keyRings.cryptoKeysr   ©r   r(   F)r2   r4   r5   r6   r7   r8   )r   r9   r   r   r)   r/   r<   s     r   ÚGetKmsKeyResourceSpecr=   a   sF   € Ü	×	Ñ	Ø7ØÜ% jÓ1Ü'¨
Ó3Ü)ØÐ4Fôô (¨
Ó3Ø#ô

ð 
r   c           	      ór   — t        j                  ddt        | «      t        | |¬«      t	        | «      d¬«      S )Nz$cloudkms.projects.locations.keyRingsr   r<   F)r2   r5   r6   r7   r8   )r   r9   r   r)   r/   r<   s     r   ÚGetKmsKeyRingResourceSpecr?   o   s>   € Ü	×	Ñ	Ø,ØÜ'¨
Ó3Ü)ØÐ4Fôô (¨
Ó3Ø#ô	
ð 	r   c           	      ór   — t        j                  ddt        | «      t        | |¬«      t	        | «      d¬«      S )Nz&cloudkms.projects.locations.keyHandlesr   r<   F)r2   ÚkeyHandlesIdr6   r7   r8   )r   r9   r   r)   r/   r<   s     r   ÚGetKmsKeyHandleResourceSpecrB   |   s>   € Ü	×	Ñ	Ø.Ø Ü+¨JÓ7Ü)ØÐ4Fôô (¨
Ó3Ø#ô	
ð 	r   c           	      ór   — t        j                  ddt        | «      t        | |¬«      t	        | «      d¬«      S )Nz*cloudkms.projects.locations.ekmConnectionsr    r<   F)r2   ÚekmConnectionsIdr6   r7   r8   )r   r9   r!   r)   r/   r<   s     r   ÚGetKmsEkmConnectionResourceSpecrE   ‰   s>   € Ü	×	Ñ	Ø2Ø#Ü3°JÓ?Ü)ØÐ4Fôô (¨
Ó3Ø#ô	
ð 	r   c                 ó^   — t        j                  ddt        | |¬«      t        | «      d¬«      S )Nzcloudkms.projects.locationsr#   r<   F)r2   r6   r7   r8   )r   r9   r)   r/   r<   s     r   ÚGetKmsLocationResourceSpecrG   –   s6   € Ü	×	Ñ	Ø#ØÜ)ØÐ4Fôô (¨
Ó3Ø#ô
ð r   c                 óF   — t        j                  ddt        | «      d¬«      S )Nzcloudkms.projectsr+   F)r2   r7   r8   )r   r9   r/   r1   s    r   ÚGetKmsProjectResourceSpecrI   ¢   s&   € Ü	×	Ñ	ØØÜ'¨
Ó3Ø#ô	
ð r   Nc                 ó    — |sdj                  dd«      }dj                  | |«      }t        j                  dt        |¬«      ||xs i ¬«      }|S )aß  Return a Presentation Spec for kms key resource argument.

  Args:
    resource: str, the name of the resource that the cryptokey will be used to
      protect.
    region_fallthrough: bool, True if the command has a region flag that should
      be used as a fallthrough for the kms location.
    flag_overrides: dict, The default flag names are 'kms-key', 'kms-keyring',
      'kms-location' and 'kms-project'. You can pass a dict of overrides where
      the keys of the dict are the default flag names, and the values are the
      override names.
    permission_info: str, optional permission info that overrides default
      permission info group help.

  Returns:
    Presentation spec suitable for adding to concept parser.
  ú{} must hold permission {}ú2The 'Compute Engine Service Agent' service accountú)'Cloud KMS CryptoKey Encrypter/Decrypter'úYThe Cloud KMS (Key Management Service) cryptokey that will be used to protect the {}. {}.ú	--kms-key©r(   )Úflag_name_overrides)Úformatr	   ÚResourcePresentationSpecr=   )Úresourcer(   Úflag_overridesÚpermission_infoÚ
group_helpÚpresentation_specs         r   ÚGetKmsKeyPresentationSpecrY   «   se   € ñ0 
Ø2×9Ñ9Ø<Ø3ó€Oð%ß%+¡V¨H°oÓ%Fð ô
 )×AÑAØÜÐ/AÔBØØ(Ò.¨Bô	Ðð 
Ðr   c                 óÈ   — |sdj                  dd«      }t        j                  j                  |t	        |¬«      dj                  ||«      |||¬«      j                  | «       y)a  Add a resource argument for a KMS key to protect other resources.

  Args:
    parser: the parser for the command.
    resource: str, the name of the resource that the cryptokey will be used to
      protect.
    region_fallthrough: bool, True if the command has a region flag that should
      be used as a fallthrough for the kms location.
    flag_overrides: dict, The default flag names are 'kms-key', 'kms-keyring',
      'kms-location' and 'kms-project'. You can pass a dict of overrides where
      the keys of the dict are the default flag names, and the values are the
      override names.
    permission_info: str, optional permission info that overrides default
      permission info group help.
    required: bool, optional. True if the flag must be parsable by the parser.
      The default value is False.
    name: str, optional name of the arg for the KMS resource. Defaults to
      '--kms-key'.
    hidden: bool, optional to hide the field. True if the flag must be parsable
      by the parser. The default value is False.
  rK   rL   rM   rP   rN   )rQ   ÚrequiredÚhiddenN)rR   r   ÚConceptParserÚForResourcer=   ÚAddToParser)ÚparserrT   r(   rU   rV   r[   r   r\   s           r   ÚAddKmsKeyResourceArgra   ×   sj   € ñ> 
Ø2×9Ñ9Ø<Ø3ó€Oô ×Ñ×+Ñ+Ø
ÜÐ/AÔBðß"™F 8¨_Ó=Ø(ØØð ,ó ÷ KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   zThe KMS key resource.©r[   )r   r]   r^   r=   r_   ©r`   r[   r   s      r   ÚAddKmsKeyResourceArgForKMSre     s8   € Ü×Ñ×+Ñ+Ø
Ü uÔ-ØØð	 ,ó ÷
 KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   zThe KMS keyring resource.rc   )r   r]   r^   r?   r_   rd   s      r   ÚAddKmsKeyringResourceArgForKMSrg     ó8   € Ü×Ñ×+Ñ+Ø
Ü¨5Ô1Ø!Øð	 ,ó ÷
 KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   zThe KMS key-handle resource.rc   )r   r]   r^   rB   r_   rd   s      r   Ú AddKmsKeyHandleResourceArgForKMSrj     s8   € Ü×Ñ×+Ñ+Ø
Ü!¨UÔ3Ø$Øð	 ,ó ÷
 KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   z The KMS ekm connection resource.rc   )r   r]   r^   rE   r_   rd   s      r   Ú$AddKmsEkmConnectionResourceArgForKMSrl   !  s8   € Ü×Ñ×+Ñ+Ø
Ü%°Ô7Ø(Øð	 ,ó ÷
 KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   zThe KMS location resource.rc   )r   r]   r^   rG   r_   rd   s      r   ÚAddKmsLocationResourceArgForKMSrn   *  s8   € Ü×Ñ×+Ñ+Ø
Ü ¨EÔ2Ø"Øð	 ,ó ÷
 KÕr   c                 ó|   — t         j                  j                  |t        d¬«      d|¬«      j	                  | «       y )NFr1   zThe KMS project resource.rc   )r   r]   r^   rI   r_   rd   s      r   ÚAddKmsProjectResourceArgForKMSrp   3  rh   r   )T)TF)FNN)FNNFrO   F)#Ú__doc__Ú
__future__r   r   r   Ú googlecloudsdk.calliope.conceptsr   r   Ú(googlecloudsdk.command_lib.util.conceptsr   r	   Úgooglecloudsdk.corer
   r   r   r   r   r!   r)   r/   r:   r=   r?   rB   rE   rG   rI   rY   ra   re   rg   rj   rl   rn   rp   © r   r   Ú<module>rw      s±   ðñ /å &Ý Ý 'å 5Ý 1Ý DÝ GÝ *óóóóóó	óó
óó
ó
ó
ó	óð ØØó	)ð^ ØØØØ	Øó,ò^òòòòór   