
    p                     D   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  SS	KJr  SS
KJr  \R(                  " \R*                  R,                  \R*                  R.                  \R*                  R0                  5       " S S\R2                  5      5       rg)z!Import workflow template command.    )absolute_import)division)unicode_literals)
exceptions)dataproc)base)flags)util)
console_ioc                   >    \ rS rSrSr\S 5       r\S 5       rS rSr	g)Import   a  Import a workflow template.

If the specified template resource already exists, it will be overwritten.
Otherwise, a new template will be created.
To edit an existing template, you can export the template to a file, edit its
configuration, and then import the new configuration.
c                 ^    [         R                  " U R                  5       5      R                  $ )z3Returns the API version based on the release track.)dpDataprocReleaseTrackapi_version)clss    1lib/surface/dataproc/workflow_templates/import.pyGetApiVersionImport.GetApiVersion(   s"     ;;s'')*666    c                 x    [         R                  " USU R                  5       S9  [        R                  " U5        g )Nimport)r   )r	   AddTemplateResourceArgr   export_utilAddImportFlags)r   parsers     r   ArgsImport.Args-   s.    	  c&7&7&9;v&r   c                    [         R                  " U R                  5       5      nUR                  nUR                  R
                  R                  5       nSR                  UR                  5       R                  S5      SS 5      n[        R                  " UR                  =(       d    SSS9n[        R                  " UR                  US9nUR!                  5       Ul         UR%                  U5      n[        R4                  " S
R7                  UR"                  5      SS9  UR8                  Ul        UR                  5       Ul        UR.                  R0                  R=                  U5      $ ! [&        R(                   aP  n	U	R*                  S:w  a  U	eUR-                  XWS	9n
UR.                  R0                  R3                  U
5      s S n	A	$ S n	A	ff = f)N/r      -F)binary)message_typestreami  )parentworkflowTemplatez,Workflow template [{0}] will be overwritten.T)messagecancel_on_no)r   r   r   messagesCONCEPTStemplateParsejoinRelativeNamesplitr   ReadFromFileOrStdinsourcer   r   WorkflowTemplateNameidGetRegionsWorkflowTemplateapitools_exceptions	HttpErrorstatus_code5DataprocProjectsRegionsWorkflowTemplatesCreateRequestclient"projects_regions_workflowTemplatesCreatePromptContinueformatversionnameUpdate)selfargsr   msgstemplate_refr(   datar.   old_templateerrorrequests              r   Run
Import.Run3   s   {{4,,./HD==))//1L
 XXl//177<QqABF))$++*<UKD!!**49H ##%HKP88Fl ?GGKK
 $++H --/HM??==DDXNN (( P			c	!JJ K 4g__??FFwOOPs   #E- -GAGGG N)
__name__
__module____qualname____firstlineno____doc__classmethodr   r   rM   __static_attributes__rO   r   r   r   r      s5     7 7 ' '
#Or   r   N)rT   
__future__r   r   r   apitools.base.pyr   r9   googlecloudsdk.api_lib.dataprocr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataprocr	   !googlecloudsdk.command_lib.exportr
   r   googlecloudsdk.core.consoler   ReleaseTracksr   ALPHABETAGAUpdateCommandr   rO   r   r   <module>rc      s    ( &  ' > : ( 5 A 2 D%%++T->->-C-C%%((*7OT 7O*7Or   