
    G                        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  e
j                  e
j                  j                          G d	 d
ej"                  e
j$                               Zy)zmanifests describe command.    )absolute_import)division)unicode_literals)
exceptions)dm_api_util)dm_base)basec                   .    e Zd ZdZddiZed        Zd Zy)DescribezkProvide information about a manifest.

  This command prints out all available details about a manifest.
  EXAMPLESz
To display information about a manifest, run:

  $ {command} --deployment=my-deployment manifest-name

To display information about the latest manifest, run:

  $ {command} --deployment=my-deployment
c                 T    | j                  ddd       | j                  ddd       y	)
zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    z--deploymentzDeployment name.T)helprequiredmanifest?zManifest name.)nargsr   N)add_argument)parsers    4lib/surface/deployment_manager/manifests/describe.pyArgszDescribe.Args2   s0     -?$O

#4DE    c                    |j                   }|s	 | j                  j                  j                  | j                  j                  t        j                         |j                              }t        j                  |      }|s"t        j                   d|j                  z        	 | j                  j"                  j                  | j                  j%                  t        j                         |j                  |            S # t        j                  $ r}t        j                  |      d}~ww xY w# t        j                  $ r)}t        j                  |t        j&                        d}~ww xY w)a  Run 'manifests describe'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The requested manifest.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    )project
deploymentNzWThe deployment [%s] does not have a current manifest. Please specify the manifest name.)r   r   r   )r   clientdeploymentsGetmessages&DeploymentmanagerDeploymentsGetRequestr   
GetProjectr   apitools_exceptions	HttpErrorr   HttpExceptionr   ExtractManifestNamedm_exceptionsManifestError	manifests$DeploymentmanagerManifestsGetRequestHTTP_ERROR_FORMAT)selfargsr   r   errors        r   RunzDescribe.Run>   sA    }}H.[[,,00MM@@**,?? A 

 00<h))026//BC 	C	K[[""&&
--
<
<((* =   !** .&&u--." (( K$$UK,I,IJJKs1   AD &AD3 D0D++D03E/$E**E/N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r-    r   r   r   r      s4      
- 	F 	F)Kr   r   N)r1   
__future__r   r   r   apitools.base.pyr   r!   )googlecloudsdk.api_lib.deployment_managerr   r   r%   googlecloudsdk.callioper	   UseDmApiDmApiVersionV2DescribeCommand	DmCommandr   r4   r   r   <module>r>      sm     " &  ' > A = Q ( . '&&))*GKt##W%6%6 GK +GKr   