
    z                         S r SSKJr  SSKJr  SSKJr  SSSS.rS	 r	\R                  " \R                  R                  5      \R                   " S
 S\R                  5      5       5       r\\l        g)z6Command for updating the KMS key of a persistent disk.    )base_classes)base)flags?Rotate the KMS key of a persistent disk to the primary version.z
        * {command} * updates the KMS key of a Compute Engine persistent disk
        by rotating it to the primary version of the key.
    z
        To rotate the KMS key of a disk named example-disk-1 to the primary version, run:

          $ {command} example-disk-1 --zone us-central1-a
    )briefDESCRIPTIONEXAMPLESc                 J    [         R                  " SS9R                  U 5        g)z5Add arguments used for parsing in all command tracks.FpluralN)disks_flagsMakeDiskArgAddArgument)parsers    +lib/surface/compute/disks/update_kms_key.py_CommonArgsr   $   s    '33F;    c                   H    \ rS rSrSr\S 5       r\S	S j5       rS rS r	Sr
g)
UpdateKmsKey)   r   c                     [        U5        g N)r   )clsr   s     r   ArgsUpdateKmsKey.Args.   s
    r   c                 L    [         R                  " U R                  5       U5      $ r   )r   ComputeApiHolderReleaseTrack)r   no_https     r   _GetApiHolderUpdateKmsKey._GetApiHolder2   s    (()9)9);WEEr   c                 $    U R                  U5      $ r   )_Run)selfargss     r   RunUpdateKmsKey.Run6   s    99T?r   c                 z   U R                  5       nUR                  nUR                  nUR                  n[        R
                  " SS9R                  X5      nUR                  5       S:X  a^  UR                  R                  nUR                  UR                  UR                  UR                  5       S9nUR                  USU4/5      $ UR                  5       S:X  a^  UR                  R                  nUR!                  UR                  UR"                  UR                  5       S9nUR                  USU4/5      $ g)	z2Issues request for updating the KMS key of a disk.Fr   zcompute.disks)projectzonediskr   zcompute.regionDisks)r)   regionr+   N)r    clientmessages	resourcesr   r   ResolveAsResource
Collectionapitools_clientdisksComputeDisksUpdateKmsKeyRequestr)   r*   NameMakeRequestsregionDisks%ComputeRegionDisksUpdateKmsKeyRequestr,   )	r$   r%   compute_holderr-   r.   r/   disk_refservicerequests	            r   r#   UpdateKmsKey._Run9   s/   '')N""FH((I&&e4FFH /&&,,g88""}}}} 9 g
   7NG"D!EFF				"7	7&&22g>>""}} ? g
   7NG"D!EFF 
8r    N)F)__name__
__module____qualname____firstlineno____doc__classmethodr   r    r&   r#   __static_attributes__r>   r   r   r   r   )   s;     H  F FGr   r   N)rC   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   (googlecloudsdk.command_lib.compute.disksr   r   DETAILED_HELPr   ReleaseTracksr   ALPHAUniverseCompatibleCommandr   detailed_helpr>   r   r   <module>rO      s    = 8 ( I O<
 D%%++,(G4<< (G  -(GV + r   