
                             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  e
j                  e
j                  j                         G d	 d
e
j                                Zy)z+Command for listing IP owners in a network.    )absolute_import)division)unicode_literals)
list_pager)base_classes)base)
propertiesc                   6    e Zd ZdZdZddedZed        Zd Zy)	ListIpOwnersz2List IP owners with optional filters in a network.aW  
    List all IP owners in a network:

      $ {command} my-network

    List IP owners only for given owner types:

      $ {command} my-network           --owner-types=instance,address,forwardingRule

    List IP owners only for given owner projects:

      $ {command} my-network           --owner-projects=p1,p2

    List IP owners only for given subnet:

      $ {command} my-network           --subnet-name=subnet-1 --subnet-region=us-central1

    List IP owners whose IP ranges overlap with the given IP CIDR range:

      $ {command} my-network           --ip-cidr-range=10.128.10.130/30
  zList IP owners in a network.z3*{command}* is used to list IP owners in a network.)briefDESCRIPTIONEXAMPLESc                    | j                  dd       | j                  dd       | j                  dd       | j                  dd	       | j                  d
d       | j                  dd       | j                  j                  d       y )NnamezThe name of the network.)helpz--subnet-namezWOnly return IP owners in the subnets with the name. Not applicable for legacy networks.z--subnet-regionzWOnly return IP owners in the subnets of the region. Not applicable for legacy networks.z--ip-cidr-rangezEOnly return IP owners whose IP ranges overlap with the IP CIDR range.z--owner-projectszmOnly return IP owners in the projects. Multiple projects are separated by comma, e.g., "project-1,project-2".z--owner-typeszOnly return IP owners of the types, which can be any combination of instance, address, forwardingRule, subnetwork, or network. Multiple types are separated by comma, e.g., "instance,forwardingRule,address"z
        table(
            ipCidrRange:label=IP_CIDR_RANGE,
            systemOwned:label=SYSTEM_OWNED,
            owners.join(','):label=OWNERS)
    )add_argumentdisplay_info	AddFormat)parsers    .lib/surface/compute/networks/list_ip_owners.pyArgszListIpOwners.Args?   s    
%?@
4  6 4  6 O  Q A  C 2  4 !! # 	    c           	         t        j                  | j                               }|j                  j                  }|j
                  }t        j                  j                  j                  j                  d      }|j                  ||j                  |j                  |j                  |j                  |j                   |j"                        }t%        j&                  |j(                  |dd|j*                  d       }|S )NT)required)projectnetwork
subnetNamesubnetRegionipCidrRangeownerProjects
ownerTypesr   items)methodfieldlimit
batch_size)r   ComputeApiHolderReleaseTrackclientapitools_clientMESSAGES_MODULEr	   VALUEScorer   Get"ComputeNetworksListIpOwnersRequestr   subnet_namesubnet_regionip_cidr_rangeowner_projectsowner_typesr   YieldFromListnetworksr%   )selfargsholderr)   messagesr   requestr"   s           r   RunzListIpOwners.Run_   s    **4+<+<+>?F]]**F%%H$$,,00$0?G99		##''&&))## : %G $$jjE Lr   N)	__name__
__module____qualname____doc__exampledetailed_helpstaticmethodr   r<    r   r   r   r      s7    :'6 .J- 	 	>r   r   N)r@   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   googlecloudsdk.corer	   ReleaseTracksr(   ALPHAListCommandr   rD   r   r   <module>rM      s\    2 &  ' ' 7 ( * D%%++,X4## X -Xr   