简体   繁体   English

Python API 用于 GCP 子计费帐户

[英]Python API for GCP Sub billing account

Do we have any direct Python method for creating GCP sub billing account under master billing account?我们有没有直接的 Python 方法在主计费帐户下创建 GCP 子计费帐户? I used the below API request but it seems to be a wrong method.我使用了下面的 API 请求,但这似乎是一个错误的方法。

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

Signer is created using below method, where google service is "cloudbilling"签名者是使用以下方法创建的,其中 google 服务是“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.我尝试用谷歌搜索 python 方法来创建子计费但找不到它。

I would like to share this documentation with you, in which you will find a python method to create a sub billing account.我想与您分享此文档,您将在其中找到创建子计费帐户的 python 方法。

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 .请注意,在创建子账户时,当前经过身份验证的用户必须对主账户具有 billing.accounts.update IAM 权限,该权限通常授予计费账户管理员https://cloud.google.com/billing/docs/how-到/计费访问 This method will return an error if the master account has not been provisioned as a reseller account.如果未将主帐户配置为经销商帐户,此方法将返回错误。

Kind regards.亲切的问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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