
                         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 Workloads 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)	DiscoveredWorkloadsClientz#Client for workloads in apphub API.c                     t        j                  |      | _        t        j                  |      | _        | j                  j
                  | _        y )N)api_lib_utilsGetClientInstanceclientGetMessagesModulemessages&projects_locations_discoveredWorkloads_dis_workloads_client)selfrelease_tracks     9lib/googlecloudsdk/api_lib/apphub/discovered_workloads.py__init__z"DiscoveredWorkloadsClient.__init__   s;    11-@DK!33MBDM:: 	    c                 p    | j                   j                  |      }| j                  j                  |      S )zDescribe a Discovered Workload in the Project/location.

    Args:
      discovered_workload: str, the name for the discovered workload being
        described.

    Returns:
      Described discovered workload Resource.
    )name)r   4ApphubProjectsLocationsDiscoveredWorkloadsGetRequestr   Get)r   discovered_workloaddescribe_reqs      r   Describez"DiscoveredWorkloadsClient.Describe$   s=     	JJ$ 	K 	
 
 %%)),77r   Nc                     | j                   j                  |      }t        j                  | j                  |d||d      S )a  List discovered workloads 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 workloads.
    parentdiscoveredWorkloadspageSize)field
batch_sizelimitbatch_size_attribute)r   5ApphubProjectsLocationsDiscoveredWorkloadsListRequestr   YieldFromListr   )r   r!   r&   	page_sizelist_reqs        r   ListzDiscoveredWorkloadsClient.List5   sQ    & 	KK 	L 	
 
 ##""#' r   c           	          | j                   j                  |      }t        j                  | j                  |dd||d      S )a  List unregistered discovered workloads 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 workloads.
    r    FindUnregisteredr"   r#   )methodr$   r%   r&   r'   )r   AApphubProjectsLocationsDiscoveredWorkloadsFindUnregisteredRequestr   r)   r   )r   r!   r&   r*   find_unregistered_reqs        r   r.   z*DiscoveredWorkloadsClient.FindUnregisteredU   sR    $ !MMkk l  ##""!#' r   c                 r    | j                   j                  ||      }| j                  j                  |      S )al  Lookup a discovered workload in the Project/location with a given uri.

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

    Returns:
       discoveredWorkload: Discovered workload
    )r!   uri)r   7ApphubProjectsLocationsDiscoveredWorkloadsLookupRequestr   Lookup)r   r!   r3   
lookup_reqs       r   r5   z DiscoveredWorkloadsClient.Lookupt   s@     	MM 	N 	
  %%,,Z88r   )Nd   )__name__
__module____qualname____doc__r   ReleaseTrackALPHAr   r   r,   r.   r5    r   r   r
   r
      s>    +#'#4#4#:#: 8( 	F 	>9r   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9 l9r   