Package com.google.cloud.billing.v1 (2.16.0)

A client to Cloud Billing API

The interfaces provided are listed below, along with usage samples.

CloudBillingClient

Service Description: Retrieves the Google Cloud Console billing accounts and associates them with projects.

Sample for CloudBillingClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
   BillingAccount response = cloudBillingClient.getBillingAccount(name);
 }
 

CloudCatalogClient

Service Description: A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

Sample for CloudCatalogClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
   for (Service element : cloudCatalogClient.listServices().iterateAll()) {
     // doThingsWith(element);
   }
 }
 

Classes

AggregationInfo

Represents the aggregation level and interval for pricing of a single SKU.

Protobuf type google.cloud.billing.v1.AggregationInfo

AggregationInfo.Builder

Represents the aggregation level and interval for pricing of a single SKU.

Protobuf type google.cloud.billing.v1.AggregationInfo

BillingAccount

A billing account in the Google Cloud Console. You can assign a billing account to one or more projects.

Protobuf type google.cloud.billing.v1.BillingAccount

BillingAccount.Builder

A billing account in the Google Cloud Console. You can assign a billing account to one or more projects.

Protobuf type google.cloud.billing.v1.BillingAccount

BillingAccountName

BillingAccountName.Builder

Builder for billingAccounts/{billing_account}.

Category

Represents the category hierarchy of a SKU.

Protobuf type google.cloud.billing.v1.Category

Category.Builder

Represents the category hierarchy of a SKU.

Protobuf type google.cloud.billing.v1.Category

CloudBillingClient

Service Description: Retrieves the Google Cloud Console billing accounts and associates them with projects.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
   BillingAccount response = cloudBillingClient.getBillingAccount(name);
 }
 

