
                         f    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  G d d	e      Zy
)zApphub Discovered Services API.    )absolute_import)division)unicode_literals)
list_pager)utils)basec                   f    e Zd ZdZej
                  j                  fdZd Z	 	 ddZ		 	 ddZ
d Zy)	DiscoveredServicesClientz"Client for services in apphub API.c                     t        j                  |      | _        t        j                  |      | _        | j                  j
                  | _        y )N)api_lib_utilsGetClientInstanceclientGetMessagesModulemessages%projects_locations_discoveredServices_dis_services_client)selfrelease_tracks     8lib/googlecloudsdk/api_lib/apphub/discovered_services.py__init__z!DiscoveredServicesClient.__init__   s;    11-@DK!33MBDM99 	    c                 p    | j                   j                  |      }| j                  j                  |      S )zDescribe a Discovered Service in the Project/location.

    Args:
      discovered_service: str, the name for the discovered service being
        described.

    Returns:
      Described discovered service Resource.
    )name)r   3ApphubProjectsLocationsDiscoveredServicesGetRequestr   Get)r   discovered_servicedescribe_reqs      r   Describez!DiscoveredServicesClient.Describe$   s=     	II# 	J 	
 
 $$((66r   Nc                     | j                   j                  |      }t        j                  | j                  |d||d      S )a  List discovered services that could be added to an application.

    Args:
      parent: str, projects/{projectId}/locations/{location}
      limit: int or None, the total number of results to return. Default value
        is None
      page_size: int, the number of entries in each batch (affects requests
        made, but not the yielded results). Default value is 100.

    Returns:
      Generator of matching discovered services.
    parentdiscoveredServicespageSize)field
batch_sizelimitbatch_size_attribute)r   4ApphubProjectsLocationsDiscoveredServicesListRequestr   YieldFromListr   )r   r!   r&   	page_sizelist_reqs        r   ListzDiscoveredServicesClient.List5   sQ    & 	JJ 	K 	
 
 ##!!"' r   c           	          | j                   j                  |      }t        j                  | j                  |dd||d      S )a  List unregistered discovered services in the Projects/Location.

    Args:
      parent: str, projects/{projectId}/locations/{location}
      limit: int or None, the total number of results to return. Default value
        is None
      page_size: int, the number of entries in each batch (affects requests
        made, but not the yielded results). Default value is 100.

    Returns:
      Generator of matching discovered services.
    r    FindUnregisteredr"   r#   )methodr$   r%   r&   r'   )r   @ApphubProjectsLocationsDiscoveredServicesFindUnregisteredRequestr   r)   r   )r   r!   r&   r*   find_unregistered_reqs        r   r.   z)DiscoveredServicesClient.FindUnregisteredU   sR    $ !MMjj k  ##!!!"' r   c                 r    | j                   j                  ||      }| j                  j                  |      S )ah  Lookup a discovered service in the Project/location with a given uri.

    Args:
      parent: str, projects/{projectId_or_projectNumber}/locations/{location}
      uri: str, GCP resource URI to find service for Accepts both project number
        and project id and does translation when needed.

    Returns:
       discoveredService: Discovered service
    )r!   uri)r   6ApphubProjectsLocationsDiscoveredServicesLookupRequestr   Lookup)r   r!   r3   
lookup_reqs       r   r5   zDiscoveredServicesClient.Lookupt   s@     	LL 	M 	
  $$++J77r   )Nd   )__name__
__module____qualname____doc__r   ReleaseTrackALPHAr   r   r,   r.   r5    r   r   r
   r
      s>    *#'#4#4#:#: 7( 	F 	>8r   r
   N)r;   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.apphubr   r   googlecloudsdk.callioper   objectr
   r>   r   r   <module>rD      s*    & &  ' ' @ (l8v l8r   