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

0.17.0 (latest) 0.16.1 0.15.0 0.14.1 0.13.0 0.12.1 0.11.2 0.10.0 0.9.0 0.8.0 0.7.0 0.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.


<br />

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

## Inherits

- Object

## Includes

- [Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the BudgetService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration "Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client#Google__Cloud__Billing__Budgets__V1beta1__BudgetService__Client_configure_class_ "Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration "Google::Cloud::Billing::Budgets::V1beta1::BudgetService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-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](https://cloud.google.com/billing/quotas)
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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-CreateBudgetRequest "Google::Cloud::Billing::Budgets::V1beta1::CreateBudgetRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Billing::Budgets::V1beta1::CreateBudgetRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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**

- **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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget), ::Hash) --- Required. Budget to create.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-DeleteBudgetRequest "Google::Cloud::Billing::Budgets::V1beta1::DeleteBudgetRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Billing::Budgets::V1beta1::DeleteBudgetRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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.


<br />

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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-GetBudgetRequest "Google::Cloud::Billing::Budgets::V1beta1::GetBudgetRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Billing::Budgets::V1beta1::GetBudgetRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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**

- **response** ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-BudgetService-Client)) --- a new instance of Client
**Example**

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


<br />

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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ListBudgetsRequest "Google::Cloud::Billing::Budgets::V1beta1::ListBudgetsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Billing::Budgets::V1beta1::ListBudgetsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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>

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**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

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


<br />

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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-UpdateBudgetRequest "Google::Cloud::Billing::Budgets::V1beta1::UpdateBudgetRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Billing::Budgets::V1beta1::UpdateBudgetRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/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**

- **response** ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Billing::Budgets::V1beta1::Budget](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-Budget))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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
```