
    :                     >   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  \R                  \R                  " \R                  R                   \R                  R"                  5      \R$                   " S	 S
\R&                  5      5       5       5       rg)Create a Workflow.    )client_util)
input_util)workflow_input_util)waiter)base)	run_flags)	resourcesc                   .    \ rS rSrSr\S 5       rS rSrg)Create   r   c                 R    U R                  SSSS9  [        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.
z--fileTz8The YAML file to use as the Workflow configuration file.)requiredhelpN)add_argumentr	   AddsRegionResourceArg)parsers    %lib/surface/builds/workflows/apply.pyArgsCreate.Args!   s1     G  I ##F+    c           	         [         R                  " 5       n[         R                  " 5       n[        R                  " UR
                  5      n[        R                  " U5      nUR                  R                  R                  5       nUR                  5       nUS   nU< SU< 3n	Xl        UR                  R                  UR                  XSS95      n
[         R"                  R%                  U
R                  SS9n[&        R(                  " [&        R*                  " UR                  UR,                  5      USR/                  UR
                  U	S95      nU$ )	z9This is what gets called when the user runs this command.namez/workflows/T)r   workflowallowMissingz(cloudbuild.projects.locations.operations)
collectionz"Applying {file} as workflow {name})filer   )r   GetClientInstanceGetMessagesModuler   LoadYamlFromPathr   r   CloudBuildYamlDataToWorkflowCONCEPTSregionParseRelativeNamer   projects_locations_workflowsPatch0CloudbuildProjectsLocationsWorkflowsPatchRequestr
   REGISTRYParseRelativeNamer   WaitForCloudOperationPollerprojects_locations_operationsformat)selfargsclientmessages	yaml_datar   
region_refparentworkflow_idr   update_operationupdate_operation_refupdated_workflows                r   Run
Create.Run/   s2   **,F,,.H++DII6I"??	JH%%++-J$$&FF#K &4D M::@@AAt 	B 	=> %--??= @ ? ~~##F$G$G$*$H$H	J,333N	P r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r:   __static_attributes__r<   r   r   r   r      s     , ,r   r   N)rA   $googlecloudsdk.api_lib.cloudbuild.v2r   r   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.cloudbuildr	   googlecloudsdk.corer
   HiddenReleaseTracksReleaseTrackALPHABETAUniverseCompatibleCreateCommandr   r<   r   r   <module>rP      s     = ; D . ( ; ) D%%++T->->-C-CD.T .  E .r   