
    0                     l   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S.r\R"                  " \R$                  R&                  \R$                  R(                  \R$                  R*                  5      \R,                   " S S\R.                  5      5       5       rg)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                   p    \ rS rSrSr\r\S 5       r\	R                  " \R                  5      S 5       rSrg)Cancel'   zCancel a Rollout.c                 Z    [         R                  " U SS9  [        R                  " U 5        g )NT)
positional)r	   AddRolloutResourceArgr   AddOverrideDeployPolicies)parsers    %lib/surface/deploy/rollouts/cancel.pyArgsCancel.Args0   s     ''4@	##F+    c                 V   UR                   R                  R                  5       nUR                  5       R                  5       n[        R
                  " UR                  5       5      nSR                  UR                  5       5      n[        R                  " XE5        [        R                  R                  SR                  UR                  5       5      5        [        R                  " X1R                  5      n[        R                  " 5       R!                  UR                  5       U5      $ )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   Run
Cancel.Run5   s     --''--/K%%'..0L)55!!#L 6<<  " 33 JJ"))+*B*B*DE
 "@@33H   "00  "H r    N)__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr.   __static_attributes__r0   r   r   r   r   '   sF    
  -, , 44))r   r   N)r5   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilr   r9   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr   r   r;   r   r	   googlecloudsdk.corer
   r6   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyCreateCommandr   r0   r   r   <module>rJ      s    & 7 F ( D @ M 3 ; # # T..33T5F5F5I5I %T % %r   