Note: close() needs to be called on the CloudBillingClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of CloudBillingSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudBillingSettings cloudBillingSettings =
     CloudBillingSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudBillingClient cloudBillingClient = CloudBillingClient.create(cloudBillingSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudBillingSettings cloudBillingSettings =
     CloudBillingSettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudBillingClient cloudBillingClient = CloudBillingClient.create(cloudBillingSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudBillingSettings cloudBillingSettings = CloudBillingSettings.newHttpJsonBuilder().build();
 CloudBillingClient cloudBillingClient = CloudBillingClient.create(cloudBillingSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

CloudBillingClient.ListBillingAccountsFixedSizeCollection

CloudBillingClient.ListBillingAccountsPage

CloudBillingClient.ListBillingAccountsPagedResponse

CloudBillingClient.ListProjectBillingInfoFixedSizeCollection

CloudBillingClient.ListProjectBillingInfoPage

CloudBillingClient.ListProjectBillingInfoPagedResponse

CloudBillingGrpc

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudBillingGrpc.CloudBillingBlockingStub

A stub to allow clients to do synchronous rpc calls to service CloudBilling.

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudBillingGrpc.CloudBillingFutureStub

A stub to allow clients to do ListenableFuture-style rpc calls to service CloudBilling.

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudBillingGrpc.CloudBillingImplBase

Base class for the server implementation of the service CloudBilling.

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudBillingGrpc.CloudBillingStub

A stub to allow clients to do asynchronous rpc calls to service CloudBilling.

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudBillingProto

CloudBillingSettings

Settings class to configure an instance of CloudBillingClient.

The default instance has everything set to sensible defaults:

  • The default service address (cloudbilling.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getBillingAccount to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudBillingSettings.Builder cloudBillingSettingsBuilder = CloudBillingSettings.newBuilder();
 cloudBillingSettingsBuilder
     .getBillingAccountSettings()
     .setRetrySettings(
         cloudBillingSettingsBuilder
             .getBillingAccountSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 CloudBillingSettings cloudBillingSettings = cloudBillingSettingsBuilder.build();
 

CloudBillingSettings.Builder

Builder for CloudBillingSettings.

CloudCatalogClient

Service Description: A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
   for (Service element : cloudCatalogClient.listServices().iterateAll()) {
     // doThingsWith(element);
   }
 }
 

Note: close() needs to be called on the CloudCatalogClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of CloudCatalogSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudCatalogSettings cloudCatalogSettings =
     CloudCatalogSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create(cloudCatalogSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudCatalogSettings cloudCatalogSettings =
     CloudCatalogSettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create(cloudCatalogSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudCatalogSettings cloudCatalogSettings = CloudCatalogSettings.newHttpJsonBuilder().build();
 CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create(cloudCatalogSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

CloudCatalogClient.ListServicesFixedSizeCollection

CloudCatalogClient.ListServicesPage

CloudCatalogClient.ListServicesPagedResponse

CloudCatalogClient.ListSkusFixedSizeCollection

CloudCatalogClient.ListSkusPage

CloudCatalogClient.ListSkusPagedResponse

CloudCatalogGrpc

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CloudCatalogGrpc.CloudCatalogBlockingStub

A stub to allow clients to do synchronous rpc calls to service CloudCatalog.

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CloudCatalogGrpc.CloudCatalogFutureStub

A stub to allow clients to do ListenableFuture-style rpc calls to service CloudCatalog.

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CloudCatalogGrpc.CloudCatalogImplBase

Base class for the server implementation of the service CloudCatalog.

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CloudCatalogGrpc.CloudCatalogStub

A stub to allow clients to do asynchronous rpc calls to service CloudCatalog.

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CloudCatalogProto

CloudCatalogSettings

Settings class to configure an instance of CloudCatalogClient.

The default instance has everything set to sensible defaults:

  • The default service address (cloudbilling.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of listServices to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 CloudCatalogSettings.Builder cloudCatalogSettingsBuilder = CloudCatalogSettings.newBuilder();
 cloudCatalogSettingsBuilder
     .listServicesSettings()
     .setRetrySettings(
         cloudCatalogSettingsBuilder
             .listServicesSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 CloudCatalogSettings cloudCatalogSettings = cloudCatalogSettingsBuilder.build();
 

CloudCatalogSettings.Builder

Builder for CloudCatalogSettings.

CreateBillingAccountRequest

Request message for CreateBillingAccount.

Protobuf type google.cloud.billing.v1.CreateBillingAccountRequest

CreateBillingAccountRequest.Builder

Request message for CreateBillingAccount.

Protobuf type google.cloud.billing.v1.CreateBillingAccountRequest

GeoTaxonomy

Encapsulates the geographic taxonomy data for a sku.

Protobuf type google.cloud.billing.v1.GeoTaxonomy

GeoTaxonomy.Builder

Encapsulates the geographic taxonomy data for a sku.

Protobuf type google.cloud.billing.v1.GeoTaxonomy

GetBillingAccountRequest

Request message for GetBillingAccount.

Protobuf type google.cloud.billing.v1.GetBillingAccountRequest

GetBillingAccountRequest.Builder

Request message for GetBillingAccount.

Protobuf type google.cloud.billing.v1.GetBillingAccountRequest

GetProjectBillingInfoRequest

Request message for GetProjectBillingInfo.

Protobuf type google.cloud.billing.v1.GetProjectBillingInfoRequest

GetProjectBillingInfoRequest.Builder

Request message for GetProjectBillingInfo.

Protobuf type google.cloud.billing.v1.GetProjectBillingInfoRequest

ListBillingAccountsRequest

Request message for ListBillingAccounts.

Protobuf type google.cloud.billing.v1.ListBillingAccountsRequest

ListBillingAccountsRequest.Builder

Request message for ListBillingAccounts.

Protobuf type google.cloud.billing.v1.ListBillingAccountsRequest

ListBillingAccountsResponse

Response message for ListBillingAccounts.

Protobuf type google.cloud.billing.v1.ListBillingAccountsResponse

ListBillingAccountsResponse.Builder

Response message for ListBillingAccounts.

Protobuf type google.cloud.billing.v1.ListBillingAccountsResponse

ListProjectBillingInfoRequest

Request message for ListProjectBillingInfo.

Protobuf type google.cloud.billing.v1.ListProjectBillingInfoRequest

ListProjectBillingInfoRequest.Builder

Request message for ListProjectBillingInfo.

Protobuf type google.cloud.billing.v1.ListProjectBillingInfoRequest

ListProjectBillingInfoResponse

Request message for ListProjectBillingInfoResponse.

Protobuf type google.cloud.billing.v1.ListProjectBillingInfoResponse

ListProjectBillingInfoResponse.Builder

Request message for ListProjectBillingInfoResponse.

Protobuf type google.cloud.billing.v1.ListProjectBillingInfoResponse

ListServicesRequest

Request message for ListServices.

Protobuf type google.cloud.billing.v1.ListServicesRequest

ListServicesRequest.Builder

Request message for ListServices.

Protobuf type google.cloud.billing.v1.ListServicesRequest

ListServicesResponse

Response message for ListServices.

Protobuf type google.cloud.billing.v1.ListServicesResponse

ListServicesResponse.Builder

Response message for ListServices.

Protobuf type google.cloud.billing.v1.ListServicesResponse

ListSkusRequest

Request message for ListSkus.

Protobuf type google.cloud.billing.v1.ListSkusRequest

ListSkusRequest.Builder

Request message for ListSkus.

Protobuf type google.cloud.billing.v1.ListSkusRequest

ListSkusResponse

Response message for ListSkus.

Protobuf type google.cloud.billing.v1.ListSkusResponse

ListSkusResponse.Builder

Response message for ListSkus.

Protobuf type google.cloud.billing.v1.ListSkusResponse

PricingExpression

Expresses a mathematical pricing formula. For Example:- usage_unit: GBy tiered_rates: [start_usage_amount: 20, unit_price: $10] [start_usage_amount: 100, unit_price: $5] The above expresses a pricing formula where the first 20GB is free, the next 80GB is priced at $10 per GB followed by $5 per GB for additional usage.

Protobuf type google.cloud.billing.v1.PricingExpression

PricingExpression.Builder

Expresses a mathematical pricing formula. For Example:- usage_unit: GBy tiered_rates: [start_usage_amount: 20, unit_price: $10] [start_usage_amount: 100, unit_price: $5] The above expresses a pricing formula where the first 20GB is free, the next 80GB is priced at $10 per GB followed by $5 per GB for additional usage.

Protobuf type google.cloud.billing.v1.PricingExpression

PricingExpression.TierRate

The price rate indicating starting usage and its corresponding price.

Protobuf type google.cloud.billing.v1.PricingExpression.TierRate

PricingExpression.TierRate.Builder

The price rate indicating starting usage and its corresponding price.

Protobuf type google.cloud.billing.v1.PricingExpression.TierRate

PricingInfo

Represents the pricing information for a SKU at a single point of time.

Protobuf type google.cloud.billing.v1.PricingInfo

PricingInfo.Builder

Represents the pricing information for a SKU at a single point of time.

Protobuf type google.cloud.billing.v1.PricingInfo

ProjectBillingInfo

Encapsulation of billing information for a Google Cloud Console project. A project has at most one associated billing account at a time (but a billing account can be assigned to multiple projects).

Protobuf type google.cloud.billing.v1.ProjectBillingInfo

ProjectBillingInfo.Builder

Encapsulation of billing information for a Google Cloud Console project. A project has at most one associated billing account at a time (but a billing account can be assigned to multiple projects).

Protobuf type google.cloud.billing.v1.ProjectBillingInfo

Service

Encapsulates a single service in Google Cloud Platform.

Protobuf type google.cloud.billing.v1.Service

Service.Builder

Encapsulates a single service in Google Cloud Platform.

Protobuf type google.cloud.billing.v1.Service

ServiceName

ServiceName.Builder

Builder for services/{service}.

Sku

Encapsulates a single SKU in Google Cloud Platform

Protobuf type google.cloud.billing.v1.Sku

Sku.Builder

Encapsulates a single SKU in Google Cloud Platform

Protobuf type google.cloud.billing.v1.Sku

UpdateBillingAccountRequest

Request message for UpdateBillingAccount.

Protobuf type google.cloud.billing.v1.UpdateBillingAccountRequest

UpdateBillingAccountRequest.Builder

Request message for UpdateBillingAccount.

Protobuf type google.cloud.billing.v1.UpdateBillingAccountRequest

UpdateProjectBillingInfoRequest

Request message for UpdateProjectBillingInfo.

Protobuf type google.cloud.billing.v1.UpdateProjectBillingInfoRequest

UpdateProjectBillingInfoRequest.Builder

Request message for UpdateProjectBillingInfo.

Protobuf type google.cloud.billing.v1.UpdateProjectBillingInfoRequest

Interfaces

AggregationInfoOrBuilder

BillingAccountOrBuilder

CategoryOrBuilder

CloudBillingGrpc.AsyncService

Retrieves the Google Cloud Console billing accounts and associates them with projects.

CloudCatalogGrpc.AsyncService

A catalog of Google Cloud Platform services and SKUs. Provides pricing information and metadata on Google Cloud Platform services and SKUs.

CreateBillingAccountRequestOrBuilder

GeoTaxonomyOrBuilder

GetBillingAccountRequestOrBuilder

GetProjectBillingInfoRequestOrBuilder

ListBillingAccountsRequestOrBuilder

ListBillingAccountsResponseOrBuilder

ListProjectBillingInfoRequestOrBuilder

ListProjectBillingInfoResponseOrBuilder

ListServicesRequestOrBuilder

ListServicesResponseOrBuilder

ListSkusRequestOrBuilder

ListSkusResponseOrBuilder

PricingExpression.TierRateOrBuilder

PricingExpressionOrBuilder

PricingInfoOrBuilder

ProjectBillingInfoOrBuilder

ServiceOrBuilder

SkuOrBuilder

UpdateBillingAccountRequestOrBuilder

UpdateProjectBillingInfoRequestOrBuilder

Enums

AggregationInfo.AggregationInterval

The interval at which usage is aggregated to compute cost. Example: "MONTHLY" aggregation interval indicates that usage for tiered pricing is aggregated every month.

Protobuf enum google.cloud.billing.v1.AggregationInfo.AggregationInterval

AggregationInfo.AggregationLevel

The level at which usage is aggregated to compute cost. Example: "ACCOUNT" aggregation level indicates that usage for tiered pricing is aggregated across all projects in a single account.

Protobuf enum google.cloud.billing.v1.AggregationInfo.AggregationLevel

GeoTaxonomy.Type

The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.

Protobuf enum google.cloud.billing.v1.GeoTaxonomy.Type