public sealed class ThresholdRule : IMessage<ThresholdRule>, IEquatable<ThresholdRule>, IDeepCloneable<ThresholdRule>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Billing Budget v1 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.
Threshold rules also affect the fields included in the
JSON data
object
sent to a Pub/Sub topic.
Threshold rules are required if using email notifications.
Threshold rules are optional if only setting a
pubsubTopic NotificationsRule,
unless you want your JSON data object to include data about the thresholds
you set.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eThresholdRule\u003c/code\u003e API class is 2.6.0, with older versions available for reference, ranging back to version 1.1.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eThresholdRule\u003c/code\u003e defines the conditions that trigger budget notification emails when spending exceeds certain percentages of the budget, and these rules are required when email notifications are used.\u003c/p\u003e\n"],["\u003cp\u003eThreshold rules also determine which fields are included in the JSON data object sent to a Pub/Sub topic.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eThresholdRule\u003c/code\u003e class has properties such as \u003ccode\u003eSpendBasis\u003c/code\u003e, which defines how spend is calculated, and \u003ccode\u003eThresholdPercent\u003c/code\u003e, which sets the percentage at which an alert is triggered.\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003eThresholdRule\u003c/code\u003e inherits from Object, and implements IMessage, IEquatable, IDeepCloneable, and IBufferMessage.\u003c/p\u003e\n"]]],[],null,["# Cloud Billing Budget v1 API - Class ThresholdRule (2.6.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.6.0 (latest)](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/latest/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.5.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.4.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.3.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.2.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.1.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/2.0.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/1.2.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/1.1.0/Google.Cloud.Billing.Budgets.V1.ThresholdRule) \n\n public sealed class ThresholdRule : IMessage\u003cThresholdRule\u003e, IEquatable\u003cThresholdRule\u003e, IDeepCloneable\u003cThresholdRule\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Billing Budget v1 API class ThresholdRule.\n\nThresholdRule contains the definition of a threshold. Threshold rules define\nthe triggering events used to generate a budget notification email. When a\nthreshold is crossed (spend exceeds the specified percentages of the\nbudget), budget alert emails are sent to the email recipients you specify\nin the\n[NotificationsRule](#notificationsrule).\n\nThreshold rules also affect the fields included in the\n[JSON data\nobject](https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format)\nsent to a Pub/Sub topic.\n\nThreshold rules are *required* if using email notifications.\n\nThreshold rules are *optional* if only setting a\n[`pubsubTopic` NotificationsRule](#NotificationsRule),\nunless you want your JSON data object to include data about the thresholds\nyou set.\n\nFor more information, see\n[set budget threshold rules and\nactions](https://cloud.google.com/billing/docs/how-to/budgets#budget-actions). \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ThresholdRule \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ThresholdRule](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/latest/Google.Cloud.Billing.Budgets.V1.ThresholdRule), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ThresholdRule](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/latest/Google.Cloud.Billing.Budgets.V1.ThresholdRule), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ThresholdRule](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/latest/Google.Cloud.Billing.Budgets.V1.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) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Billing.Budgets.V1](/dotnet/docs/reference/Google.Cloud.Billing.Budgets.V1/latest/Google.Cloud.Billing.Budgets.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Billing.Budgets.V1.dll\n\nConstructors\n------------\n\n### ThresholdRule()\n\n public ThresholdRule()\n\n### ThresholdRule(ThresholdRule)\n\n public ThresholdRule(ThresholdRule other)\n\nProperties\n----------\n\n### SpendBasis\n\n public ThresholdRule.Types.Basis SpendBasis { get; set; }\n\nOptional. The type of basis used to determine if spend has passed the\nthreshold. Behavior defaults to CURRENT_SPEND if not set.\n\n### ThresholdPercent\n\n public double ThresholdPercent { get; set; }\n\nRequired. Send an alert when this threshold is exceeded.\nThis is a 1.0-based percentage, so 0.5 = 50%.\nValidation: non-negative number."]]