
                             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 ddlmZ dddZe
j*                   G d de
j,                               Zy)z%Command for listing backend services.    )absolute_import)division)unicode_literals)
list_pager)base_classes)base)
exceptions)scope)flags)
propertiesa=          *{command}* retrieves the list of backend service resources in the
        specified project for which you have compute.backendService.get
        and compute.backendService.use permissions. This command is useful
        when you're creating load balancers in a Shared VPC environment
        and you want to use [cross-project service
        referencing](https://cloud.google.com/load-balancing/docs/https#cross-project).
        You can use this command to find out which backend
        services in other projects are available to you for referencing.
        z        To list all global backend services in a project, run:

          $ {command} --global

        To list all backend services in a region, run:

          $ {command} --region=REGION
        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)
ListUsablezList usable backend services.c                     t         j                  j                  |        | j                  j	                  t         j
                         y )N)r   0GLOBAL_REGIONAL_BACKEND_SERVICE_NOT_REQUIRED_ARGAddArgumentdisplay_info	AddFormatDEFAULT_BETA_LIST_FORMAT)parsers    3lib/surface/compute/backend_services/list_usable.pyArgszListUsable.Args:   s0    	::FFvN
!!%"@"@A    c                 P   t        j                  | j                               }|j                  }|j                  j                  }t
        j                  j                  j                  |      \  }}|st        j                  d      |j                  t        j                  j                  k(  r[|j                  t         j"                  j$                  j&                  j)                  d            }|j*                  j,                  }n|j                  t        j                  j.                  k(  r[|j1                  |t         j"                  j$                  j&                  j)                  d            }|j*                  j2                  }t5        j6                  dddd	
      S )Nz.Either --global or --region must be specified.T)required)project)regionr   r   
maxResultsi  items)methodbatch_size_attribute
batch_sizefield)r   ComputeApiHolderReleaseTrackclientmessagesr   r   scopesSpecifiedByArgscompute_exceptionsArgumentError
scope_enumcompute_scope	ScopeEnumGLOBAL'ComputeBackendServicesListUsableRequestr   VALUEScorer   Getapitools_clientbackendServicesREGION-ComputeRegionBackendServicesListUsableRequestregionBackendServicesr   YieldFromList)	selfargsholderr'   r(   resource_scopescope_valuerequestapitoolss	            r   RunzListUsable.Run?   sl   **4+<+<+>?F]]F}}%%H 	>>EEUU	
  NK ,,
:    M$;$;$B$BB@@##((0044d4C A g ''77h		"	"m&=&=&D&D	DFF##((0044d4C G g ''==h##) r   N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   rB    r   r   r   r   4   s#    % -B B#r   r   N)rF   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r+   r
   r.   3googlecloudsdk.command_lib.compute.backend_servicesr   googlecloudsdk.corer   rG   UniverseCompatibleListCommandr   rJ   r   r   <module>rT      s`    , &  ' ' 7 ( O E E *	. -!! - -r   