Billing Budgets V1beta1 API - Class Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client (v0.6.5)

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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# 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.

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

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

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

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.

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::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
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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

Overloads
def get_budget(request, options = nil) -> ::Google::Cloud::Billing::Budgets::V1beta1::Budget
Pass arguments to get_budget via a request object, either of type GetBudgetRequest or an equivalent Hash.
Parameters
  • 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
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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

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::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, 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.

Overloads
def list_budgets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::Budget>
Pass arguments to list_budgets via a request object, either of type ListBudgetsRequest or an equivalent Hash.
Parameters
  • 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, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Billing::Budgets::V1beta1::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}.
  • 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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Billing::Budgets::V1beta1::Budget.
  p response
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.

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

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