
                             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
S.r\R                  " \R                  R                   5       " S S\R"                  5      5       r\\l        g)z'trace sinks update' command.    )absolute_import)division)unicode_literals)util)base)
exceptions)logz/
        Changes the *[destination]* associated with a sink.
        The new destination must already exist and Stackdriver Trace must have
        permission to write to it.

        Trace spans are exported to the new destination in a few minutes.
    zg/

        $ {command} my-sink bigquery.googleapis.com/projects/my-project/datasets/my_new_dataset
    )DESCRIPTIONEXAMPLESc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Update+   zUpdates a sink.c                     U R                  SSS9  U R                  SSS9  U R                  SSS9  U R                  R                  S5        U R                  R                  S	5        g	)
z Register flags for this command.	sink_namezThe name of the sink to update.)helpdestinationzThe new destination for the sink. The destination must be a fully qualified BigQuery resource name. The destination can be for the same Google Cloud project or for a different Google Cloud project in the same organization.z	--projectzSUpdate a sink associated with this project. This will override the default project.yamlN)add_argumentdisplay_info	AddFormatAddCacheUpdater)parsers    !lib/surface/trace/sinks/update.pyArgsUpdate.Args/   sz     *KL
   3  4 !!&)
''-    c           
          [         R                  " 5       n[         R                  " 5       R                  R	                  UR                  UUR                  " S0 UD6SR                  U5      S95      $ )z*Patches a sink specified by the arguments.,)name	traceSink
updateMask )r   GetMessages	GetClientprojects_traceSinksPatch(CloudtraceProjectsTraceSinksPatchRequest	TraceSinkjoin)selfr   	sink_dataupdate_maskmessagess        r   	PatchSinkUpdate.PatchSink@   sc    !H>>//5599((595xx, 	: 	./ /r   c                    [         R                  " UR                  UR                  5      nUR	                  5       nSU0n/ nUR                  S5      (       a"  SUR                  0US'   UR                  S5        U(       d  [        R                  " S5      eU R                  X4U5      n[        R                  " U5        [         R                  " U5      $ )zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  The updated sink with its new destination.
r   r   outputConfigzoutput_config.destinationz(Please specify the destination to update)r   GetTraceSinkResourcer   projectRelativeNameIsSpecifiedr   appendcalliope_exceptionsMinimumArgumentExceptionr.   r	   UpdatedResourceFormatTraceSink)r*   argssink_refsink_resource_namer+   r,   results          r   Run
Update.RunI   s     ((FH!..0+,IK&&#0$2B2B"Ci4588
46 6 ^^.;GF!''r   r"   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r.   r?   __static_attributes__r"   r   r   r   r   +   s!    . . /(r   r   N)rE   
__future__r   r   r   googlecloudsdk.api_lib.tracer   googlecloudsdk.callioper   r   r7   googlecloudsdk.corer	   DETAILED_HELPReleaseTracksReleaseTrackALPHAUpdateCommandr   detailed_helpr"   r   r   <module>rR      ss    $ &  ' - ( E #		" D%%++,6(T 6( -6(r % r   