
    ;                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  S+S jrS+S	 jrS+S
 jrS+S jrS+S jrS+S jrS+S jrS+S jrS,S jrS+S jrS+S jrS+S jrS,S jrS,S jrS,S jrS,S jr S,S jr S,S jrS,S jrS,S jrS+S jr S,S jr    S-S jr!      S.S  jr"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,g)/z(Shared resource flags for kms resources.    )cast)concepts)deps)concept_parsers)presentation_specs)
propertiesc                 B    U (       a  SOSn[         R                  " USS9$ )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                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-keykeyzThe KMS key of the {resource}.r
   r   r   s     r   KeyAttributeConfigr   "   s$     e$		2	2;
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-keyringkeyringz"The KMS keyring of the {resource}.r
   r   r   s     r   KeyringAttributeConfigr   )   s$    $)$		2	2?
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-key-handle
key-handlez%The KMS key-handle of the {resource}.r
   r   r   s     r   KeyHandleAttributeConfigr   0   s%    '	\$		2	2B
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-ekmconnectionekmconnectionz)The KMS ekm connection of the {resource}.r
   r   r   s     r   EkmConnectionAttributeConfigr   7   s%     *	$		2	2F
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-single_tenant_hsm_instancesingle_tenant_hsm_instancez5The KMS single tenant HSM instance of the {resource}.r
   r   r   s     r   &SingleTenantHsmInstanceAttributeConfigr"   >   s/     
 '' 
 
	2	2G
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-proposalproposalz>The KMS single tenant HSM instance proposal of the {resource}.r
   r   r   s     r   .SingleTenantHsmInstanceProposalAttributeConfigr%   J   s$    %:$		2	2
J
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-operation	operationz$The KMS operation of the {resource}.r
   r   r   s     r   OperationAttributeConfigr(   T   s$    &K$		2	26
 r   c                     U (       a  SOSn/ nU(       a%  UR                  [        R                  " S5      5        [        R                  " USUS9$ )Nzkms-locationlocationz--regionz-The Google Cloud location for the {resource}.r   r   fallthroughs)appendr   ArgFallthroughr   r   )r   region_fallthroughr   r,   s       r   LocationAttributeConfigr0   \   sH    %:$,++J78		2	2?
 r   c                     U (       a  SOSn[         R                  " US[        R                  " [        R
                  R                  R                  5      /S9$ )Nzkms-projectprojectz,The Google Cloud project for the {resource}.r+   )r   r   r   PropertyFallthroughr   VALUEScorer2   r   s     r   ProjectAttributeConfigr6   h   sG    $)$		2	2>,,Z->->-C-C-K-KLM
 r   c                 B    U (       a  SOSn[         R                  " USS9$ )Nzkms-retired-resourceretired-resourcez+The KMS retired resource of the {resource}.r
   r   r   s     r   RetiredResourceAttributeConfigr9   q   s&    #-	3E$		2	2H
 r   c                     [         R                  " SS[        U 5      [        U 5      [	        U 5      [        U S9[        U S9SS9$ )NzAcloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersionszkey versionr   F)resource_namecryptoKeyVersionsIdcryptoKeysId
keyRingsIdlocationsId
projectsIddisable_auto_completers)r   ResourceSpecr   r   r   r0   r6   r;   s    r   GetKmsKeyVersionResourceSpecrD   x   sF    			I!3J?%j1'
3)Z@':>#	
 	r   c                 z    [         R                  " SS[        U 5      [        U 5      [	        XS9[        U 5      SS9$ )Nz/cloudkms.projects.locations.keyRings.cryptoKeysr   r   r/   F)r<   r>   r?   r@   rA   rB   )r   rC   r   r   r0   r6   rF   s     r   GetKmsKeyResourceSpecrG      sC    			7%j1'
3) (
3#

 
r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz$cloudkms.projects.locations.keyRingsr   rF   F)r<   r?   r@   rA   rB   )r   rC   r   r0   r6   rF   s     r   GetKmsKeyRingResourceSpecrI      s;    			,'
3) (
3#	
 	r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz&cloudkms.projects.locations.keyHandlesr   rF   F)r<   keyHandlesIdr@   rA   rB   )r   rC   r   r0   r6   rF   s     r   GetKmsKeyHandleResourceSpecrL      s;    			. +J7) (
3#	
 	r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz*cloudkms.projects.locations.ekmConnectionsr   rF   F)r<   ekmConnectionsIdr@   rA   rB   )r   rC   r   r0   r6   rF   s     r   GetKmsEkmConnectionResourceSpecrO      s;    			2#3J?) (
3#	
 	r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz4cloudkms.projects.locations.singleTenantHsmInstancessingleTenantHsmInstancerF   F)r<   singleTenantHsmInstancesIdr@   rA   rB   )r   rC   r"   r0   r6   rF   s     r   )GetKmsSingleTenantHsmInstanceResourceSpecrS      sB     
		<-!G
