
                            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KJ
r  SS	S
S.r\R                  " \R                  R                   5      \R"                   " S S\R$                  5      5       5       rg)zPCommand for waiting for the asynchronous replication of a disk-pair to catch up.    )absolute_import)division)unicode_literals)base_classes)base)flagszProvides the operation id for the asynchronous replication of a Compute Engine persistent disk-pair that can be used to wait for the replication to catch up.a.          *{command}* fetches the operation id that can be used to track the
        status of async replication for a Compute Engine persistent disk-pair.
        The operation id can be used to wait for the replication to catch up.
        This command can be invoked only on the primary disk.
        ag          Note: The max-wait-duration is optional. If not specified, the default
        value would be picked up from the API.
        Wait for replication catchup can only be invoked on the primary scope.
        To wait for the replication catchup for the primary disk 'my-disk-1' in
        zone 'us-east1-a' under project 'my-project1' to catch up with the
        secondary disk 'my-disk-2' in zone 'us-west1-a' in any project, the
        following command can be used (with custom wait duration of 20s):

          $ {command} my-disk-1 --zone=us-east1-a --project=my-project1 --max-wait-duration=20s
        )briefDESCRIPTIONEXAMPLESc                       \ rS rSrSr\R                  " SS9r\r	\
SS j5       r\
 SS\S\R                  4S	 jj5       rSS
 jrSrg)WaitForReplicationCatchUp4   zYWait for the Asynchronous Replication of Compute Engine persistent disk-pair to complete.F)pluralreturnNc                 b    [         R                  R                  U5        UR                  SSS9  g)zSet the arguments for this command.

Args:
  parser: An argument parser object that is used to add arguments that can
    be specified on the command line.

Returns:
  None
z--max-wait-durationz5Maximum duration to wait for the replication catchup.)helpN)r   	disks_argAddArgumentadd_argument)clsparsers     9lib/surface/compute/disks/wait_for_replication_catchup.pyArgsWaitForReplicationCatchUp.Args<   s1     ''33F;
D      no_httpc                 L    [         R                  " U R                  5       U5      $ )z~Get the compute client API holder instance.

Args:
  no_http: Whether to disable http.

Returns:
  A ComputeApiHolder object.
)r   ComputeApiHolderReleaseTrack)r   r   s     r   _GetApiHolder'WaitForReplicationCatchUp._GetApiHolderM   s      (()9)9);WEEr   c                 J   U R                  5       nUR                  n[        R                  R	                  UUR
                  [        R                  " U5      S9nUR                  5       S:X  a  SnUR                  S5      (       a#  UR                  R                  UR                  S9nUR                  R                  UR                  5       UR                  UR                   US9nUR"                  R$                  SU4nOSnUR                  S5      (       a#  UR                  R'                  UR                  S9nUR                  R)                  UR                  5       UR                  UR*                  US9nUR"                  R,                  SU4nUR/                  U/5      $ )	zMethod that runs the command.

Validates the arguments passed to the command and triggers the API call.

Args:
  args: The arguments that were provided to this command invocation.

Returns:
  None
)scope_listerzcompute.disksNmax_wait_duration)maxWaitDuration)diskprojectzone waitForReplicationCatchUpRequestr   )r&   r'   region&regionWaitForReplicationCatchUpRequest)r    clientr   r   ResolveAsResource	resourcesr   GetDefaultScopeLister
CollectionIsSpecifiedmessages WaitForReplicationCatchUpRequestr$   ,ComputeDisksWaitForReplicationCatchUpRequestNamer'   r(   apitools_clientdisks&RegionWaitForReplicationCatchUpRequest2ComputeRegionDisksWaitForReplicationCatchUpRequestr*   regionDisksMakeRequests)selfargscompute_holderr,   disk_ref$wait_for_replication_catchup_requestrequest+region_wait_for_replication_catchup_requests           r   RunWaitForReplicationCatchUp.Run[   s    '')N""F(22DD  008 E H /-1*			-	.	.OO<< $ 6 6 =  	-
 LL}}""}}+O	 M g 
 
 
&
&
%
g 591			-	.	.OOBB $ 6 6 C  	4
 RR}}""1\	 S g 
 
 
,
,
%
g
 y))r    )r   N)F)__name__
__module____qualname____firstlineno____doc__disks_flagsMakeDiskArgr   DETAILED_HELPdetailed_helpclassmethodr   boolr   r   r    rC   __static_attributes__rE   r   r   r   r   4   se     b%%U3)-    FF$$F F:*r   r   N)rJ   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   (googlecloudsdk.command_lib.compute.disksrK   rM   ReleaseTracksr   ALPHADefaultUniverseOnlyCommandr   rE   r   r   <module>r[      s}    W &  ' 7 ( 4 I	$
4 D%%++,_* _*  -_*r   