
                         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>Ignores a job and phase combination on a Cloud Deploy rollout.    )rollout)
exceptions)base)delivery_pipeline_util)deploy_policy_util)flags)resource_args)logz{description}aE       To ignore a job `test-job` in phase `test-phase` on a rollout `test-rollout` for delivery pipeline `test-pipeline`, release `test-release` in region `us-central1`, run:

      $ {command} test-rollout --job-id=test-job --phase-id=test-phase --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)	IgnoreJobz;Ignores a specified job and phase combination on a rollout.c                     t        j                  | d       t        j                  |        t        j                  |        t        j
                  |        y )NT)
positional)r	   AddRolloutResourceArgr   AddJobId
AddPhaseIdAddOverrideDeployPolicies)parsers    )lib/surface/deploy/rollouts/ignore_job.pyArgszIgnoreJob.Args0   s:    ''4@	NN6	V	##F+    c                    |j                   j                  j                         }|j                         j                         }t	        j
                  |j                               }dj                  |j                               }t	        j                  ||       t        j                  j                  dj                  |j                  |j                  |j                                      t        j                  ||j                         }t        j"                         j%                  |j                         |j                  |j                  |      S )Nz Cannot ignore job on rollout {}.z+Ignoring job {} in phase {} of rollout {}.
)override_deploy_policies)CONCEPTSr   ParseParentr   GetPipelineRelativeNameformatThrowIfPipelineSuspendedr
   statusPrintjob_idphase_idr   CreateDeployPolicyNamesFromIDsr   RolloutClientr   )selfargsrollout_refpipeline_refpipeline_objfailed_activity_msgpoliciess          r   RunzIgnoreJob.Run7   s    --''--/K%%'..0L)55!!#L =CC  " 33) JJ6==KK(@(@(B	
 "@@d33H   ",,  "!)	 -  r   N)__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr/    r   r   r   r   '   sJ    
 D -, , 544))r   r   N)r3   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilr   r7   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr   r   r9   r   r	   googlecloudsdk.corer
   r4   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyCreateCommandr   r;   r   r   <module>rH      s    E 7 F ( D @ M 3 ; # # T..33T5F5F5I5I +"" + +r   