
    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	d
dZd Z ej                  ej                  j                         ej"                   G d dej$                                      Zee_        y)z:Command for updating the KMS key of a persistent snapshot.    )absolute_import)division)unicode_literals)base_classes)base)flagsz0Update the KMS key of a Compute Engine snapshot.zW
        * {command}* updates the KMS key of a Compute Engine persistent snapshot.
    zz
        To update the KMS key of a snapshot named example-snapshot-1, run:

          $ {command} example-snapshot-1
    )briefDESCRIPTIONEXAMPLESc                 z    t        j                  d      j                  | d       | j                  ddd       y)	z5Add arguments used for parsing in all command tracks.Fpluralzupdate the KMS key for)operation_typez--regionz%The region of the snapshot to update.)helprequiredN)snapshots_flagsMakeSnapshotArgAddArgumentadd_argument)parsers    /lib/surface/compute/snapshots/update_kms_key.py_CommonArgsr   &   sD    !!/;;5 <  	2      c                   8    e Zd ZdZed        Zedd       Zd Zy)UpdateKmsKeyz,Update the KMS key of a persistent snapshot.c                     t        |       y N)r   )clsr   s     r   ArgszUpdateKmsKey.Args7   s
    r   c                 J    t        j                  | j                         |      S r   )r   ComputeApiHolderReleaseTrack)r   no_https     r   _GetApiHolderzUpdateKmsKey._GetApiHolder;   s    (()9)9);WEEr   c                    | j                         }|j                  }|j                  }|j                  r1t	        j
                  d      j                  ||j                        }n0t	        j                  d      j                  ||j                        }|j                         dk(  rR|j                  j                  }|j                  |j                  |j                               }|j                  |      S |j                         dk(  r]|j                  j                   }|j#                  |j                  |j                  |j                               }|j                  |      S y )NFr   zcompute.snapshots)projectsnapshotzcompute.regionSnapshots)r&   regionr'   )r$   clientmessagesr(   r   #MakeSnapshotArgForRegionalSnapshotsResolveAsResource	resourcesr   
Collectionapitools_client	snapshots#ComputeSnapshotsUpdateKmsKeyRequestr&   Namer   regionSnapshots)ComputeRegionSnapshotsUpdateKmsKeyRequest)selfargscompute_holderr)   r*   snapshot_refservicerequests           r   RunzUpdateKmsKey.Run?   sQ   '')N""FH{{$HH$ 8 89  %44$ 8 89   $77&&00g<<&&$$& = g !!'**		 	 	"&?	?&&66gBB&&$$$$& C g
 !!'** 
@r   N)F)__name__
__module____qualname____doc__classmethodr   r$   r;    r   r   r   r   2   s4     5  F F+r   r   N)r?   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.compute.snapshotsr   r   DETAILED_HELPr   ReleaseTracksr"   ALPHAUniverseCompatibleCommandr   detailed_helprA   r   r   <module>rL      s    A &  ' 7 ( Q @
	 D%%++,'+4<< '+  -'+T + r   