
                         2   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 ddlmZ ddlmZ  ej,                  ej.                  j0                  ej.                  j2                         G d dej4                               Zy)z)`gcloud dataplex content create` command.    )absolute_import)division)unicode_literals)content)util)
exceptions)base)resource_args)	arg_utils)labels_util)logc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)CreatezCreating a content.EXAMPLESa  
          To create a Dataplex content `test-content` of type notebook  within lake `test-lake` in location `us-central1`.

           $ {command} --project=test-project --location=us-central1 --lake=test-lake --kernel-type=PYTHON3 --data-text='' --path='test-content'

          c                 
   t        j                  | dd       | j                  dd       | j                  ddd	
       | j                  ddd	
       | j                  d	d	d      }|j                  dd      }|j                  dddit        j
                  dd	       |j                  dd      }|j                  dddit        j
                  dd	       | j                  dddd       t        j                  |        y) zvRegister flags for this command.

    Args:
      parser: argparse.Parser: Parser object for command line inputs.
    zto create a Content to.F)
positionalz--descriptionzDescription of the Content)helpz--data-textzContent data in string formatT)r   requiredz--pathzAThe path for the Content file, represented as directory structurez.Sql script or notebook related configurations.)r   mutexr   z Notebook related configurations.)r   r   z--kernel-typePYTHON3python3zKernel Type of the notebook.)choicestyper   r   z"Sql script related configurations.z--query-engineSPARKsparkz*Query Engine to be used for the Sql Query.z--validate-only
store_truez:Validate the create action, but don't actually perform it.)actiondefaultr   N)r
   AddLakeResourceArgadd_argument	add_groupr   ChoiceToEnumNamer   AddCreateLabelsFlags)parsersqlscript_or_notebooknotebook
sql_scripts       &lib/surface/dataplex/content/create.pyArgszCreate.Args.   sS    $$)e=
.JK
;d  L
P  
 #,,= - ?
 %..? / AH I&''+   '00A 1 CJ '"''9   J	  L
 $$V,    z-Status code: {status_code}. {status_message}.c           	      F   |j                   j                  j                         }t        j                         }|j
                  j                  t        j                         j                  |j                         |j                  t        j                  |                  }t        |dd      }|r t        j                  j!                  d       yt        j"                  |j$                  dj'                  |j(                  |j*                  |j,                               y)zConstructs and sends request.

    Args:
      args: argparse.Namespace, An object that contains the values for the
        arguments specified in the .Args() method.
    )parentvalidateOnlygoogleCloudDataplexV1Contentvalidate_onlyFzValidation complete.NzBContent created in lake [{0}] in project [{1}] with location [{2}])details)CONCEPTSlakeParsedataplex_utilGetClientInstance%projects_locations_lakes_contentitemsr   GetMessageModule7DataplexProjectsLocationsLakesContentitemsCreateRequestRelativeNamer/   r   GenerateContentForCreateRequestgetattrr   statusPrintCreatedResourcenameformatlakesId
projectsIdlocationsId)selfargslake_refdataplex_clientcontent_responser/   s         r(   Runz
Create.Runa   s     }}!!'')H#557O&LLSS&& 	

A
A((*++)0,,T*3 B 45 D/59M	jj-.T	  ("5"5x7K7K	LNr*   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr)   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrI    r*   r(   r   r      sR     	- 0- 0-d 54457N7Nr*   r   N)rM   
__future__r   r   r   googlecloudsdk.api_lib.dataplexr   r   r4   googlecloudsdk.api_lib.utilr   rP   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataplexr
   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   ReleaseTracksReleaseTrackALPHAGACommandr   rR   r*   r(   <module>r`      sx    0 &  ' 3 A F ( = : < # D%%++T->->-A-AB_NT\\ _N C_Nr*   