简体   繁体   中英

Python API for GCP Sub billing account

Do we have any direct Python method for creating GCP sub billing account under master billing account? I used the below API request but it seems to be a wrong method.

request = service.billingAccounts().create(displayName='testapi')

Signer is created using below method, where google service is "cloudbilling"

signer = crypt.RSASigner.from_string(key.strip())
credential = service_account.Credentials(signer, principal, google_token_uri)
service = build(googleservice, version, credentials=credential, cache_discovery=False)

I tried googling a python method to create sub billing but unable to find it.

I would like to share this documentation with you, in which you will find a python method to create a sub billing account.

Note that when creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the master account, which is typically given to billing account administrators https://cloud.google.com/billing/docs/how-to/billing-access . This method will return an error if the master account has not been provisioned as a reseller account.

Kind regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM