
    p                         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dZ G d dej&                        Zee_        y)zDelete node pool command.    )absolute_import)division)unicode_literals)
exceptions)util)base)flags)log)
console_ioa          *{command}* deletes a node pool from a Google Kubernetes Engine (GKE)
        cluster. When you delete a node pool, GKE drains all the nodes in the
        node pool. The draining process involves GKE deleting Pods on each node
        in the node pool. Each node in a node pool is drained by deleting Pods
        with an allotted graceful termination period of `MAX_POD`. `MAX_POD` is
        the maximum `terminationGracePeriodSeconds` set on the Pods scheduled to
        the node with a cap of one hour.
        z        To delete the "node-pool-1" node pool from the cluster
        "sample-cluster", run:

          $ {command} node-pool-1 --cluster=sample-cluster
        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)Deletez2Delete an existing node pool in a running cluster.c                     t        j                  | d       | j                  dt        ddd       t        j                  |        t        j
                  | d       y)	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 delete.z	--timeouti  TzTHIS ARGUMENT NEEDS HELP TEXT.)typedefaulthiddenhelpz/The cluster from which to delete the node pool.N)r	   AddNodePoolNameArgadd_argumentintAddAsyncFlagAddNodePoolClusterFlag)parsers    *lib/surface/container/node_pools/delete.pyArgszDelete.Args6   s\     
V%KL
-  / 
v	  AC    c           	      
   | j                   d   }| j                   d   } ||      }|j                  |j                  |      }t        j                  dj                  |j                  |j                  |j                  |            dd       	 |j                  |       |j                  |      }|j                  r9|j                  |      }|j                  d      st        j                  |_        |S |j!                  |dj                  |j                        |j"                  	       t/        j0                  |       |S # t$        j&                  $ r)}t)        j*                  |t        j,                        d
}~ww xY w)zThis 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.
    api_adapterlocation_getzVThe following node pool will be deleted.
[{name}] in cluster [{clusterId}] in [{zone}])name	clusterIdzoneT)messagethrow_if_unattendedcancel_on_noformatzDeleting node pool {0})	timeout_sN)contextParseNodePoolr!   r   PromptContinuer'   
nodePoolIdr"   ZoneGetNodePoolDeleteNodePoolasync_GetOperationIsSpecifiedr   OPERATIONS_FORMATWaitForOperationtimeoutapitools_exceptions	HttpErrorr   HttpExceptionHTTP_ERROR_FORMATr
   DeletedResource)	selfargsadapterr    locationpool_refop_refoperrors	            r   Runz
Delete.RunJ   s`    ll=)G<</LD!H$$TYY9HABH&"--'11!,,x0 CI C2 !D(#%%h/f	!!&))..$+	

"
)
)(*=*=
>LL  " !M	 (( D$$UD,B,BCCDs   A&E 87E F$E==FN)__name__
__module____qualname____doc__staticmethodr   rC    r   r   r   r   3   s    :C C&+r   r   N)rG   
__future__r   r   r   apitools.base.pyr   r6    googlecloudsdk.api_lib.containerr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.containerr	   googlecloudsdk.corer
   googlecloudsdk.core.consoler   DETAILED_HELPDeleteCommandr   detailed_helprI   r   r   <module>rT      sX      &  ' > 1 ( . 6 # 2		*BT BJ % r   