# Billing Budgets V1beta1 API - Class Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule (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::ThresholdRule.

ThresholdRule contains the definition of a threshold. Threshold rules define
the triggering events used to generate a budget notification email. When a
threshold is crossed (spend exceeds the specified percentages of the
budget), budget alert emails are sent to the email recipients you specify
in the
[NotificationsRule](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ThresholdRule#notificationsrule).


Threshold rules also affect the fields included in the
[JSON data
object](https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format)
sent to a Pub/Sub topic.

Threshold rules are *required* if using email notifications.

Threshold rules are *optional* if only setting a
[`pubsubTopic` NotificationsRule](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ThresholdRule#NotificationsRule),
unless you want your JSON data object to include data about the thresholds
you set.

<br />

For more information, see
[set budget threshold rules and
actions](https://cloud.google.com/billing/docs/how-to/budgets#budget-actions).

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #spend_basis

    def spend_basis() -> ::Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule::Basis

**Returns**

- ([::Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ThresholdRule-Basis)) --- Optional. The type of basis used to determine if spend has passed the threshold. Behavior defaults to CURRENT_SPEND if not set.

### #spend_basis=

    def spend_basis=(value) -> ::Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule::Basis

**Parameter**

- **value** ([::Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ThresholdRule-Basis)) --- Optional. The type of basis used to determine if spend has passed the threshold. Behavior defaults to CURRENT_SPEND if not set.
**Returns**

- ([::Google::Cloud::Billing::Budgets::V1beta1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1beta1/latest/Google-Cloud-Billing-Budgets-V1beta1-ThresholdRule-Basis)) --- Optional. The type of basis used to determine if spend has passed the threshold. Behavior defaults to CURRENT_SPEND if not set.

### #threshold_percent

    def threshold_percent() -> ::Float

**Returns**

- (::Float) --- Required. Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Validation: non-negative number.

### #threshold_percent=

    def threshold_percent=(value) -> ::Float

**Parameter**

- **value** (::Float) --- Required. Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Validation: non-negative number.
**Returns**

- (::Float) --- Required. Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Validation: non-negative number.