
                            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 d	d
ddZd Z ej                  ej                  j                          G d dej"                               Z ej                  ej                  j&                  ej                  j(                         G d dej"                               Zy)z Command to update a new project.    )absolute_import)division)unicode_literals)billing_client)base)flags)utilsaV            This command sets or updates the billing account associated with a
          project.

          Billing is enabled on a project when the project is linked to a valid,
          active Cloud Billing account. The billing account accrues charges
          for the usage of resources in all of the linked projects. If the
          project is already linked to a billing account, this command moves
          the project to the billing account you specify, updating the billing
          account that is linked to the project.

          Note that associating a project with a closed billing account has the
          same effect as disabling billing on the project: any paid resources
          in use by the project are shut down, and your application stops
          functioning. Unless you want to disable billing, you should always
          specify a valid, active Cloud Billing account when you run this
          command. Learn how to confirm the status of a Cloud Billing account at
          https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#billing_account_status
          z          To link a billing account `0X0X0X-0X0X0X-0X0X0X` with a project
          `my-project`, run:

            $ {command} my-project --billing-account=0X0X0X-0X0X0X-0X0X0X
          z          This command uses the *cloudbilling/v1* API. The full documentation
          for this API can be found at:
          https://cloud.google.com/billing/v1/getting-started
          )DESCRIPTIONEXAMPLESzAPI REFERENCEc                     t        j                         }t        j                  | j                        }t        j
                  | j                        }|j                  ||      S N)r   ProjectsClientr	   ParseProject
project_idParseAccountbilling_accountLink)argsclientproject_refaccount_refs       $lib/surface/billing/projects/link.py_RunLinkr   =   sK    ((*&""4??3+""4#7#78+	[+	..    c                   *    e Zd ZdZeZed        Zd Zy)	LinkAlpha&Link a project with a billing account.c                    | j                  d      }t        j                  d      j                  |       t        j                  d      j                  |       t        j
                         j                  |        y )NT)requiredF)
positional)add_mutually_exclusive_groupr   GetOldAccountIdArgumentAddToParserGetAccountIdArgumentGetProjectIdArgument)parseraccount_args_groups     r   ArgszLinkAlpha.ArgsJ   sc    <<d<K	!!U3??	%0<<=OP	 ,,V4r   c                     t        |      S r   r   selfr   s     r   RunzLinkAlpha.RunS       D>r   N	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr(   r-    r   r   r   r   D   s!    . -5 5r   r   c                   *    e Zd ZdZeZed        Zd Zy)r   r   c                     t        j                  dd      j                  |        t        j                         j                  |        y )NFT)r    r   )r   r$   r#   r%   )r&   s    r   r(   z	Link.Args]   s6    	%(,..9k&.A	 ,,V4r   c                     t        |      S r   r*   r+   s     r   r-   zLink.Runc   r.   r   Nr/   r7   r   r   r   r   W   s!    . -5 5
r   r   N)r3   
__future__r   r   r   googlecloudsdk.api_lib.billingr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.billingr   r	   r4   r   ReleaseTracksReleaseTrackALPHACommandr   BETAGAr   r7   r   r   <module>rE      s    ' &  ' 9 ( 4 4&5D/ D%%++,  -$ D%%**D,=,=,@,@A4<<  Br   