
    
                         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	K	Jr  \R                  " \R                  R                  5       " S
 S\R                   5      5       rg)z`gcloud tasks lease` command.    )absolute_import)division)unicode_literals)GetApiAdapter)base)flags)list_formats)parsersc                   .    \ rS rSrSr\S 5       rS rSrg)Lease   a  Leases a list of tasks and displays them.

Each task returned from this command will have its schedule time changed
based on the lease duration specified. A task that has been returned by
calling this command will not be returned in a different call before its
schedule time. After the work associated with a task is finished, the lease
holder should call `gcloud tasks acknowledge` on the task.
c                    [         R                  R                  U 5        [         R                  R                  U 5        [        R
                  " U SSS9  [        R                  " U 5        [        R                  " U SS9  [        R                  " U 5        [        R                  " U 5        [        R                  " U SS9  g )NT)requiredplural_tasksz        The number of seconds for the desired new lease duration for all tasks
        leased, starting from now. The maximum lease duration is 1 week.
        )helptext)is_alpha)r   PAGE_SIZE_FLAGRemoveFromParser
LIMIT_FLAGr   AddQueueResourceFlagAddLocationFlagAddTaskLeaseDurationFlagAddFilterLeasedTasksFlagAddMaxTasksToLeaseFlagr	   AddListTasksFormats)parsers    lib/surface/tasks/lease.pyArgs
Lease.Args'   s    ((0OO$$V,	v4H	&!	""6 5  
""6*	  ($$Vd;    c                 T   [        U R                  5       5      R                  n[        R                  " UR
                  UR                  5      n[        R                  " UR                  5      n[        R                  " U5      nUR                  X4UUR                  S9R                  $ )N)filter_string	max_tasks)r   ReleaseTracktasksr
   
ParseQueuequeuelocationFormatLeaseDurationlease_durationParseTasksLeaseFilterFlagsr   limit)selfargstasks_client	queue_refdurationr"   s         r   Run	Lease.Run7   s     !2!2!45;;L""4::t}}=I**4+>+>?H66t<Mi(,

  449E:r     N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r2   __static_attributes__r4   r    r   r   r      s      < <:r    r   N)r9   
__future__r   r   r   googlecloudsdk.api_lib.tasksr   googlecloudsdk.callioper    googlecloudsdk.command_lib.tasksr   r	   r
   ReleaseTracksr$   ALPHAListCommandr   r4   r    r   <module>rC      sZ    $ &  ' 6 ( 2 9 4 D%%++, :D  : - :r    