
    0                     l   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dZ ej"                  ej$                  j&                  ej$                  j(                  ej$                  j*                        ej,                   G d dej.                                      Zy)zCancels a Cloud Deploy rollout.    )rollout)
exceptions)base)delivery_pipeline_util)deploy_policy_util)flags)resource_args)logz{description}z     To cancel a rollout `test-rollout` for delivery pipeline `test-pipeline`, release `test-release` in region `us-central1`, run:

      $ {command} test-rollout --delivery-pipeline=test-pipeline --release=test-release --region=us-central1

)DESCRIPTIONEXAMPLESc                   h    e Zd ZdZeZed        Z ej                  e
j                        d        Zy)CancelzCancel a Rollout.c                 \    t        j                  | d       t        j                  |        y )NT)
positional)r	   AddRolloutResourceArgr   AddOverrideDeployPolicies)parsers    %lib/surface/deploy/rollouts/cancel.pyArgszCancel.Args0   s     ''4@	##F+    c                 R   |j                   j                  j                         }|j                         j                         }t	        j
                  |j                               }dj                  |j                               }t	        j                  ||       t        j                  j                  dj                  |j                                      t        j                  ||j                        }t        j                         j!                  |j                         |      S )NzCannot cancel rollout {}.zCancelling rollout {}.
)CONCEPTSr   ParseParentr   GetPipelineRelativeNameformatThrowIfPipelineSuspendedr
   statusPrintr   CreateDeployPolicyNamesFromIDsoverride_deploy_policiesRolloutClientCancelRollout)selfargsrollout_refpipeline_refpipeline_objfailed_activity_msgpoliciess          r   Runz
Cancel.Run5   s     --''--/K%%'..0L)55!!#L 6<<  " 33) JJ"))+*B*B*DE
 "@@d33H   "00  "H r   N)__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr,    r   r   r   r   '   sI    
  -, , 544))r   r   N)r0   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilr   r4   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr   r   r6   r   r	   googlecloudsdk.corer
   r1   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyCreateCommandr   r8   r   r   <module>rE      s    & 7 F ( D @ M 3 ; # # T..33T5F5F5I5I %T % %r   