Package com.google.cloud.billing.budgets.v1beta1 (2.11.0)

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

BudgetServiceClient

Service Description: BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

Sample for BudgetServiceClient:


 // 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 (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
   CreateBudgetRequest request =
       CreateBudgetRequest.newBuilder()
           .setParent(BillingAccountName.of("[BILLING_ACCOUNT]").toString())
           .setBudget(Budget.newBuilder().build())
           .build();
   Budget response = budgetServiceClient.createBudget(request);
 }
 

Classes

AllUpdatesRule

AllUpdatesRule defines notifications that are sent based on budget spend and thresholds.

Protobuf type google.cloud.billing.budgets.v1beta1.AllUpdatesRule

AllUpdatesRule.Builder

AllUpdatesRule defines notifications that are sent based on budget spend and thresholds.

Protobuf type google.cloud.billing.budgets.v1beta1.AllUpdatesRule

Budget

A budget is a plan that describes what you expect to spend on Cloud projects, plus the rules to execute as spend is tracked against that plan, (for example, send an alert when 90% of the target spend is met). The budget time period is configurable, with options such as month (default), quarter, year, or custom time period.

Protobuf type google.cloud.billing.budgets.v1beta1.Budget

Budget.Builder

A budget is a plan that describes what you expect to spend on Cloud projects, plus the rules to execute as spend is tracked against that plan, (for example, send an alert when 90% of the target spend is met). The budget time period is configurable, with options such as month (default), quarter, year, or custom time period.

Protobuf type google.cloud.billing.budgets.v1beta1.Budget

BudgetAmount

The budgeted amount for each usage period.

Protobuf type google.cloud.billing.budgets.v1beta1.BudgetAmount

BudgetAmount.Builder

The budgeted amount for each usage period.

Protobuf type google.cloud.billing.budgets.v1beta1.BudgetAmount

BudgetModel

BudgetName

BudgetName.Builder

Builder for billingAccounts/{billing_account}/budgets/{budget}.

BudgetServiceClient

