Billing Budgets V1 API - Class Google::Cloud::Billing::Budgets::V1::BudgetService::Rest::Client (v0.5.0)

Reference documentation and code samples for the Billing Budgets V1 API class Google::Cloud::Billing::Budgets::V1::BudgetService::Rest::Client.

REST 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all BudgetService clients
::Google::Cloud::Billing::Budgets::V1::BudgetService::Rest::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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_budget

def create_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
def create_budget(parent: nil, budget: nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget

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

Overloads
def create_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
Pass arguments to create_budget via a request object, either of type CreateBudgetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Billing::Budgets::V1::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::V1::Budget
Pass arguments to 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).
Parameters
  • 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::V1::Budget, ::Hash) — Required. Budget to create.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#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.

Overloads
def delete_budget(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_budget via a request object, either of type DeleteBudgetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Billing::Budgets::V1::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
Pass arguments to 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).
Parameter
  • name (::String) — Required. Name of the budget to delete. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#get_budget

def get_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
def get_budget(name: nil) -> ::Google::Cloud::Billing::Budgets::V1::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.

Overloads
def get_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
Pass arguments to get_budget via a request object, either of type GetBudgetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Billing::Budgets::V1::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::V1::Budget
Pass arguments to 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).
Parameter
  • name (::String) — Required. Name of budget to get. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#initialize

def initialize() { |config| ... } -> Client

Create a new BudgetService REST client object.

Yields
  • (config) — Configure the BudgetService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Billing::Budgets::V1::BudgetService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Billing::Budgets::V1::BudgetService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_budgets

def list_budgets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1::Budget>
def list_budgets(parent: nil, scope: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1::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.

Overloads
def list_budgets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1::Budget>
Pass arguments to list_budgets via a request object, either of type ListBudgetsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Billing::Budgets::V1::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::Rest::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1::Budget>
Pass arguments to 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).
Parameters
  • 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 prior ListBudgets call, and that the system should return the next page of data.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#update_budget

def update_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
def update_budget(budget: nil, update_mask: nil) -> ::Google::Cloud::Billing::Budgets::V1::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.

Overloads
def update_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1::Budget
Pass arguments to update_budget via a request object, either of type UpdateBudgetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Billing::Budgets::V1::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::V1::Budget
Pass arguments to 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).
Parameters
  • budget (::Google::Cloud::Billing::Budgets::V1::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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.