
    M                     J   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  \
R                  \
R                  " \
R                  R                   \
R                  R"                  \
R                  R$                  5       " S	 S
\
R&                  5      5       5       rg)zJCommand for list subnetworks which the current user has permission to use.    )absolute_import)division)unicode_literals)
list_pager)base_classes)base)
propertiesc                   V    \ rS rSrSrSSSS.r\S 5       r\S 5       r	S	 r
S
 rS rSrg)ListUsableSubnets   z>List subnetworks which the current user has permission to use.zG          List Compute Engine subnetworks permitted for use.
          a            *{command}* is used to list Compute Engine subnetworks in a
          project that the user has permission to use.

          By default, usable subnetworks are listed for the default Google Cloud
          project and user account. These values can be overridden by
          setting the global flags: `--project=PROJECT_ID` and/or
          `--account=ACCOUNT`.
          a              To list all subnetworks in the default project that are usable by the
            default user:

              $ {command}

            To list all subnetworks in the host project ``HOST_PROJECT_ID'' of
            Shared VPC that are usable in the service project ``SERVICE_PROJECT_ID''
            (see [Shared VPC documentation](https://cloud.google.com/vpc/docs/shared-vpc/))
            by the default user:

              $ {command} --project=HOST_PROJECT_ID --service-project=SERVICE_PROJECT_ID

            To list all subnetworks in the project ``PROJECT_ID'' that are usable
            by the user ``ACCOUNT'':

              $ {command} --project=PROJECT_ID --account=ACCOUNT
          )briefDESCRIPTIONEXAMPLESc                  f    [         R                  R                  R                  R	                  5       $ )N)r	   VALUEScomputeuse_new_list_usable_subnets_apiGetBool     3lib/surface/compute/networks/subnets/list_usable.py_EnableComputeApi#ListUsableSubnets._EnableComputeApiC   s#    $$DDLLNNr   c                 \    UR                   R                  S5        UR                  SSSS9  g )Na          table(
          subnetwork.segment(-5):label=PROJECT,
          subnetwork.segment(-3):label=REGION,
          network.segment(-1):label=NETWORK,
          subnetwork.segment(-1):label=SUBNET,
          ipCidrRange:label=RANGE,
          secondaryIpRanges.map().format("{0} {1}", rangeName, ipCidrRange).list(separator="
"):label=SECONDARY_RANGES,
          purpose,
          role,
          stackType,
          ipv6AccessType,
          internalIpv6Prefix,
          externalIpv6Prefix
        )z--service-projectFz        The project id or project number in which the subnetwork is intended to be
        used. Only applied for Shared VPC.
        See [Shared VPC documentation](https://cloud.google.com/vpc/docs/shared-vpc/).
        )requiredhelp)display_info	AddFormatadd_argument)clsparsers     r   ArgsListUsableSubnets.ArgsG   s;    
!! #     r   c                     g)Nzcompute.subnetworksr   )selfs    r   
CollectionListUsableSubnets.Collectionc   s     r   c                     S nU$ )Nc                     SR                  U R                  R                   Vs/ s H+  nUR                  S:X  d  M  UR                  R
                  PM-     sn5      $ s  snf )N selfLink)joinresourceadditionalPropertieskeyvaluestring_value)search_resultps     r   _GetUri-ListUsableSubnets.GetUriFunc.<locals>._GetUrig   s^    WW ##88" 9 UUj  !''

8" # # "s
   AAr   )r%   r4   s     r   
GetUriFuncListUsableSubnets.GetUriFuncf   s    # Nr   c           	         [         R                  " U R                  5       5      nUR                  nUR                  R                  nUR                  [        R                  R                  R                  R                  SS9S9nUR                  (       a  UR                  Ul        [        R                  " UR                  R                   USSSSS9$ )	NT)r   )project
ListUsable
maxResultsi  items)methodbatch_size_attribute
batch_sizefield)r   ComputeApiHolderReleaseTrackclientmessages#ComputeSubnetworksListUsableRequestr	   r   corer9   Getservice_projectserviceProjectr   YieldFromListapitools_clientsubnetworks)r%   argsholderrC   rD   requests         r   RunListUsableSubnets.Runo   s    **4+<+<+>?F]]F}}%%H::!!&&..22D2A ; CG #33g##**) r   r   N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   classmethodr"   r&   r6   rP   __static_attributes__r   r   r   r   r      sX    
 G-B O O  6!r   r   N)rV   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   googlecloudsdk.corer	   UniverseCompatibleReleaseTracksrB   GABETAALPHAListCommandr   r   r   r   <module>rf      s    Q &  ' ' 7 ( * $++00$2C2C2I2I`(( ` `r   