
                             d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlmZ ddl	m
Z
 ddlmZ ddlZd	 Z G d
 d ej                  ej                   e            Z G d de      Z G d de      Zy)z,Common helper methods for Genomics commands.    )absolute_import)division)unicode_literalsN)genomics_util)waiter)	resourcesc                     d}t        j                  d| j                  d      d         rt               }n
t	               }||j                  |       fS )zCreates a client and resource reference for a name.

  Args:
    name: An operation name, optionally including projects/, operations/, and a
        project name.

  Returns:
    A tuple containing the genomics client and resource reference.
  Nz[a-zA-Z]/)researchsplitGenomicsV1ApiClientGenomicsV2ApiClientResourceFromName)nameclients     6lib/googlecloudsdk/api_lib/genomics/genomics_client.pyCreateFromNamer      sJ     &YYz4::c?2./ "F "F	((.	..    c                       e Zd ZdZd Zej                  d        Zej                  d        Zej                  d        Z	ej                  d        Z
y)GenomicsApiClientz9Base class for clients for accessing the genomics API.
  c                     t        j                  |      | _        t        j                  |      | _        t
        j                  j                         | _        | j                  j                  d|       y )Ngenomics)
r   GetGenomicsMessages	_messagesGetGenomicsClient_clientr   REGISTRYClone	_registryRegisterApiByName)selfversions     r   __init__zGenomicsApiClient.__init__6   sP    "66w?DN 227;DL''--/DNNN$$Z9r   c                     t               NNotImplementedErrorr#   r   s     r   r   z"GenomicsApiClient.ResourceFromName<       

r   c                     t               r'   r(   r#   s    r   PollerzGenomicsApiClient.Poller@   r+   r   c                     t               r'   r(   r#   resources     r   GetOperationzGenomicsApiClient.GetOperationD   r+   r   c                     t               r'   r(   r0   s     r   CancelOperationz!GenomicsApiClient.CancelOperationH   r+   r   N)__name__
__module____qualname____doc__r%   abcabstractmethodr   r.   r2   r4    r   r   r   r   2   st    :                r   r   c                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )r   z,Client for accessing the V1 genomics API.
  c                 ,    t         t        |   d       y )Nv1)superr   r%   r#   	__class__s    r   r%   zGenomicsV1ApiClient.__init__Q   s    	
t-d3r   c                 <    | j                   j                  |d      S )Nzgenomics.operations)
collection)r!   Parser*   s     r   r   z$GenomicsV1ApiClient.ResourceFromNameT   s    >>1FGGr   c                 T    t        j                  | j                  j                        S r'   )r   CloudOperationPollerNoResourcesr   
operationsr-   s    r   r.   zGenomicsV1ApiClient.PollerW   s    11$,,2I2IJJr   c                     | j                   j                  j                  | j                  j	                  |j                                     S N)r   )r   rG   Getr   GenomicsOperationsGetRequestRelativeNamer0   s     r   r2   z GenomicsV1ApiClient.GetOperationZ   sB    <<""&&33&&( 	4 	*+ +r   c                     | j                   j                  j                  | j                  j	                  |j                                     S rI   )r   rG   Cancelr   GenomicsOperationsCancelRequestrL   r0   s     r   r4   z#GenomicsV1ApiClient.CancelOperation_   sB    <<""))66&&( 	7 	*+ +r   
r5   r6   r7   r8   r%   r   r.   r2   r4   __classcell__rA   s   @r   r   r   M   s#    4HK+
+r   r   c                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )r   z,Client for accessing the V2 genomics API.
  c                 ,    t         t        |   d       y )Nv2alpha1)r?   r   r%   r@   s    r   r%   zGenomicsV2ApiClient.__init__i   s    	
t-j9r   c                 f    | j                   j                  |ddt        j                         i      S )Nzgenomics.projects.operations
projectsId)rC   params)r!   rD   r   GetProjectIdr*   s     r   r   z$GenomicsV2ApiClient.ResourceFromNamel   s5    >>7m88:;   = =r   c                 T    t        j                  | j                  j                        S r'   )r   rF   r   projects_operationsr-   s    r   r.   zGenomicsV2ApiClient.Pollerq   s"    11((* *r   c                     | j                   j                  j                  | j                  j	                  |j                                     S rI   )r   r[   rJ   r   $GenomicsProjectsOperationsGetRequestrL   r0   s     r   r2   z GenomicsV2ApiClient.GetOperationu   sB    <<++//;;&&( 	< 	*+ +r   c                     | j                   j                  j                  | j                  j	                  |j                                     S rI   )r   r[   rN   r   'GenomicsProjectsOperationsCancelRequestrL   r0   s     r   r4   z#GenomicsV2ApiClient.CancelOperationz   sB    <<++22>>&&( 	? 	*+ +r   rP   rR   s   @r   r   r   e   s!    :=
*+
+r   r   )r8   
__future__r   r   r   r9   r   googlecloudsdk.api_lib.genomicsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   sixr   with_metaclassABCMetaobjectr   r   r   r;   r   r   <module>rh      sd     3 &  ' 
 	 9 . ) 
/( ***3;;?  6++ +0++ +r   