Class BudgetServiceClient (2.14.0)

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

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

BudgetServiceClient(BudgetServiceClient const &)

Copy and move support

Parameter
Name Description
BudgetServiceClient const &

BudgetServiceClient(BudgetServiceClient &&)

Copy and move support

Parameter
Name Description
BudgetServiceClient &&

BudgetServiceClient(std::shared_ptr< BudgetServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< BudgetServiceConnection >
opts Options

Operators

operator=(BudgetServiceClient const &)

Copy and move support

Parameter
Name Description
BudgetServiceClient const &
Returns
Type Description
BudgetServiceClient &

operator=(BudgetServiceClient &&)

Copy and move support

Parameter
Name Description
BudgetServiceClient &&
Returns
Type Description
BudgetServiceClient &

Functions

CreateBudget(std::string const &, google::cloud::billing::budgets::v1::Budget const &, Options)

Creates a new budget.

See Quotas and limits for more information on the limits of the number of budgets you can create.

Parameters
Name Description
parent std::string const &

Required. The name of the billing account to create the budget in. Values are of the form billingAccounts/{billingAccountId}.

budget google::cloud::billing::budgets::v1::Budget const &

Required. Budget to create.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateBudget(google::cloud::billing::budgets::v1::CreateBudgetRequest const &, Options)

Creates a new budget.

See Quotas and limits for more information on the limits of the number of budgets you can create.

Parameters
Name Description
request google::cloud::billing::budgets::v1::CreateBudgetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.billing.budgets.v1.CreateBudgetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateBudget(google::cloud::billing::budgets::v1::Budget const &, google::protobuf::FieldMask const &, Options)

Updates a budget and returns the updated budget.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. Budget fields that are not exposed in this API will not be changed by this method.

Parameters
Name Description
budget google::cloud::billing::budgets::v1::Budget const &

Required. The updated budget object. The budget to update is specified by the budget name in the budget.

update_mask google::protobuf::FieldMask const &

Optional. Indicates which fields in the provided budget to update. Read-only fields (such as name) cannot be changed. If this is not provided, then only fields with non-default values from the request are updated. See https://developers.google.com/protocol-buffers/docs/proto3#default for more details about default values.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateBudget(google::cloud::billing::budgets::v1::UpdateBudgetRequest const &, Options)

Updates a budget and returns the updated budget.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. Budget fields that are not exposed in this API will not be changed by this method.

Parameters
Name Description
request google::cloud::billing::budgets::v1::UpdateBudgetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.billing.budgets.v1.UpdateBudgetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetBudget(std::string const &, Options)

Returns a budget.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters
Name Description
name std::string const &

Required. Name of budget to get. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetBudget(google::cloud::billing::budgets::v1::GetBudgetRequest const &, Options)

Returns a budget.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters
Name Description
request google::cloud::billing::budgets::v1::GetBudgetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.billing.budgets.v1.GetBudgetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::billing::budgets::v1::Budget >

the result of the RPC. The response message type (google.cloud.billing.budgets.v1.Budget) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListBudgets(std::string const &, Options)

Returns a list of budgets for a billing account.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters
Name Description
parent std::string const &

Required. Name of billing account to list budgets under. Values are of the form billingAccounts/{billingAccountId}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::billing::budgets::v1::Budget >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.billing.budgets.v1.Budget, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListBudgets(google::cloud::billing::budgets::v1::ListBudgetsRequest, Options)

Returns a list of budgets for a billing account.

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters
Name Description
request google::cloud::billing::budgets::v1::ListBudgetsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.billing.budgets.v1.ListBudgetsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::billing::budgets::v1::Budget >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.billing.budgets.v1.Budget, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

DeleteBudget(std::string const &, Options)

Deletes a budget.

Returns successfully if already deleted.

Parameters
Name Description
name std::string const &

Required. Name of the budget to delete. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteBudget(google::cloud::billing::budgets::v1::DeleteBudgetRequest const &, Options)

Deletes a budget.

Returns successfully if already deleted.

Parameters
Name Description
request google::cloud::billing::budgets::v1::DeleteBudgetRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.billing.budgets.v1.DeleteBudgetRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.