
    
                         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  G d
 de
j                        Zy)zKCommand to list resource allowances for a specified Batch project/location.    )absolute_import)division)unicode_literals)
list_pager)resource_allowances)base)resource_args)
propertiesc                   &    e Zd ZdZed        Zd Zy)Lista*  List resource allowances for a specified Batch project/location.

  This command can fail for the following reasons:
  * The project/location specified do not exist.
  * The active account does not have permission to access the given
  project/location.

  ## EXAMPLES
  To print all the resource allowances under all available locations for the
  default project,
  run:

    $ {command}

  To print all the resource allowances under projects/location
  `projects/foo/locations/us-central1`, run:

    $ {command} --project=foo --location=us-central1
  c                     t        j                  |        t        j                  j	                  |        | j
                  j                  d       y )NzPtable(name, name.segment(3):label=LOCATION, usageResourceAllowance.status.state))r	   AddLocationResourceArgsr   URI_FLAGRemoveFromParserdisplay_info	AddFormat)parsers    -lib/surface/batch/resource_allowances/list.pyArgsz	List.Args2   s;    ))&1MM""6*
!!	0    c                 V   | j                         }t        j                  |      }|j                  xs2 t        j
                  j                  j                  j                         }|j                  xs2 t        j
                  j                  j                  j                         }|rdj                  ||      }ndj                  |d      }t        j                  |j                  |j                  j!                  ||j"                        |j"                  d|j$                  d      S )Nzprojects/{}/locations/{}-)parentpageSizeresourceAllowancesr   )
batch_sizefieldlimitbatch_size_attribute)ReleaseTrackr   ResourceAllowancesClientlocationr
   VALUESbatchGetprojectcore	GetOrFailformatr   YieldFromListservicemessages3BatchProjectsLocationsResourceAllowancesListRequest	page_sizer   )selfargsrelease_trackclientr"   r&   r   s          r   RunzList.Run;   s    %%'M 99-HF}}F
 1 1 7 7 @ @ D D FHllHj//44<<FFHG)00(Cf)00#>f##KKDNN 	L 	
 >>"jj'	 	r   N)__name__
__module____qualname____doc__staticmethodr   r3    r   r   r   r      s     (  r   r   N)r7   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.batchr   googlecloudsdk.callioper    googlecloudsdk.command_lib.batchr	   googlecloudsdk.corer
   ListCommandr   r9   r   r   <module>rA      s5     R &  ' ' < ( : *24 2r   