
                         b   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
dZe	j                   e	j                  e	j                  j                   e	j                  j"                  e	j                  j$                         G d de	j&                                      Zee_        y)z 'logging scopes update' command.    )absolute_import)division)unicode_literals)util)arg_parsers)base)
exceptionsz3
        Update the properties of a log scope.
    aH  
     To update the description of a log scope in a project, run:

        $ {command} my-scope --description=my-new-description --project=my-project

     To update the resource name of a log scope in a project. Ensure that you
     provide all the resource names including the existing ones. For example,
     if the log scope has the resource name my-project, and you want to update
     the log scope to have the resource name another-project, run the following:

        $ {command} my-scope --resource-names=projects/my-project,projects/another-project --project=my-project
    )DESCRIPTIONEXAMPLESc                   >     e Zd ZdZ fdZed        Zd Zd Z xZ	S )UpdatezUUpdate a log scope.

  Changes one or more properties associated with a log scope.
  c                 :    t        t        | 
  |i | d | _        y )N)superr   __init___current_scope)selfargskwargs	__class__s      $lib/surface/logging/scopes/update.pyr   zUpdate.__init__7   s    	&$ $1&1D    c                     | j                  dd       | j                  dd       | j                  ddt        j                         d	       y
)z Register flags for this command.LOG_SCOPE_IDz"The ID of the log scope to update.)help--descriptionz$A new description for the log scope.--resource-namesz.A new set of resource names for the log scope.RESOURCE_NAMES)r   typemetavarN)add_argumentr   ArgList)parsers    r   ArgszUpdate.Args;   sb     A   D   =  " 	  r   c                    i }g }ddg}|j                  d      r |j                  |d<   |j                  d       |j                  d      r |j                  |d<   |j                  d       |st	        j
                  |d      t        j                         j                  j                  t        j                         j                  t        j                  t        j                  t        j                  |j                        j                         dd      d	|j                          t        j                         j"                  di |d
j%                  |                  S )Nr   r   descriptionresource_namesresourceNamesz.Please specify at least one property to update	locationsglobal	logScopes,)namelogScope
updateMask )IsSpecifiedr%   appendr&   calliope_exceptionsMinimumArgumentExceptionr   	GetClientprojects_locations_logScopesPatchGetMessages-LoggingProjectsLocationsLogScopesPatchRequestCreateResourceNameGetProjectResourceprojectRelativeNamer   LogScopejoin)r   r   
scope_dataupdate_maskparameter_namess        r   _RunzUpdate._RunK   sA   JK&(:;O&"&"2"2j'()$($7$7j!)*88
K  >>88>>HH((''++DLL9FFH
 !! 1T%%'00>:>xx, 	I 	
 r   c                 $    | j                  |      S )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 log scope.
    )rB   )r   r   s     r   Runz
Update.Runk   s     99T?r   )
__name__
__module____qualname____doc__r   staticmethodr#   rB   rD   __classcell__)r   s   @r   r   r   -   s,    

  @
r   r   N)rH   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   r	   r2   DETAILED_HELPUniverseCompatibleReleaseTracksReleaseTrackALPHABETAGAUpdateCommandr   detailed_helpr/   r   r   <module>rW      s    ' &  ' / / ( E	& T..33T5F5F5I5IDT D DN % r   