zzob
zzob

Reputation: 1134

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. I'm following on https://googleapis.dev/python/cloudbilling/latest/billing_v1/services.html By using the Google API

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? Before, I was used this gcloud sdk, for getting list.

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.

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?

Upvotes: 0

Views: 278

Answers (1)

zzob
zzob

Reputation: 1134

Oh, I Found just used billingAccounts/xxx-xxx-xxx It's work.

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. TT

Upvotes: 1

Related Questions