
                         
   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	d
dZd Z ej                  ej                  j                         ej"                   G d dej$                                      Zee_        y)z6Command for updating the KMS key of a persistent disk.    )absolute_import)division)unicode_literals)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                 N    t        j                  d      j                  |        y)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                   >    e Zd ZdZed        Zedd       Zd Zd Zy)UpdateKmsKeyr	   c                     t        |       y N)r   )clsr   s     r   ArgszUpdateKmsKey.Args1   s
    r   c                 J    t        j                  | j                         |      S r   )r   ComputeApiHolderReleaseTrack)r   no_https     r   _GetApiHolderzUpdateKmsKey._GetApiHolder5   s    (()9)9);WEEr   c                 $    | j                  |      S r   )_Run)selfargss     r   RunzUpdateKmsKey.Run9   s    99T?r   c                 x   | j                         }|j                  }|j                  }|j                  }t	        j
                  d      j                  ||      }|j                         dk(  r]|j                  j                  }|j                  |j                  |j                  |j                               }|j                  |      S |j                         dk(  r]|j                  j                  }|j!                  |j                  |j"                  |j                               }|j                  |      S y)z2Issues request for updating the KMS key of a disk.Fr   zcompute.disks)projectzonediskzcompute.regionDisks)r(   regionr*   N)r!   clientmessages	resourcesr   r   ResolveAsResource
Collectionapitools_clientdisksComputeDisksUpdateKmsKeyRequestr(   r)   Namer   regionDisks%ComputeRegionDisksUpdateKmsKeyRequestr+   )	r$   r%   compute_holderr,   r-   r.   disk_refservicerequests	            r   r#   zUpdateKmsKey._Run<   s   '')N""FH((I&&e4FFiH /&&,,g88""}}}} 9 g
 !!'**				"7	7&&22g>>""}} ? g
 !!'** 
8r   N)F)	__name__
__module____qualname____doc__classmethodr   r!   r&   r#    r   r   r   r   ,   s:     H  F F+r   r   N)r>   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   (googlecloudsdk.command_lib.compute.disksr   r   DETAILED_HELPr   ReleaseTracksr   ALPHAUniverseCompatibleCommandr   detailed_helpr@   r   r   <module>rK      s    = &  ' 7 ( I O<
 D%%++,(+4<< (+  -(+V + r   