
                            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KJr  SS	KJr  SS
KJr  S r\R&                  " \R(                  R*                  5       " S S\R,                  5      5       r\R&                  " \R(                  R0                  5       " S S\5      5       r\R&                  " \R(                  R4                  5       " S S\5      5       rSSSS.\l        g)zRollback node pool command.    )absolute_import)division)unicode_literals)
exceptions)util)base)flags)log)
console_ioc                     [         R                  " U 5        [         R                  " U S5        [         R                  " U S5        [         R                  " U 5        U R                  S[        SSSS9  g)	zRegister flags for this command.

Args:
  parser: an argparse.ArgumentParser-like object. It is mocked out in order to
    capture some information, but behaves like an ArgumentParser.
z&The name of the node pool to rollback.z1The cluster from which to rollback the node pool.z	--timeouti  TzTHIS ARGUMENT NEEDS HELP TEXT.)typedefaulthiddenhelpN)r	   AddAsyncFlagAddNodePoolNameArgAddNodePoolClusterFlag!AddRespectPodDisruptionBudgetFlagadd_argumentintparsers    ,lib/surface/container/node_pools/rollback.py_Argsr      sh     V6#KLAC))&1+  -    c                   .    \ rS rSrSr\S 5       rS rSrg)Rollback4   Rollback a node-pool upgrade.c                     [        U 5        g Nr   r   s    r   ArgsRollback.Args8   	    	&Mr   c                    U R                   S   nU R                   S   nU" U5      nUR                  UR                  U5      n[        R                  " SR                  UR                  UR                  S9SSS9   UR                  U5        UR                  XQR                  S9nUR                  (       d4  UR                  USR                  UR                  5      UR                  S	9  [(        R*                  " U5        U$ ! [        R                   a*  n[         R"                  " U[$        R&                  5      eS
nAff = f)a  This is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.

Raises:
  util.Error, if rollback failed.
api_adapterlocation_getzNode Pool: [{node_pool_id}], of Cluster: [{cluster_name}] will be rolled back to previous configuration. This operation is long-running and will block other operations on the cluster (including delete) until it has run to completion.)node_pool_idcluster_nameT)messagethrow_if_unattendedcancel_on_no)respect_pdbzRolling back {0})	timeout_sN)contextParseNodePoolnamer   PromptContinueformat
nodePoolId	clusterIdGetNodePoolRollbackUpgrader.   async_WaitForOperationtimeoutapitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMATr
   UpdatedResource)selfargsadapterr(   locationpool_refop_referrors           r   RunRollback.Run<   s+    ll=)G<</LD!H$$TYY9H= >DV!,,8;M;M >D >O D(#&&x=M=M&Nf[[  %%h&9&9:ll 	! 	$ !M	 (( D$$UD,B,BCCDs   <A/D E%D<<E N)	__name__
__module____qualname____firstlineno____doc__staticmethodr#   rH   __static_attributes__rJ   r   r   r   r   4   s    % ,r   r   c                   (    \ rS rSrSr\S 5       rSrg)RollbackBetak   r   c                     [        U 5        g r!   r"   r   s    r   r#   RollbackBeta.Argso   r%   r   rJ   NrK   rL   rM   rN   rO   rP   r#   rQ   rJ   r   r   rS   rS   k       % r   rS   c                   (    \ rS rSrSr\S 5       rSrg)RollbackAlphat   r   c                     [        U 5        g r!   r"   r   s    r   r#   RollbackAlpha.Argsx   r%   r   rJ   NrW   rJ   r   r   rZ   rZ   t   rX   r   rZ   r   z
        Rollback a node-pool upgrade.

Rollback is a method used after a canceled or failed node-pool upgrade. It
makes a best-effort attempt to revert the pool back to its original state.
z        To roll back a canceled or failed upgrade in "node-pool-1" in the
        cluster "sample-cluster", run:

          $ {command} node-pool-1 --cluster=sample-cluster
        )briefDESCRIPTIONEXAMPLESN)rO   
__future__r   r   r   apitools.base.pyr   r<    googlecloudsdk.api_lib.containerr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.containerr	   googlecloudsdk.corer
   googlecloudsdk.core.consoler   r   ReleaseTracksReleaseTrackGACommandr   BETArS   ALPHArZ   detailed_helprJ   r   r   <module>ro      s    " &  ' > 1 ( . 6 # 2-* D%%(()3t|| 3 *3l D%%**+8  , D%%++,H  - 	(		 r   