
    j2                     \   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  SSKJr  SSKJr  SSKJr  \R0                  \R2                  " \R4                  R6                  \R4                  R8                  5       " S S\R:                  5      5       5       rg)z/`gcloud dataplex metadata-jobs create` command.    )absolute_import)division)unicode_literals)metadata_job)util)
exceptions)arg_parsers)base)resource_args)	arg_utils)labels_util)logc                   f    \ rS rSrSrSS0r\S 5       r\R                  " S5      S 5       r
S rS	rg
)Create    aE  Create a Dataplex Metadata Job.

A metadata job represents a long running job on Dataplex Catalog metadata
entries. Some operations include importing and exporting metadata into entry
groups through the usage of entry types and aspect types.

The Metadata Job ID will be used to identify each configuration run.
The Metadata Job id must follow these rules:
 * Must contain only lowercase letters, numbers, and hyphens.
 * Must start with a letter.
 * Must end with a number or a letter.
 * Must be between 1-63 characters.
 * Must be unique within the customer project / location.
EXAMPLESa            To create a Dataplex Metadata Job with type `IMPORT` and name `my-metadata-job` in location
          `us-central1` with additional parameters, run:

            $ {command} my-metadata-job --location=us-central --project=test-project
            --type=import --import-source-storage-uri=gs://test-storage/
            --import-source-create-time="2019-01-23T12:34:56.123456789Z"
            --import-entry-sync-mode=FULL --import-aspect-sync-mode=INCREMENTAL
            --import-log-level="debug"
            --import-entry-groups=projects/test-project/locations/us-central1/entryGroups/eg1
            --import-entry-types="projects/test-project/locations/us-central1/entryTypes/et1",
                "projects/test-project/locations/us-central1/entryTypes/et2"
            --import-aspect-types="projects/test-project/locations/us-central1/aspectTypes/at1",
                "projects/test-project/locations/us-central1/aspectTypes/at2"

          To create a Dataplex Metadata Job with type `EXPORT` and name `my-metadata-job` in location
          `us-central1` with additional parameters, run:

            $ {command} my-metadata-job --location=us-central --project=test-project
            --type=export --export-output-path=gs://test-storage/
            --export-entry-groups=projects/test-project/locations/us-central1/entryGroups/eg1
            --export-entry-types="projects/test-project/locations/us-central1/entryTypes/et1",
                "projects/test-project/locations/us-central1/entryTypes/et2"
            --export-aspect-types="projects/test-project/locations/us-central1/aspectTypes/at1",
                "projects/test-project/locations/us-central1/aspectTypes/at2"
          c                    [         R                  " U S5        U R                  SSSS.[        R                  SSS9  U R                  S	S
SSS9  U R                  SSSS9nUR                  SS9nUR                  SSS9nUR                  S[        R                  " 5       SSS9  UR                  S[        R                  " 5       SSS9  UR                  S[        R                  " 5       SSS9  UR                  S[        R                  " 5       SS S9  UR                  S![        R                  " 5       S"S#S9  UR                  S$[        R                  " 5       S%S&S9  UR                  S'S(SS9  UR                  S)S*S9  UR                  S+S,S-S..[        R                  SSS9  UR                  S/S,S-S..[        R                  SSS9  UR                  S0S1S2S3.[        R                  SS49  UR                  S5S9nUR                  S6S7S8SS99  UR                  S:SS9nUR                  SSS;S<9nUR                  S=[        S>S?S9  UR                  S@[        R                  " 5       SASBS9  UR                  SC[        R                  " 5       SDSES9  UR                  SF[        R                  " 5       SGSHS9  UR                  SI[        R                  " 5       SJSKS9  [        R                  R                  U 5        [        R                  " U 5        g )LNz
to create.z--typezA Metadata Import Job will ingest, update, or delete entries
                   and aspects into the declared Dataplex entry group.zA Metadata Export Job will export entries and aspects from
                   the declared Dataplex scope to the specified Cloud
                   Storage location.)IMPORTEXPORTTypeT)choicestypehelprequiredz--validate-only
store_trueFz:Validate the create action, but don't actually perform it.)actiondefaultr   z$Settings for metadata job operation.)r   mutexr   z+Settings for metadata import job operation.)r   zPA boundary on the scope of impact that the metadata import job can
        have.)r   r   z--import-entry-groupsIMPORT_ENTRY_GROUPSz6The list of entry groups to import metadata jobs into.)r   metavarr   z--import-entry-typesIMPORT_ENTRY_TYPESz5The list of entry types to import metadata jobs into.z--import-aspect-typesIMPORT_ASPECT_TYPESz6The list of aspect types to import metadata jobs into.z--import-glossariesIMPORT_GLOSSARIESz4The list of glossaries to import metadata jobs into.z--import-entry-link-typesIMPORT_ENTRY_LINK_TYPESz:The list of entry link types to import metadata jobs into.z --import-referenced-entry-scopesIMPORT_REFERENCED_ENTRY_SCOPESzAThe list of referenced entry scopes to import metadata jobs into.z--import-source-storage-uriz8The Dataplex source storage URI to import metadata from.z--import-source-create-timezuTime at which the event took place. See `$ gcloud topic datetimes`
        for information on supported time formats.z--import-entry-sync-modea_  All resources in the job's scope are modified. If a
                       resource exists in Dataplex but isn't included in the
                       metadata import file, the resource is deleted when you
                       run the metadata job. Use this mode to perform a full
                       sync of the set of entries in the job scope.a  Only the entries and aspects that are explicitly
                           included in the metadata import file are modified.
                           Use this mode to modify a subset of resources while
                           leaving unreferenced resources unchanged. )FULLINCREMENTALz--import-aspect-sync-modez--import-log-levela  Debug-level logging. Captures detailed logs for each import
                item. Use debug-level logging to troubleshoot issues with
                specific import items. For example, use debug-level logging to
                identify resources that are missing from the job scope, entries
                or aspects that don't conform to the associated entry type or
                aspect type, or other misconfigurations with the metadata import file..z Info-level logging. Captures logs at the overall job
                    level. Includes aggregate logs about import items, but
                    doesn't specify which import item has an error..)DEBUGINFO)r   r   r   z+Settings for metadata export job operation.z--export-output-pathz1The Cloud Storage location to export metadata to.EXPORT_OUTPUT_PATH)r   r    r   zPA boundary on the scope of impact that the metadata export job can
        have.z/The scope of resources to export metadata from.)r   r   r   z--export-organization-levelEXPORT_ORGANIZATION_LEVELz5Whether to export metadata at the organization level.z--export-projectsEXPORT_PROJECTSz-The list of projects to export metadata from.z--export-entry-groupsEXPORT_ENTRY_GROUPSz1The list of entry groups to export metadata from.z--export-entry-typesEXPORT_ENTRY_TYPESz0The list of entry types to export metadata from.z--export-aspect-typesEXPORT_ASPECT_TYPESz1The list of aspect types to export metadata from.)r   AddMetadataJobResourceArgadd_argumentr   ChoiceToEnumName	add_groupr	   ArgListboolr
   
