
                         r   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d Z e	j&                  e	j(                  j*                  e	j(                  j,                  e	j(                  j.                        e	j0                   G d de	j2                                      Zy)z5Describes a Gcloud Deploy delivery pipeline resource.    )
exceptions)delivery_pipeline)base)describe)resource_args)target_util)logz{description}z   To describe a delivery pipeline called 'test-pipeline' in region 'us-central1', run:

     $ {command} test-pipeline --region=us-central1

)DESCRIPTIONEXAMPLESc                 2    t        j                  | d       y)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.
  T)
positionalN)r   AddDeliveryPipelineResourceArgparsers    1lib/surface/deploy/delivery_pipelines/describe.py_CommonArgsr   )   s     ..v$G    c                   h    e Zd ZdZeZed        Z ej                  e
j                        d        Zy)DescribeaS  Show details about a delivery pipeline.

  The output contains the following sections:

  Delivery Pipeline:

    - detail of the delivery pipeline to be described.

  Targets:

    - target name.

    - active release in the target.

    - timestamp of the last successful deployment.

    - list of the rollouts that require approval.
  c                     t        |        y )N)r   r   s    r   ArgszDescribe.ArgsL   s
    r   c                    |j                   j                  j                         }t        j                         j	                  |j                               }d|i}|j                         d   }g }|j                  j                  D ]  }t        j                  |j                  |j                         d   |      }	 t        j                  |      }	d|j                         i}t        j(                  ||      }t+        j,                  ||      }|	j.                  rt+        j0                  |||      }|j3                  |        ||d<   |S # t        j                  $ rr}
t        j                   dj#                  |j                  |
             t        j$                  j'                  dj#                  |j                               Y d}
~
Fd}
~
ww xY w)	z9This is what gets called when the user runs this command.zDelivery PipelinelocationsId
projectsIdzFailed to get target {}: {}zUnable to get target {}NTargetTargets)CONCEPTSr   ParseDeliveryPipelinesClientGetRelativeNameAsDictserialPipelinestagesr   TargetReferencetargetId	GetTargetapitools_exceptions	HttpErrorr	   debugformatstatusPrintGetCurrentRolloutr   SetCurrentReleaseAndRolloutrequireApprovalListPendingApprovalsappend)selfargspipeline_refpipelineoutputregiontargetsstage
target_ref
target_objerrordetailcurrent_rollouts                r   RunzDescribe.RunP   s   
 ==2288:L 88:>>!!#H "8,F  "=1FG((//..
..




-v7j **:6

 *1134f#55j,Oo33OVLf		#	#..z<PnnV 0"  F9M !** 		/66u~~uMN

299%..IJs   ;EGA'GGN)__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr@    r   r   r   r   3   sK    & !-  544))r   r   N)rD   apitools.base.pyr   r(   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilrH   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr   rJ   r   r   googlecloudsdk.corer	   rE   r   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyDescribeCommandr   rL   r   r   <module>rZ      s    < ? @ F ( 6 M ; 9 # 			
H D%%++T->->-C-C%%((*;t## ; *;r   