Billing Usage API, gRPC: MetadataService.GetServiceInstance
GetServiceInstance returns service instance usage metadata for a specific billing account and date range.
This method provides a view of all available service instance entities
that can be used for usage reporting within the specified date range
for the billing account and all its sub-accounts.
Implementation details:
- All data is filtered to only include items that had usage during the specified date range
Error handling:
- Returns INVALID_ARGUMENT if the request parameters fail validation
- Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
- Returns PERMISSION_DENIED if the user lacks required permissions
- Returns INTERNAL for internal server errors
This method supports additional filtering by service_instance_ids.
These filters work as supplementary conditions to the primary billing_account_id and date range filters.
When provided, they further narrow down the results by applying additional OR conditions for each filter type.
Required permissions:
billing.accounts.getReporton the specified billing account
gRPC request
rpc GetServiceInstance (GetServiceInstanceRequest) returns (GetServiceInstanceResponse)
GetServiceInstanceRequest
{
"billing_account_id": "string",
"start_date": "google.protobuf.Timestamp",
"end_date": "google.protobuf.Timestamp",
"service_instance_ids": [
"string"
]
}
GetServiceInstanceRequest request for retrieving service instance usage metadata
|
Field |
Description |
|
billing_account_id |
string Required field. Required. Billing account identifier. |
|
start_date |
Required field. Start date for data retrieval. |
|
end_date |
Required field. End date for data retrieval. |
|
service_instance_ids[] |
string Optional. Service instance IDs filter. |
GetServiceInstanceResponse
{
"service_instances": [
{
"id": "string",
"type": "string",
"name": "string",
"billing_account_id": "string"
}
]
}
Response for service instance usage metadata request
|
Field |
Description |
|
service_instances[] |
List of available service instances for the current user/context (billing_account_id with sub-accounts) |
ServiceInstance
Represents a service instance entity
|
Field |
Description |
|
id |
string Identifier of the service instance entity. |
|
type |
string Type of the service instance: tracker, datalens, cloud, etc. |
|
name |
string Human-readable display name of the service instance. |
|
billing_account_id |
string Optional billing account identifier associated with this service instance |