
    	                     Z   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	d
Zd Z ej                   ej"                  j$                  ej"                  j&                  ej"                  j(                        ej*                   G d dej,                                      Zy)zApplies a yaml configuration containing Delivery Pipeline(s), Target(s), Custom Target Type(s), and Automation(s) declarative definitions.    )deploy)
exceptions)base)flags)resource_args)yamlz{description}z{       To apply a Cloud Deploy YAML file `deploy.yaml`:

         $ {command} --file=deploy.yaml --region=us-central1

    )DESCRIPTIONEXAMPLESc                 X    t        j                  |        t        j                  |        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.
  N)r   AddConfigFiler   AddLocationResourceArgparsers    lib/surface/deploy/apply.py_CommonArgsr   '   s      f&&v.    c                   h    e Zd ZdZeZed        Z ej                  e
j                        d        Zy)ApplyzApplies a yaml configuration containing Delivery Pipeline(s), Target(s), Custom Target Type(s), Deploy Policy(ies), and Automation(s) declarative definitions.c                     t        |        y )N)r   r   s    r   Argsz
Apply.Args;   s
    r   c                    t        t        j                  |j                              }t	        j
                         }|j                  j                  j                         }|j                         d   }|j                  ||       y)z9This is what gets called when the user runs this command.locationsIdN)listr   load_all_pathfiler   DeployClientCONCEPTSregionParseAsDictCreateResources)selfargsloaded_yamldeploy_client
region_refr   s         r   Runz	Apply.Run?   sf    
 t))$))45K'')M%%++-J /F!!+v6r   N)__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr'    r   r   r   r   2   sJ    
 g -  544))77r   r   N)r+   "googlecloudsdk.api_lib.clouddeployr   googlecloudsdk.api_lib.utilr   r/   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr1   r   r   googlecloudsdk.corer   r,   r   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyUpdateCommandr   r3   r   r   <module>r@      s    Q 6 F ( M 3 ; $ 			
/ T..33T5F5F5I5I 7D 7 7r   