" * (
3#
 r   c                 z    [         R                  " SS[        U 5      [        U 5      [	        XS9[        U 5      SS9$ )Nz>cloudkms.projects.locations.singleTenantHsmInstances.proposalssingleTenantHsmInstanceProposalrF   F)r<   proposalsIdrR   r@   rA   rB   )r   rC   r%   r"   r0   r6   rF   s     r   1GetKmsSingleTenantHsmInstanceProposalResourceSpecrW      sJ     
		F5@L!G
" * (
3#
 r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz&cloudkms.projects.locations.operationsr'   rF   F)r<   operationsIdr@   rA   rB   )r   rC   r(   r0   r6   rF   s     r   GetKmsOperationResourceSpecrZ      s;    			.+J7) (
3#	
 	r   c           	      R    [         R                  " SS[        XS9[        U 5      SS9$ )Nzcloudkms.projects.locationsr*   rF   F)r<   r@   rA   rB   )r   rC   r0   r6   rF   s     r   GetKmsLocationResourceSpecr\      s3    			#) (
3#
 r   c                 B    [         R                  " SS[        U 5      SS9$ )Nzcloudkms.projectsr2   F)r<   rA   rB   )r   rC   r6   r;   s    r   GetKmsProjectResourceSpecr^      s&    			'
3#	
 r   c           
      f    [         R                  " SS[        U 5      [        XS9[	        U 5      SS9$ )Nz,cloudkms.projects.locations.retiredResourcesr8   rF   F)r<   retiredResourcesIdr@   rA   rB   )r   rC   r9   r0   r6   rF   s     r   !GetKmsRetiredResourceResourceSpecra      s=     
		4&7
C) (
3#	
 	r   Nc                     U(       d  SR                  SS5      nSR                  X5      n[        R                  " S[        US9UU=(       d    0 S9nU$ )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   ResourcePresentationSpecrG   )resourcer/   flag_overridespermission_info
group_helppresentation_specs         r   GetKmsKeyPresentationSpecrq     sc    0 
299<3O%%+VH%F 
 )AA/AB(.B	 
r   c           	          U(       d  SR                  SS5      n[        R                  R                  U[	        US9SR                  X5      UUUS9R                  U 5        g)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.
rc   rd   re   rh   rf   )ri   requiredhiddenN)rj   r   ConceptParserForResourcerG   AddToParser)parserrl   r/   rm   rn   rs   r   rt   s           r   AddKmsKeyResourceArgry   :  sh    > 
299<3O ++
/AB"F8=( ,  Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS key resource.rs   )r   ru   rv   rG   rw   rx   rs   r   s      r   AddKmsKeyResourceArgForKMSr}   i  s8    ++
u-	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS keyring resource.r{   )r   ru   rv   rI   rw   r|   s      r   AddKmsKeyringResourceArgForKMSr   r  8    ++
51!	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS key-handle resource.r{   )r   ru   rv   rL   rw   r|   s      r    AddKmsKeyHandleResourceArgForKMSr   {  s8    ++
!U3$	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   z The KMS ekm connection resource.r{   )r   ru   rv   rO   rw   r|   s      r   $AddKmsEkmConnectionResourceArgForKMSr     s8    ++
%7(	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   z,The KMS single tenant HSM instance resource.r{   )r   ru   rv   rS   rw   r|   s      r   .AddKmsSingleTenantHsmInstanceResourceArgForKMSr     s8    ++
/5A4	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   z5The KMS single tenant HSM instance proposal resource.r{   )r   ru   rv   rW   rw   r|   s      r   6AddKmsSingleTenantHsmInstanceProposalResourceArgForKMSr     s:     ++
75I=	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS operation resource.r{   )r   ru   rv   rZ   rw   r|   s      r    AddKmsOperationResourceArgForKMSr     s8    ++
!U3#	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS location resource.r{   )r   ru   rv   r\   rw   r|   s      r   AddKmsLocationResourceArgForKMSr     s8    ++
 E2"	 , 
 Kr   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS project resource.r{   )r   ru   rv   r^   rw   r|   s      r   AddKmsProjectResourceArgForKMSr     r   r   c                 p    [         R                  R                  U[        SS9SUS9R	                  U 5        g )NFr;   zThe KMS retired resource.r{   )r   ru   rv   ra   rw   r|   s      r   &AddKmsRetiredResourceResourceArgForKMSr     s8    ++
'59!	 , 
 Kr   )T)TF)FNN)FNNFrg   F)-__doc__typingr    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   r   r   r   r   r   r"   r%   r(   r0   r6   r9   rD   rG   rI   rL   rO   rS   rW   rZ   r\   r^   ra   rq   ry   r}   r   r   r   r   r   r   r   r   r    r   r   <module>r      s    /  5 1 D G *		



 ).$ ).$
	 )." 	)^ 	,^r   