
    d                        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
ZdZdZe	j$                   e	j&                  e	j(                  j*                         G d de	j,                                      Z e	j0                  dd       e	j&                  e	j(                  j2                         G d de                    Zy)z7Command to create connection profiles for a datastream.    )absolute_import)division)unicode_literals)streams)util)base)flags)resource_argsz    Create a Datastream stream. If successful, the response body contains a newly created instance of Operation.
    To get the operation result, call: describe OPERATION
    a      To create a stream with an Oracle source and a Google Cloud Storage destination:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --oracle-source-config=source_config.json --destination=destination --gcs-destination-config=destination_config.json --backfill-none

    To create a stream with a MySQL source and a Cloud Storage destination and that excludes some objects from being backfilled:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --mysql-source-config=source_config.json --destination=destination --gcs-destination-config=destination_config.json --backfill-all --mysql-excluded-objects=excluded_objects.json

    To create a stream with an Oracle source and a BigQuery destination:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --oracle-source-config=source_config.json --destination=destination --bigquery-destination-config=destination_config.json --backfill-none

    To create a stream with a PostgreSQL source and a BigQuery destination:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --postgresql-source-config=source_config.json --destination=destination --bigquery-destination-config=destination_config.json --backfill-none

    To create a stream with a MongoDB source and a Cloud Storage destination and that excludes some objects from being backfilled:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --mongodb-source-config=source_config.json --destination=destination --gcs-destination-config=destination_config.json --backfill-all --mongodb-excluded-objects=excluded_objects.json

   a      To create a stream with an Oracle source and a Google Cloud Storage destination:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source-name=source --oracle-source-config=source_config.json --destination-name=destination --gcs-destination-config=destination_config.json --backfill-none

    To create a stream with a MySQL source and a Cloud Storage destination and that excludes some objects from being backfilled:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source-name=source --mysql-source-config=source_config.json --destination-name=destination --gcs-destination-config=destination_config.json --backfill-all --mysql-excluded-objects=excluded_objects.json

   c                   @    e Zd ZdZeedZed        Zed        Z	d Z
y)CreatezCreate a Datastream stream.DESCRIPTIONEXAMPLESc                     t        j                  | d|       t        j                  |        t        j                  |        t        j
                  | d       t        j                  |        y)a/  Common arguments for all release tracks.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
      release_track: Some arguments are added based on the command release
        track.
    creater   N)r
   AddStreamResourceArgstreams_flagsAddDisplayNameFlagAddBackfillStrategyGroupAddValidationGroupr	   AddLabelsCreateFlags)parserrelease_tracks     (lib/surface/datastream/streams/create.py
CommonArgszCreate.CommonArgsI   sP     &&vxG$$V,**62$$VX6	v&    c                 `    t         j                  | t        j                  j                         yz@Args is called by calliope to gather arguments for this command.N)r   r   r   ReleaseTrackGAr   s    r   ArgszCreate.Args[   s      fd//223r   c                 N   |j                   j                  j                         }|j                         j	                         }t        j                         }|j                  ||j                  | j                         |      }t        j                         }t        j                         }t        j                         }|j                  d|j                  |j                  |j                         }	|j"                  j%                  |j'                  |	j(                              S )a  Create a Datastream stream.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      A dict object representing the operations resource describing the create
      operation if the create was successful.
    z(datastream.projects.locations.operations)operationsId
projectsIdlocationsId)name)CONCEPTSstreamParseParentRelativeNamer   StreamsClientr   	streamsIdr   r   GetClientInstanceGetMessagesModuleGetResourceParserr'   r%   r&   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr$   )
selfargs
stream_ref
parent_refstream_clientresult_operationclientmessagesresource_parseroperation_refs
             r   Runz
Create.Run`   s    %%++-J""$113J))+M$++J
8L8L,0,=,=,?G ##%F%%'H,,.O#**2%**((**	 + ,M //33@@++ 	A 	-. .r   N)__name__
__module____qualname____doc__r   r   detailed_helpstaticmethodr   r"   r?    r   r   r   r   C   s<     $"-8D-' '" 4 4.r   r   FzdDatastream beta version is deprecated. Please use`gcloud datastream streams create` command instead.)
is_removedwarningc                   *    e Zd ZdZeedZed        Zy)
CreateBetazCreates a Datastream stream.r   c                 `    t         j                  | t        j                  j                         yr   )r   r   r   r   BETAr!   s    r   r"   zCreateBeta.Args   s      fd//445r   N)	r@   rA   rB   rC   r   EXAMPLES_BETArD   rE   r"   rF   r   r   rJ   rJ      s#     %"-=I-6 6r   rJ   N)rC   
__future__r   r   r   !googlecloudsdk.api_lib.datastreamr   r   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr	   r
   -googlecloudsdk.command_lib.datastream.streamsr   r   r   rM   DefaultUniverseOnlyReleaseTracksr   r    Commandr   	DeprecaterL   rJ   rF   r   r   <module>rW      s    > &  ' 5 2 ( 7 ? P
,	 D%%(()9.T\\ 9. * 9.x ;= D%%**+6 6 ,	=
6r   