Reference documentation and code samples for the Billing Budgets V1beta1 API class Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.
Client for the BudgetService service.
BudgetService stores Cloud Billing budgets, which define a budget plan and rules to execute as we track spend against that plan.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the BudgetService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all BudgetService clients ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the BudgetService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_budget
def create_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
def create_budget(parent: nil, budget: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
Creates a new budget. See Quotas and limits for more information on the limits of the number of budgets you can create.
def create_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
create_budget
via a request object, either of type
CreateBudgetRequest or an equivalent Hash.
- request (::Google::Cloud::Billing::Budgets::V1beta1::CreateBudgetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_budget(parent: nil, budget: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
create_budget
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The name of the billing account to create the budget in. Values
are of the form
billingAccounts/{billingAccountId}
. - budget (::Google::Cloud::Billing::Budgets::V1beta1::Budget, ::Hash) — Required. Budget to create.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Billing::Budgets::V1beta1::Budget)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/billing/budgets/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Billing::Budgets::V1beta1::CreateBudgetRequest.new # Call the create_budget method. result = client.create_budget request # The returned object is of type Google::Cloud::Billing::Budgets::V1beta1::Budget. p result
#delete_budget
def delete_budget(request, options = nil) -> ::Google::Protobuf::Empty
def delete_budget(name: nil) -> ::Google::Protobuf::Empty
Deletes a budget. Returns successfully if already deleted.
def delete_budget(request, options = nil) -> ::Google::Protobuf::Empty
delete_budget
via a request object, either of type
DeleteBudgetRequest or an equivalent Hash.
- request (::Google::Cloud::Billing::Budgets::V1beta1::DeleteBudgetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_budget(name: nil) -> ::Google::Protobuf::Empty
delete_budget
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Name of the budget to delete. Values are of the form
billingAccounts/{billingAccountId}/budgets/{budgetId}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/billing/budgets/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Billing::Budgets::V1beta1::DeleteBudgetRequest.new # Call the delete_budget method. result = client.delete_budget request # The returned object is of type Google::Protobuf::Empty. p result
#get_budget
def get_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
def get_budget(name: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
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.
def get_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
get_budget
via a request object, either of type
GetBudgetRequest or an equivalent Hash.
- request (::Google::Cloud::Billing::Budgets::V1beta1::GetBudgetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_budget(name: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
get_budget
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Name of budget to get. Values are of the form
billingAccounts/{billingAccountId}/budgets/{budgetId}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Billing::Budgets::V1beta1::Budget)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/billing/budgets/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Billing::Budgets::V1beta1::GetBudgetRequest.new # Call the get_budget method. result = client.get_budget request # The returned object is of type Google::Cloud::Billing::Budgets::V1beta1::Budget. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new BudgetService client object.
- (config) — Configure the BudgetService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new do |config| config.timeout = 10.0 end
#list_budgets
def list_budgets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>
def list_budgets(parent: nil, scope: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>
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.
def list_budgets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>
list_budgets
via a request object, either of type
ListBudgetsRequest or an equivalent Hash.
- request (::Google::Cloud::Billing::Budgets::V1beta1::ListBudgetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_budgets(parent: nil, scope: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>
list_budgets
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of billing account to list budgets under. Values
are of the form
billingAccounts/{billingAccountId}
. - scope (::String) — Optional. Set the scope of the budgets to be returned, in the format of the resource name. The scope of a budget is the cost that it tracks, such as costs for a single project, or the costs for all projects in a folder. Only project scope (in the format of "projects/project-id" or "projects/123") is supported in this field. When this field is set to a project's resource name, the budgets returned are tracking the costs for that project.
- page_size (::Integer) — Optional. The maximum number of budgets to return per page. The default and maximum value are 100.
-
page_token (::String) — Optional. The value returned by the last
ListBudgetsResponse
which indicates that this is a continuation of a priorListBudgets
call, and that the system should return the next page of data.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/billing/budgets/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Billing::Budgets::V1beta1::ListBudgetsRequest.new # Call the list_budgets method. result = client.list_budgets request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Billing::Budgets::V1beta1::Budget. p item end
#update_budget
def update_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
def update_budget(budget: nil, update_mask: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
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.
def update_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
update_budget
via a request object, either of type
UpdateBudgetRequest or an equivalent Hash.
- request (::Google::Cloud::Billing::Budgets::V1beta1::UpdateBudgetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_budget(budget: nil, update_mask: nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
update_budget
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- budget (::Google::Cloud::Billing::Budgets::V1beta1::Budget, ::Hash) — Required. The updated budget object. The budget to update is specified by the budget name in the budget.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Billing::Budgets::V1beta1::Budget)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/billing/budgets/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Billing::Budgets::V1beta1::UpdateBudgetRequest.new # Call the update_budget method. result = client.update_budget request # The returned object is of type Google::Cloud::Billing::Budgets::V1beta1::Budget. p result