
                             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
lmZ dd
lmZ ddlmZ ddlmZ ddlmZ  G d dej,                        Zdddde_        y)zCommand for moving disks.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)
completers)flags)log)
properties)	resourcesc                   &    e Zd ZdZed        Zd Zy)MovezMove a disk between zones.c                    t        j                  d      t        _        t        j                  j	                  |        | j                  ddt        j                  d       t        j                  j                  |        y )NF)pluralz--destination-zonezThe zone to move the disk to.T)help	completerrequired)disks_flagsMakeDiskArgZonalr   disk_argAddArgumentadd_argumentr
   ZonesCompleterr	   
ASYNC_FLAGAddToParser)parsers    !lib/surface/compute/disks/move.pyArgsz	Move.Args$   s_    00>DMMMf%
,++	   	OO'    c                    t        j                  | j                               }t        j                  j                  ||j                  t        j                  |j                              }|j                  j                  |j                  dt        j                  j                  j                  j                   id      }|j                  j"                  }|j                  j$                  }|j'                  |j)                  |j+                         |j+                               |j                        }|j,                  j/                  |      }t        j0                  j                  |j2                  dt        j                  j                  j                  j                   id      }	|j4                  r8t7        j8                  |	dj;                  |j=                               d	d
       |S |j                  j                  |j=                         |j                  |j=                         dd      }
t?        j@                  |jB                  |
      }tE        jF                  ||	dj;                  |j=                                     S )z$Returns a request for moving a disk.)scope_listerprojectzcompute.zones)params
collection)destinationZone
targetDisk)diskMoveRequestr$   zcompute.globalOperationszdisk {0}Tz[Run the [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetails)r$   zonezcompute.diskszMoving disk {0})$r   ComputeApiHolderReleaseTrackr   r   ResolveAsResourcer   r   GetDefaultScopeListerclientParsedestination_zoner   VALUEScorer$   	GetOrFailapitools_clientmessagesComputeProjectsMoveDiskRequestDiskMoveRequestSelfLinkprojectsMoveDiskREGISTRYnameasync_r   UpdatedResourceformatNamer   Pollerdisksr   WaitFor)selfargsholdertarget_diskr4   r2   r9   requestresultoperation_refdestination_disk_refoperation_pollers               r   RunzMove.Run1   s6   **4+<+<+>?F--11f00? 2 AK ''--z((--55??
 # . $ ]]**F}}%%H55 00,557"++- 1 
 ## 6 G __%%g.F&&,,z((--55??
 . - /M {{	
  !1!1!34;	 m!++11'//$))+
 # 2 $ }}V\\3GH>>-  !1!1!346 6r!   N)__name__
__module____qualname____doc__staticmethodr    rQ    r!   r   r   r   !   s    "
( 
(76r!   r   zMove a disk between zonesa  *{command}* facilitates moving a Compute Engine disk volume from one zone to another. You cannot move a disk if it is attached to a running or stopped instance; use the gcloud compute instances move command instead.

The `gcloud compute disks move` command does not support regional persistent disks. See https://cloud.google.com/compute/docs/disks/regional-persistent-disk for more details.
zTo move the disk called example-disk-1 from us-central1-b to us-central1-f, run:

  $ {command} example-disk-1 --zone=us-central1-b --destination-zone=us-central1-f
)briefDESCRIPTIONEXAMPLESN)rU   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r   (googlecloudsdk.command_lib.compute.disksr   googlecloudsdk.corer   r   r   SilentCommandr   detailed_helprW   r!   r   <module>re      s_      &  ' 7 < . ( 9 4 I # * )G64 G6V )		- r!   