简体   繁体   English

如何使用 Google API 计费获取 IAM 政策

[英]How to get IAM Policy using Google API billing

I'm working on GoogleCloud API, Which I would like to get all member and role of billing account.我正在研究 GoogleCloud API,我想获得所有成员和计费帐户的角色。 I'm following on https://googleapis.dev/python/cloudbilling/latest/billing_v1/services.html By using the Google API我正在关注https://googleapis.dev/python/cloudbilling/latest/billing_v1/services.html通过使用谷歌 ZDB974238714CA8DE634A7CE1D083A14ZF

billing_v1.CloudBillingClient().get_iam_policy()

Which I already have crendetials as file.我已经有凭证作为文件。 I'm confuse on parameter resource what the value of parameter take it.我对参数资源感到困惑,参数的值是什么。 The example explain like projects/{project} but I don't understand what the {project} is mean?该示例解释为projects/{project}但我不明白{project}是什么意思? Before, I was used this gcloud sdk, for getting list.之前,我使用这个 gcloud sdk 来获取列表。

gcloud beta billing accounts get-iam-policy <ACCOUNT_ID>

It's work fine but when I back to work with google API by following the below.它工作正常,但是当我按照以下操作重新使用谷歌 API 时。

billing_v1.CloudBillingClient(credentials = credentials).get_iam_policy(resource="projects/xxxx/xxx")

It's look doesn't work still got error.它的外观不起作用仍然有错误。

Please anyone have idea, How to use this function?请任何人知道,如何使用这个 function?

Oh, I Found just used billingAccounts/xxx-xxx-xxx It's work.哦,我发现刚刚用了 billingAccounts/xxx-xxx-xxx就可以了。

billing_v1.CloudBillingClient(credentials = credentials).get_iam_policy(resource="billingAccounts/xxx-xxx-xxx")

Why the documents is mentioned to projects/{project} doesn't understand it.为什么向projects/{project}提及文档的原因不明白。 TT TT

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

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