
                         b   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$                  ej&                  j(                  ej&                  j*                  ej&                  j,                         G d dej.                                      Zy)z2Implements command to create a migration workflow.    )absolute_import)division)unicode_literals)util)waiter)base)command_utils)
properties)	resourcesc                   2    e Zd ZdZddddZed        Zd Zy)	CreatezCreate a migration workflow.zcreate migration workflowszCreate a migration workflowz          To create a migration workflow in EU synchronously based on a config file, run:

            $ {command} --location=EU --config-file=config_file.yaml --no-async
            )briefDESCRIPTIONEXAMPLESc                     t         j                  j                  |        | j                  ddd       | j                  ddd       y )Nz
--locationz#Location of the migration workflow.T)helprequiredz--config-filez,Path to the migration workflows config file.)r   
ASYNC_FLAGAddToParseradd_argument)parsers    ,lib/surface/bq/migration_workflows/create.pyArgszCreate.Args.   sN    OO'
2  
 ;      c                    t        j                         }|j                  }t        j                  d      } |       }|j                  xs4 t
        j                  j                  j                  j                  d      }|j                  }t        j                  |j                  t        j                  d            }d| d| |_        ||_        |j                  |      }	|j                   r|	S t"        j$                  j'                  |	j(                  d      }
t        j*                  |      }t-        j.                  ||
d	j1                  |	j(                        
      }	|	S )N8BigquerymigrationProjectsLocationsWorkflowsCreateRequestT)r   /GoogleCloudBigqueryMigrationV2MigrationWorkflowz	projects/z/locations/z.bigquerymigration.projects.locations.workflows)
collectionzRunning migration workflow [{}])polleroperation_refmessage)api_utilGetMigrationApiClientprojects_locations_workflowsGetMigrationApiMessageprojectr
   VALUEScoreGetlocationr	   GetResourceFromFileconfig_fileparent/googleCloudBigqueryMigrationV2MigrationWorkflowr   async_r   REGISTRYParseRelativeNamenameBqMigrationWorkflowPollerr   WaitForformat)selfargsclientmigration_servicerequest_typerequestr&   r*   migration_workflowresponsemigration_workflow_refr   s               r   Runz
Create.Run<   s;   ++-F;;22BL nGllOj//44<<@@$@OG}}H&::''=	
 !	XJ?GN>PG; ''0H{{o(11CC
--E  D   667HIf.3::8==Ih Or   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r?    r   r   r   r      s4    
 % ,2-  $r   r   N)rC   
__future__r   r   r   googlecloudsdk.api_lib.bqr   r"   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   googlecloudsdk.command_lib.bqr	   googlecloudsdk.corer
   r   UniverseCompatibleReleaseTracksReleaseTrackALPHABETAGACommandr   rF   r   r   <module>rT      s    9 &  ' 6 . ( 7 * ) T..33T5F5F5I5I?T\\ ? ?r   