
                            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&                  j(                         G d de	j*                               Z e	j.                  dd       e	j$                  e	j&                  j0                         G d de                    Zy)z&Command to update a Datastream Stream.    )absolute_import)division)unicode_literals)streams)util)base)flags)resource_argsz    Update 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 update a stream with a new source and new display name:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source=source --update-mask=display_name,source

    To update a stream's state to RUNNING:

        $ {command} STREAM --location=us-central1 --state=RUNNING --update-mask=state

    To update a stream's oracle source config:

        $ {command} STREAM --location=us-central1 --oracle-source-config=good_oracle_cp.json --update-mask=oracle_source_config.include_objects

   a	      To update a stream with a new source and new display name:

        $ {command} STREAM --location=us-central1 --display-name=my-stream --source-name=source --update-mask=display_name,source_name

    To update a stream's state to RUNNING:

        $ {command} STREAM --location=us-central1 --state=RUNNING --update-mask=state

    To update a stream's oracle source config:

        $ {command} STREAM --location=us-central1 --oracle-source-config=good_oracle_cp.json --update-mask=oracle_source_config.allowlist

   c                   @    e Zd ZdZeedZed        Zed        Z	d Z
y)UpdateUpdates a Datastream stream.DESCRIPTIONEXAMPLESc                 <   t        j                  | d|d       t        j                  |        t        j                  | d       t        j
                  | d       t        j                  | d       t        j                  |        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.
    updateF)requiredr   N)
r
   AddStreamResourceArgstreams_flagsAddUpdateMaskFlagAddDisplayNameFlagAddBackfillStrategyGroupAddValidationGroupAddStateFlagr	   AddLabelsUpdateFlags)parserrelease_tracks     (lib/surface/datastream/streams/update.py
CommonArgszUpdate.CommonArgsD   su     &&-%9##F+$$Ve<**6EB$$VX6v&	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Update.ArgsW   s      fd//223r    c                    |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Parser   StreamsClientr   RelativeNamer#   r   GetClientInstanceGetMessagesModuleGetResourceParserCreater+   r)   r*   projects_locations_operationsGet/DatastreamProjectsLocationsOperationsGetRequestr(   )	selfargs
stream_refstream_clientresult_operationclientmessagesresource_parseroperation_refs	            r   Runz
Update.Run\   s     %%++-J))+M$++J,C,C,E,0,=,=,?G ##%F%%'H,,.O#**2%**((**	 + ,M //33@@++ 	A 	-. .r    N)__name__
__module____qualname____doc__r   r   detailed_helpstaticmethodr   r&   rA    r    r   r   r   ?   s:    $"-8D-' '$ 4 4.r    r   FzdDatastream beta version is deprecated. Please use`gcloud datastream streams update` command instead.)
is_removedwarningc                   *    e Zd ZdZeedZed        Zy)
UpdateBetar   r   c                 `    t         j                  | t        j                  j                         yr"   )r   r   r   r#   BETAr%   s    r   r&   zUpdateBeta.Args   s      fd//445r    N)	rB   rC   rD   rE   r   EXAMPLES_BETArF   rG   r&   rH   r    r   rL   rL   |   s#     %"-=I-6 6r    rL   N)rE   
__future__r   r   r   !googlecloudsdk.api_lib.datastreamr   r   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr	   r
   -googlecloudsdk.command_lib.datastream.streamsr   r   r   rO   ReleaseTracksr#   r$   Commandr   	DeprecaterN   rL   rH   r    r   <module>rX      s    - &  ' 5 2 ( 7 ? P
  D%%(()9.T\\ 9. *9.x ;
 D%%**+6 6 ,6r    