
                            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SKJr  SSS.rSrS r\R*                  " \R,                  R.                  \R,                  R0                  \R,                  R2                  5      \R4                   " S S\R6                  5      5       5       rg)z!Promote new Cloud Deploy release.    )release)
exceptions)base)delivery_pipeline_util)deploy_policy_util)flags)promote_util)release_util)resource_args)
console_ioz{description}z   To promote a release called 'test-release' for delivery pipeline 'test-pipeline' in region 'us-central1' to target 'prod', run:

  $ {command} --release=test-release --delivery-pipeline=test-pipeline --region=us-central1 --to-target=prod


)DESCRIPTIONEXAMPLESrolloutc                 L   [         R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U [        5        [        R                  " U [        5        [        R                  " U 5        [        R                  " U 5        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.
N)
r   AddReleaseResourceArgr   AddToTargetAddRolloutIDAddAnnotationsFlag_ROLLOUTAddLabelsFlagAddStartingPhaseIdAddOverrideDeployPoliciesparsers    &lib/surface/deploy/releases/promote.py_CommonArgsr   ,   sj     %%f-FV68,fh'6"!!&)    c                   p    \ rS rSrSr\r\S 5       r\	R                  " \R                  5      S 5       rSrg)Promote<   zPromotes a release from one target (source), to another (destination).

If to-target is not specified the command promotes the release from the target
that is farthest along in the promotion sequence to its next stage in the
promotion sequence.
c                     [        U 5        g )N)r   r   s    r   ArgsPromote.ArgsJ   s
    r   c                    UR                   R                  R                  5       nUR                  5       n[        R
                  " UR                  5       5      nSR                  UR                  5       5      n[        R                  " XE5        [        R                  " 5       R                  UR                  5       5      n[        R                  " US5        UR                  (       a%  [        R                  " SUR                  5       5      eUR                   nU(       d.  ["        R$                  " US5      n["        R&                  " X&U5        [        R(                  " X&UR                   5        [*        R,                  " SR                  UR/                  5       U5      SS9  [0        R2                  " X1R4                  5      n["        R6                  " UUUSUR8                  UR:                  UR<                  UR>                  US9	n	U	$ )	NzCannot promote release {}.zpromote this releasezCannot promote release.Fz"Promoting release {} to target {}.T)cancel_on_no)
rollout_idannotationslabelsstarting_phase_idoverride_deploy_policies) CONCEPTSr   ParseParentr   GetPipelineRelativeNameformatThrowIfPipelineSuspendedReleaseClientGetr
   CheckReleaseSupportState	abandoneddeploy_exceptionsAbandonedReleaseError	to_targetr	   GetToTargetIDCheckIfInProgressRollout	PrintDiffr   PromptContinueNamer   CreateDeployPolicyNamesFromIDsr*   r   r&   r'   r(   r)   )
selfargsrelease_refpipeline_refpipeline_objfailed_activity_msgrelease_objto_target_idpoliciesrollout_resources
             r   RunPromote.RunN   s    --''--/K%%'L)55!!#L 7==  " 33 '')--k.F.F.HIK))+7MN33
#[%=%=%? 
 >>L!//UCl ++
L ;T^^D,33	
 	 "@@33H $++??$${{00!)
 r    N)__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpstaticmethodr"   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr6   HTTP_ERROR_FORMATrI   __static_attributes__rK   r   r   r   r   <   sH    
 !-  44))88r   r   N)rP   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilr   rT   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr   r   r6   r   r	   r
   r   googlecloudsdk.core.consoler   rQ   r   r   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyCreateCommandr   rK   r   r   <module>rd      s    ( 7 F ( D @ M 3 : : ; 2 #	 *  T..33T5F5F5I5I Id   I Ir   