ASYNC_FLAGAddToParserr   AddCreateLabelsFlags)parserspecimport_specimport_scopeexport_specexport_scopeexport_scope_resourcess          ,lib/surface/dataplex/metadata_jobs/create.pyArgsCreate.ArgsO   s   ++FLA
J(

 ''  " I	   34$  D ..: ! K ((		 ) L   "%I	     "$H	     "%I	     "#G	   #  ")M	   *  "0T	   %G  
 %	6   "G
I

 ''  " #G
I

 ''  " [H
 ''!  $ ..: ! K @$	   (( ) L
 *33B 4 
 ''%+H	 (  ''  "!@	 (  ''  "%D	 (    "$C	     "%D	   	OO'$$V,    z-Status code: {status_code}. {status_message}.c           	      $   UR                   R                  R                  5       nU R                  U5      n[        R
                  " 5       n[        R                  " 5       nUR                  R                  UR                  UUR                  5       R                  5       [        R                  " U5      S95      n[        USS5      nU(       a   [        R                   R#                  S5        g [        USS5      nU(       dW  [        R$                  " U5        [        R&                  " USR)                  UR                  5       R                  5       5      S9  g [        R                   R#                  SR)                  X6R*                  5      5        g )	N)metadataJobIdparent googleCloudDataplexV1MetadataJobvalidate_onlyFzValidation complete.async_zMetadata Job created in [{0}])detailsz$Creating [{0}] with operation [{1}].)CONCEPTSr   Parse_GetMetatadataJobIddataplex_utilGetClientInstanceGetMessageModuleprojects_locations_metadataJobsr   2DataplexProjectsLocationsMetadataJobsCreateRequestParentRelativeNamemetadata_job_libGenerateMetadataJobgetattrr   statusPrintWaitForOperationCreatedResourceformatname)	selfargsr   metadata_job_iddataplex_clientmessagecreate_req_oprH   rI   s	            r@   Run
Create.Run  sE    ==--335L..|<O#557O,,.G#CCJJBB)&&(557-=-Q-Q. 	C 	
M D/59M	jj-.T8U+F''6	
188!!#002 JJ.55//	
rC   c                 v    UR                  5       R                  S5      S   nU[        R                  :X  a  S nU$ )N/)rT   splitr   GENERATE_ID)r^   r   r`   s      r@   rM   Create._GetMetatadataJobId6  s;    "//177<R@O -333orC    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodrA   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrd   rM   __static_attributes__rl   rC   r@   r   r       sW       -: |- |-| 445##JrC   r   N)rq   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   rU   r   rN   googlecloudsdk.api_lib.utilr   rt   googlecloudsdk.callioper	   r
   #googlecloudsdk.command_lib.dataplexr   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHAGACommandr   rl   rC   r@   <module>r      s    6 &  ' L A F / ( = : < # D%%++T->->-A-AB[T\\ [ C [rC   