
    '                         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	r\R                  " \R                  R                   5       " S
 S\R"                  \R$                  5      5       rg)zdeployments cancel command.    )
exceptions)dm_api_util)dm_base)base)dm_util)dm_write)flagsi  c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	CancelPreview"   zCancel a pending or running deployment preview.

This command will cancel a currently running or pending preview operation on
a deployment.
EXAMPLESa  
To cancel a running operation on a deployment, run:

  $ {command} my-deployment

To issue a cancel preview command without waiting for the operation to complete, run:

  $ {command} my-deployment --async

To cancel a preview command providing a fingerprint:

  $ {command} my-deployment --fingerprint=deployment-fingerprint

When a deployment preview is cancelled, the deployment itself is not
deleted.
c                     [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        g)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use to add arguments that go
      on the command line after this command. Positional arguments are
      allowed.
N)r	   AddDeploymentNameFlagAddAsyncFlagAddFingerprintFlag)parsers    <lib/surface/deployment_manager/deployments/cancel_preview.pyArgsCancelPreview.Args=   s.     
'	v	V$    c           
      "   UR                   (       a!  [        R                  " UR                   5      nOS[        R                  " U R
                  U R                  [        R                  " 5       UR                  5      =(       d    Sn U R
                  R                  R                  U R                  R                  [        R                  " 5       UR                  U R                  R                  US9S95      n[        R                  " U R
                  U R                  [        R                  " 5       UR                  5      n[        R                  " U5        UR(                  (       a  U$ UR*                  n [,        R.                  " U R
                  U R                  US[        R                  " 5       [0        S9n[        R2                  " US5         U R
                  R4                  R7                  U R                  R9                  [        R                  " 5       UR                  S95      nUR4                  (       a  UR4                  $ / $ ! [        R                    a*  n["        R$                  " U[        R&                  5      eSnAff = f! [        R                    a*  n["        R$                  " U[        R&                  5      eSnAff = f! [        R                    a*  n["        R$                  " U[        R&                  5      eSnAff = f)	ag  Run 'deployments cancel-preview'.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
      with.

Returns:
  If --async=true, returns Operation to poll.
  Else, returns boolean indicating whether cancel preview operation
  succeeded.

Raises:
  HttpException: An http error response was received while executing api
      request.
r   )fingerprint)project
deploymentdeploymentsCancelPreviewRequestNzcancel-preview)timeoutzCancel preview)r   r   )r   r   DecodeFingerprintr   FetchDeploymentFingerprintclientmessagesr   
GetProjectdeployment_namedeploymentsr   0DeploymentmanagerDeploymentsCancelPreviewRequestDeploymentsCancelPreviewRequestPrintFingerprintapitools_exceptions	HttpErrorr   HttpExceptionHTTP_ERROR_FORMATasync_namer   WaitForOperationOPERATION_TIMEOUTLogOperationStatus	resourcesList%DeploymentmanagerResourcesListRequest)selfargsr   	operationnew_fingerprinterrorop_nameresponses           r   RunCancelPreview.RunJ   ss   " --d.>.>?k
  ::
++
--






	! ( %(	 K++))77
--
:
:((*--mm;;) < 	 ; 
i $>>
++
--






	 o
 / {{g
M--KKMM %'	 	""9.>?M;;((--MM??**,// @ 
 &.%7%7x!!?R?5 (( K$$UK,I,IJJK !** M&&uk.K.KLLM !** M&&uk.K.KLLMsQ   CI 9AJ A6K K J"%JJK#%KKL$%L		L N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r:   __static_attributes__r<   r   r   r   r   "   s3      -& 
% 
%LMr   r   N)rA   apitools.base.pyr   r'   )googlecloudsdk.api_lib.deployment_managerr   r   googlecloudsdk.callioper   -googlecloudsdk.command_lib.deployment_managerr   r   r	   r.   UseDmApiDmApiVersionV2Command	DmCommandr   r<   r   r   <module>rN      sp     " ? A = ( . A B ?   	'&&))*sMDLL'"3"3 sM +sMr   