# Billing Budgets V1 API - Class Google::Cloud::Billing::Budgets::V1::ThresholdRule (v1.5.0)

1.5.0 (latest) 1.4.1 1.3.0 1.2.1 1.1.0 1.0.1 0.8.0 0.7.2 0.6.0 0.5.0 0.4.0 0.3.0 0.2.0 0.1.2 Reference documentation and code samples for the Billing Budgets V1 API class Google::Cloud::Billing::Budgets::V1::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-v1/latest/Google-Cloud-Billing-Budgets-V1-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-v1/latest/Google-Cloud-Billing-Budgets-V1-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::V1::ThresholdRule::Basis

**Returns**

- ([::Google::Cloud::Billing::Budgets::V1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1/latest/Google-Cloud-Billing-Budgets-V1-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::V1::ThresholdRule::Basis

**Parameter**

- **value** ([::Google::Cloud::Billing::Budgets::V1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1/latest/Google-Cloud-Billing-Budgets-V1-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::V1::ThresholdRule::Basis](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-billing-budgets-v1/latest/Google-Cloud-Billing-Budgets-V1-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.