Service Description: BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

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 (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
   CreateBudgetRequest request =
       CreateBudgetRequest.newBuilder()
           .setParent(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
           .setBudget(Budget.newBuilder().build())
           .build();
   Budget response = budgetServiceClient.createBudget(request);
 }
 

Note: close() needs to be called on the BudgetServiceClient 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 BudgetServiceSettings 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
 BudgetServiceSettings budgetServiceSettings =
     BudgetServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 BudgetServiceClient budgetServiceClient = BudgetServiceClient.create(budgetServiceSettings);
 

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
 BudgetServiceSettings budgetServiceSettings =
     BudgetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 BudgetServiceClient budgetServiceClient = BudgetServiceClient.create(budgetServiceSettings);
 

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

BudgetServiceClient.ListBudgetsFixedSizeCollection

BudgetServiceClient.ListBudgetsPage

BudgetServiceClient.ListBudgetsPagedResponse

BudgetServiceGrpc

BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

BudgetServiceGrpc.BudgetServiceBlockingStub

BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

BudgetServiceGrpc.BudgetServiceFutureStub

BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

BudgetServiceGrpc.BudgetServiceImplBase

BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

BudgetServiceGrpc.BudgetServiceStub

BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.

BudgetServiceOuterClass

BudgetServiceSettings

Settings class to configure an instance of BudgetServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (billingbudgets.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 createBudget 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
 BudgetServiceSettings.Builder budgetServiceSettingsBuilder = BudgetServiceSettings.newBuilder();
 budgetServiceSettingsBuilder
     .createBudgetSettings()
     .setRetrySettings(
         budgetServiceSettingsBuilder
             .createBudgetSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 BudgetServiceSettings budgetServiceSettings = budgetServiceSettingsBuilder.build();
 

BudgetServiceSettings.Builder

Builder for BudgetServiceSettings.

CreateBudgetRequest

Request for CreateBudget

Protobuf type google.cloud.billing.budgets.v1beta1.CreateBudgetRequest

CreateBudgetRequest.Builder

Request for CreateBudget

Protobuf type google.cloud.billing.budgets.v1beta1.CreateBudgetRequest

CustomPeriod

All date times begin at 12 AM US and Canadian Pacific Time (UTC-8).

Protobuf type google.cloud.billing.budgets.v1beta1.CustomPeriod

CustomPeriod.Builder

All date times begin at 12 AM US and Canadian Pacific Time (UTC-8).

Protobuf type google.cloud.billing.budgets.v1beta1.CustomPeriod

DeleteBudgetRequest

Request for DeleteBudget

Protobuf type google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest

DeleteBudgetRequest.Builder

Request for DeleteBudget

Protobuf type google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest

Filter

A filter for a budget, limiting the scope of the cost to calculate.

Protobuf type google.cloud.billing.budgets.v1beta1.Filter

Filter.Builder

A filter for a budget, limiting the scope of the cost to calculate.

Protobuf type google.cloud.billing.budgets.v1beta1.Filter

GetBudgetRequest

Request for GetBudget

Protobuf type google.cloud.billing.budgets.v1beta1.GetBudgetRequest

GetBudgetRequest.Builder

Request for GetBudget

Protobuf type google.cloud.billing.budgets.v1beta1.GetBudgetRequest

LastPeriodAmount

Describes a budget amount targeted to the last Filter.calendar_period spend. At this time, the amount is automatically 100% of the last calendar period's spend; that is, there are no other options yet. Future configuration options will be described here (for example, configuring a percentage of last period's spend). LastPeriodAmount cannot be set for a budget configured with a Filter.custom_period.

Protobuf type google.cloud.billing.budgets.v1beta1.LastPeriodAmount

LastPeriodAmount.Builder

Describes a budget amount targeted to the last Filter.calendar_period spend. At this time, the amount is automatically 100% of the last calendar period's spend; that is, there are no other options yet. Future configuration options will be described here (for example, configuring a percentage of last period's spend). LastPeriodAmount cannot be set for a budget configured with a Filter.custom_period.

Protobuf type google.cloud.billing.budgets.v1beta1.LastPeriodAmount

ListBudgetsRequest

Request for ListBudgets

Protobuf type google.cloud.billing.budgets.v1beta1.ListBudgetsRequest

ListBudgetsRequest.Builder

Request for ListBudgets

Protobuf type google.cloud.billing.budgets.v1beta1.ListBudgetsRequest

ListBudgetsResponse

Response for ListBudgets

Protobuf type google.cloud.billing.budgets.v1beta1.ListBudgetsResponse

ListBudgetsResponse.Builder

Response for ListBudgets

Protobuf type google.cloud.billing.budgets.v1beta1.ListBudgetsResponse

ThresholdRule

ThresholdRule contains the definition of a threshold. Threshold rules define the triggering events used to generate a budget notification email. When a threshold is crossed (spend exceeds the specified percentages of the budget), budget alert emails are sent to the email recipients you specify in the NotificationsRule. Threshold rules also affect the fields included in the JSON data object sent to a Pub/Sub topic. Threshold rules are required if using email notifications. Threshold rules are optional if only setting a pubsubTopic NotificationsRule, unless you want your JSON data object to include data about the thresholds you set. For more information, see set budget threshold rules and actions.

Protobuf type google.cloud.billing.budgets.v1beta1.ThresholdRule

ThresholdRule.Builder

ThresholdRule contains the definition of a threshold. Threshold rules define the triggering events used to generate a budget notification email. When a threshold is crossed (spend exceeds the specified percentages of the budget), budget alert emails are sent to the email recipients you specify in the NotificationsRule. Threshold rules also affect the fields included in the JSON data object sent to a Pub/Sub topic. Threshold rules are required if using email notifications. Threshold rules are optional if only setting a pubsubTopic NotificationsRule, unless you want your JSON data object to include data about the thresholds you set. For more information, see set budget threshold rules and actions.

Protobuf type google.cloud.billing.budgets.v1beta1.ThresholdRule

UpdateBudgetRequest

Request for UpdateBudget

Protobuf type google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest

UpdateBudgetRequest.Builder

Request for UpdateBudget

Protobuf type google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest

Interfaces

AllUpdatesRuleOrBuilder

BudgetAmountOrBuilder

BudgetOrBuilder

CreateBudgetRequestOrBuilder

CustomPeriodOrBuilder

DeleteBudgetRequestOrBuilder

FilterOrBuilder

GetBudgetRequestOrBuilder

LastPeriodAmountOrBuilder

ListBudgetsRequestOrBuilder

ListBudgetsResponseOrBuilder

ThresholdRuleOrBuilder

UpdateBudgetRequestOrBuilder

Enums

BudgetAmount.BudgetAmountCase

CalendarPeriod

A CalendarPeriod represents the abstract concept of a time period that has a canonical start. Grammatically, "the start of the current CalendarPeriod". All calendar times begin at 12 AM US and Canadian Pacific Time (UTC-8).

Protobuf enum google.cloud.billing.budgets.v1beta1.CalendarPeriod

Filter.CreditTypesTreatment

Specifies how credits are applied when determining the spend for threshold calculations. Budgets track the total cost minus any applicable selected credits. See the documentation for a list of credit types.

Protobuf enum google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment

Filter.UsagePeriodCase

ThresholdRule.Basis

The type of basis used to determine if spend has passed the threshold.

Protobuf enum google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis