
                         p    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  G d de	      Z
 G d	 d
e	      Zy)z#Client class for Cloud Billing API.    )absolute_import)division)unicode_literals)
list_pager)utilsc                   &    e Zd ZdZddZd ZddZy)AccountsClientz/High-level client for billing accounts service.Nc                     |xs t        j                         | _        |xs | j                  j                  | _        | j                  j
                  | _        y N)r   	GetClientclientMESSAGES_MODULEmessagesbillingAccounts_serviceselfr   r   s      4lib/googlecloudsdk/api_lib/billing/billing_client.py__init__zAccountsClient.__init__   s<    -EOO-DK; ; ;DMKK//DM    c                     | j                   j                  | j                  j                  |j	                                     S Nname)r   Getr   %CloudbillingBillingAccountsGetRequestRelativeName)r   account_refs     r   r   zAccountsClient.Get"   s<    ==;;))+ 	< 	-. .r   c                 z    t        j                  | j                  | j                  j	                         dd|      S )Nr   pageSizefieldbatch_size_attributelimit)r   YieldFromListr   r   &CloudbillingBillingAccountsListRequest)r   r$   s     r   ListzAccountsClient.List'   s5    ##<<>' r   NNr   )__name__
__module____qualname____doc__r   r   r'    r   r   r	   r	      s    70
.
r   r	   c                   ,    e Zd ZdZddZd Zd ZddZy)	ProjectsClientz/High-level client for billing projects service.Nc                 |    |xs t        j                         | _        |xs | j                  j                  | _        y r   )r   r   r   r   r   r   s      r   r   zProjectsClient.__init__4   s+    -EOO-DK; ; ;DMr   c                     | j                   j                  j                  | j                  j	                  |j                                     S r   )r   projectsGetBillingInfor   )CloudbillingProjectsGetBillingInfoRequestr   )r   project_refs     r   r   zProjectsClient.Get:   sC    ;;..??))+ 	@ 	
 r   c                     |r|j                         nd}| j                  j                  j                  | j                  j                  |j                         | j                  j                  |                  S )aF  Link the given account to the given project.

    Args:
      project_ref: a Resource reference to the project to be linked to
      account_ref: a Resource reference to the account to link, or None to
        unlink the project from its current account.

    Returns:
      ProjectBillingInfo, the new ProjectBillingInfo
     )billingAccountName)r   projectBillingInfo)r   r   r2   UpdateBillingInfor   ,CloudbillingProjectsUpdateBillingInfoRequestProjectBillingInfo)r   r5   r   billing_account_names       r   LinkzProjectsClient.LinkA   st     :E;335";;11BB))+#}}??#7  @   	C 	
 r   c                     t        j                  | j                  j                  | j                  j                  |j                               dd|      S )Nr   r9   r    r!   )r   r%   r   billingAccounts_projectsr   .CloudbillingBillingAccountsProjectsListRequestr   )r   r   r$   s      r   r'   zProjectsClient.ListV   sQ    ##,,DD))+ 	E 	
 #' r   r(   r   )r)   r*   r+   r,   r   r   r>   r'   r-   r   r   r/   r/   1   s    7<*	r   r/   N)r,   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.billingr   objectr	   r/   r-   r   r   <module>rF      s1    * &  ' ' 0V ..V .r   