
    "                        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  ej                  ej                   j"                         G d dej$                               Z ej                  ej                   j(                         G d de             Z ej                  ej                   j,                         G d de             Zy)z%`gcloud tasks queues update` command.    )absolute_import)division)unicode_literals)GetApiAdapter)base)	constants)flags)parsers)logc                   B     e Zd ZdZdddZ fdZed        Zd Z xZ	S )UpdateyUpdate a Cloud Tasks queue.

  The flags available to this command represent the fields of a queue that are
  mutable.
  "          {description}
                      To update a Cloud Tasks queue:

              $ {command} my-queue
                --clear-max-attempts --clear-max-retry-duration
                --clear-max-doublings --clear-min-backoff
                --clear-max-backoff
                --clear-max-dispatches-per-second
                --clear-max-concurrent-dispatches
                --clear-routing-override
         DESCRIPTIONEXAMPLESc                 :    t        t        | 
  |i | d| _        y NF)superr   __init__is_alphaselfargskwargs	__class__s      "lib/surface/tasks/queues/update.pyr   zUpdate.__init__5   s    	&$ $1&1DM    c                     t        j                  | d       t        j                  |        t        j                  |        y )N	to update)r	   AddQueueResourceArgAddLocationFlagAddUpdatePushQueueFlagsparsers    r   ArgszUpdate.Args9   s.    	fk2	&!	!!&)r   c                    | j                         t        j                   j                  k(  r|j                  }nt        j
                  }t        j                  ||| j                                t        | j                               }|j                  }t        j                  |j                  |j                        }t        j                  |||j                  d| j                               }t        j                  ||| j                               }| j                         t        j                   j                   k(  r|j"                  |j"                  j$                  nd }t        j&                  |      }	|j)                  |||j*                  |j,                  ||	d   |	d   |	d   |	d   |	d   |	d	   |	d
         }
n3| j                         t        j                   j                  k(  r|j.                  |j.                  j$                  nd }t        j&                  |      }	|j)                  |||j*                  |j,                  ||j0                  |j                  |	d   |	d   |	d   |	d   |	d   |	d	   |	d
         }
nr|j$                  }t        j&                  |      }	|j)                  |||j*                  |j,                  ||j0                  |	d   |	d   |	d   |	d   |	d   |	d	   |	d
         }
t2        j4                  j7                  dj9                  t        j:                  |j=                                            |
S )Nrelease_trackT)	is_updater*   http_uri_overridehttp_method_overridehttp_header_overridehttp_oauth_email_overridehttp_oauth_scope_overridehttp_oidc_email_overridehttp_oidc_audience_override)
retry_configrate_limitsapp_engine_routing_overrider,   r-   r.   r/   r0   r1   r2   )r3   r4   r5   stackdriver_logging_config
queue_typer,   r-   r.   r/   r0   r1   r2   )r3   r4   r5   r6   r,   r-   r.   r/   r0   r1   r2   zUpdated queue [{}].)ReleaseTrackr   BETAtyper   
PUSH_QUEUEr
   CheckUpdateArgsSpecifiedr   queues
ParseQueuequeuelocationParseCreateOrUpdateQueueArgsmessagesGetSpecifiedFieldsMaskALPHAappEngineHttpTargetappEngineRoutingOverrideGetHttpTargetArgsPatchretryConfig
rateLimitsappEngineHttpQueuestackdriverLoggingConfigr   statusPrintformatGetConsolePromptStringRelativeName)r   r   r7   apiqueues_client	queue_refqueue_configupdated_fieldsr5   http_target_argsupdate_responses              r   Runz
Update.Run?   sq   d//44499j''j$$T%/373D3D3FH ))+
,CJJM""4::t}}=I77'')+L 33j(9(9(;=N d//555 --9 
*
*
C
C?C " !22<@%++

#//"--&A,-@A/0FG/0FG$4)% %5)% $44N#O&6+'! , o( 
			 1 1 6 6	6 ,,8 
)
)
B
B>B " !22<@%++

#//"--&A%1%J%J!&&,-@A/0FG/0FG$4)% %5)% $44N#O&6+'% , o. %1$I$I! 22<@%++

#//"--&A%1%J%J,-@A/0FG/0FG$4)% %5)% $44N#O&6+'# , o* JJ*11&&y'='='?@B Cr   )
__name__
__module____qualname____doc__detailed_helpr   staticmethodr'   rY   __classcell__r   s   @r   r   r      s8    
	-" * *
fr   r   c                   <     e Zd ZdZdddZ fdZed        Z xZS )
BetaUpdater   r   r   r   c                 :    t        t        | 
  |i | d| _        y r   )r   rc   r   r   r   s      r   r   zBetaUpdate.__init__   s    	*d$d5f5DMr   c                     t        j                  | d       t        j                  |        t        j                  | t        j
                  j                         y Nr!   r)   )r	   r"   r#   r$   r   r8   r9   r%   s    r   r'   zBetaUpdate.Args   s?    	fk2	&!	!!d//446r   	rZ   r[   r\   r]   r^   r   r_   r'   r`   ra   s   @r   rc   rc      s2    
	-" 6 6r   rc   c                   <     e Zd ZdZdddZ fdZed        Z xZS )AlphaUpdatezUpdate a Cloud Tasks queue.

  The flags available to this command represent the fields of a queue that are
  mutable. Attempting to use this command on a different type of queue will
  result in an error.
  r   a            To update a Cloud Tasks queue:

              $ {command} my-queue
                --clear-max-attempts --clear-max-retry-duration
                --clear-max-doublings --clear-min-backoff
                --clear-max-backoff
                --clear-max-tasks-dispatched-per-second
                --clear-max-concurrent-tasks
                --clear-routing-override
         r   c                 :    t        t        | 
  |i | d| _        y )NT)r   ri   r   r   r   s      r   r   zAlphaUpdate.__init__   s    	+t%t6v6DMr   c                     t        j                  | d       t        j                  |        t        j                  | t        j
                  j                         y rf   )r	   r"   r#   r$   r   r8   rD   r%   s    r   r'   zAlphaUpdate.Args   s<    	fk2	&!	!!&8I8I8O8OPr   rg   ra   s   @r   ri   ri      s4    
	-" Q Qr   ri   N)r]   
__future__r   r   r   googlecloudsdk.api_lib.tasksr   googlecloudsdk.callioper    googlecloudsdk.command_lib.tasksr   r	   r
   googlecloudsdk.corer   ReleaseTracksr8   GAUpdateCommandr   r9   rc   rD   ri    r   r   <module>ru      s    , &  ' 6 ( 6 2 4 # D%%(()GT G *GT D%%**+ 6  6 , 6F D%%++, Q&  Q - Qr   