
                             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Z
d	Zd
ZdZdZdZej                   j"                  fdZddZd Zd Zd Zd Zd Zd Zd Zd Zy)z7List command formats and transforms for `gcloud tasks`.    )absolute_import)division)unicode_literals)base)	constants)parsersan  table(
    name.basename():label="QUEUE_NAME",
    queuetype():label=TYPE,
    state,
    rateLimits.maxConcurrentTasks.yesno(no="unlimited").format("{0}").sub("-1", "unlimited"):label="MAX_NUM_OF_TASKS",
    rateLimits.maxTasksDispatchedPerSecond.yesno(no="unlimited"):label="MAX_RATE (/sec)",
    retryConfig.maxAttempts.yesno(no="unlimited"):label="MAX_ATTEMPTS")a  table(
    name.basename():label="QUEUE_NAME",
    queuetype():label=TYPE,
    state,
    rateLimits.maxConcurrentDispatches.yesno(no="unlimited").format("{0}").sub("-1", "unlimited"):label="MAX_NUM_OF_TASKS",
    rateLimits.maxDispatchesPerSecond.yesno(no="unlimited"):label="MAX_RATE (/sec)",
    retryConfig.maxAttempts.yesno(no="unlimited").format("{0}").sub("-1", "unlimited"):label="MAX_ATTEMPTS")aw  table(
    name.basename():label="QUEUE_NAME",
    state,
    rateLimits.maxConcurrentDispatches.yesno(no="unlimited").format("{0}").sub("-1", "unlimited"):label="MAX_NUM_OF_TASKS",
    rateLimits.maxDispatchesPerSecond.yesno(no="unlimited"):label="MAX_RATE (/sec)",
    retryConfig.maxAttempts.yesno(no="unlimited").format("{0}").sub("-1", "unlimited"):label="MAX_ATTEMPTS")aj  table(
    name.basename():label="TASK_NAME",
    tasktype():label=TYPE,
    createTime,
    scheduleTime,
    status.attemptDispatchCount.yesno(no="0"):label="DISPATCH_ATTEMPTS",
    status.attemptResponseCount.yesno(no="0"):label="RESPONSE_ATTEMPTS",
    status.lastAttemptStatus.responseStatus.message.yesno(no="Unknown")
        :label="LAST_ATTEMPT_STATUS")aA  table(
    name.basename():label="TASK_NAME",
    tasktype():label=TYPE,
    createTime,
    scheduleTime,
    dispatchCount.yesno(no="0"):label="DISPATCH_ATTEMPTS",
    responseCount.yesno(no="0"):label="RESPONSE_ATTEMPTS",
    lastAttempt.responseStatus.message.yesno(no="Unknown")
        :label="LAST_ATTEMPT_STATUS")zAtable(
     locationId:label="NAME",
     name:label="FULL_NAME")c                 r   |t         j                  j                  k(  }|t         j                  j                  k(  }|s|r!| j                  j                  dt        i       | j                  j                  |rt        n|rt        nt               | j                  j                  t        j                         y )N	queuetype)r   ReleaseTrackALPHABETAdisplay_infoAddTransforms_TransformQueueType	AddFormat_ALPHA_QUEUE_LIST_FORMAT_BETA_QUEUE_LIST_FORMAT_QUEUE_LIST_FORMAT
AddUriFuncr   QueuesUriFunc)parserversionis_alphais_betas       4lib/googlecloudsdk/command_lib/tasks/list_formats.pyAddListQueuesFormatsr   P   s    ))///(t((---'
%%{4G&HI"*!(.@B 	  !6!67    c                     | j                   j                  dt        i       | j                   j                  |rt        nt
               | j                   j                  t        j                         y )Ntasktype)	r   r   _TransformTaskTyper   _ALPHA_TASK_LIST_FORMAT_TASK_LIST_FORMATr   r   TasksUriFunc)r   r   s     r   AddListTasksFormatsr$   \   sT    ##Z1C$DE!)/@B  !5!56r   c                     | j                   j                  t               | j                   j                  t        j
                         y N)r   r   _LOCATION_LIST_FORMATr   r   LocationsUriFunc)r   s    r   AddListLocationsFormatsr)   c   s1     56  !9!9:r   c                 *    d| v xs d| v xr | d   dk(  S )N
pullTargettypePULL rs    r   _IsPullQueuer1   h   s$    			Cv{BqyF/BCr   c                 B    d| v xs d| v xs d| v xs d| v xr | d   dk(  S )NappEngineHttpTargetappEngineHttpQueueappEngineRoutingOverrider,   PUSHr.   r/   s    r   _IsPushQueuer7   l   sE      1
$ 0(<(A 0
$
)0Q;.1V9.1r   c                 
    d| v S )NpullMessager.   r/   s    r   _IsPullTaskr:   t       	!	r   c                 
    d| v S )NappEngineHttpRequestr.   r/   s    r   _IsAppEngineTaskr>   x   s    	1	$$r   c                 
    d| v S )NhttpRequestr.   r/   s    r   _IsHttpTaskrA   |   r;   r   c                 p    t        |       rt        j                  S t        |       rt        j                  S y r&   )r1   r   
PULL_QUEUEr7   
PUSH_QUEUEr/   s    r   r   r      s-    !_!_ r   c                 j    t        |       rt        j                  S t        |       ryt	        |       ryy )Nz
app-enginehttp)r:   r   rC   r>   rA   r/   s    r   r    r       s/    ^a^ r   N)F)__doc__
__future__r   r   r   googlecloudsdk.callioper    googlecloudsdk.command_lib.tasksr   r   r   r   r   r!   r"   r'   r   GAr   r$   r)   r1   r7   r:   r>   rA   r   r    r.   r   r   <module>rL      s    > &  ' ( 6 4K p p ) )    *.):):)=)= 	87;
D1% r   