I have to fetch billing data from BigQuery table in which the billing export was done. I have the project Id and Data set ID. To achieve this I followed these steps:
1. Fetched the list of tables present in that dataset and checked that table name matches with "gcp_billing_export_resource_v1_".
2. If that table name matches to the above value then i considered this as the billing export table. but here's the problem.I am able to create a table with this prefix and with same schema in that scenario i have two tables here. How to verify which one is valid?
As in GCP doc table name structure is mentioned like "gcp_billing_export_resource_v1_<BILLING_ACCOUNT_ID>" so that i tried to get BILLING ACCOUNT ID for the project. but that also failing.
the code is :
GetProjectBillingInfoRequest request = GetProjectBillingInfoRequest.newBuilder().setName(ProjectBillingInfoName.of("PROJECT_NAME_HERE").toString()).build();
CloudBillingClient billing = CloudBillingClient.create(settings);
billing.getProjectBillingInfo(request);
in the above code i am getting this error
"com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Request contains an invalid argument."
So I am not able to verify the table that is the one configured for billing export.
What is the change required to achieve this?
Thank you,
cloudGeek
Hi @cloudGeek,
You are in the right direction. The document link you provided is the right guide in finding your billing data table, what's left is to locate your Cloud Billing account ID.
A Cloud Billing account has both a user-assigned name and a system-generated billing account ID. The billing account ID is displayed on multiple pages in the Billing section of the Google Cloud console. If you have limited permissions to view billing information, you might not be able to view all the different pages in the Billing section.
Here are some example queries for Cloud Billing data export.
Hope this helps.