# Cloud Billing Budget v1beta1 API - Class ThresholdRule (2.0.0-beta07)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.0.0-beta07 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule)
- [2.0.0-beta06](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/2.0.0-beta06/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule)
- [1.0.0-beta05](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/1.0.0-beta05/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule)

    public sealed class ThresholdRule : IMessage<ThresholdRule>, IEquatable<ThresholdRule>, IDeepCloneable<ThresholdRule>, IBufferMessage, IMessage

Reference documentation and code samples for the Cloud Billing Budget v1beta1 API class 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/dotnet/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/dotnet/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.

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

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ThresholdRule

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ThresholdRule](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ThresholdRule](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ThresholdRule](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Billing.Budgets.V1Beta1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1)

## Assembly

Google.Cloud.Billing.Budgets.V1Beta1.dll

## Constructors

### ThresholdRule()

    public ThresholdRule()

### ThresholdRule(ThresholdRule)

    public ThresholdRule(ThresholdRule other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule` |

## Properties

### SpendBasis

    public ThresholdRule.Types.Basis SpendBasis { get; set; }

Optional. The type of basis used to determine if spend has passed the
threshold. Behavior defaults to CURRENT_SPEND if not set.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRulehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1Beta1/latest/Google.Cloud.Billing.Budgets.V1Beta1.ThresholdRule.Types.Basis` |   |

### ThresholdPercent

    public double ThresholdPercent { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.double` |   |