|
3 | 3 | import { APIResource } from '../resource'; |
4 | 4 | import { isRequestOptions } from '../core'; |
5 | 5 | import * as Core from '../core'; |
| 6 | +import * as AlertsAPI from './alerts'; |
6 | 7 | import * as Shared from './shared'; |
7 | 8 | import { Page, type PageParams } from '../pagination'; |
8 | 9 |
|
@@ -249,6 +250,18 @@ export interface Alert { |
249 | 250 | * Minified license type for alert serialization. |
250 | 251 | */ |
251 | 252 | license_type?: Alert.LicenseType | null; |
| 253 | + |
| 254 | + /** |
| 255 | + * Filters scoping which prices are included in grouped cost alert evaluation. |
| 256 | + */ |
| 257 | + price_filters?: Array<Alert.PriceFilter> | null; |
| 258 | + |
| 259 | + /** |
| 260 | + * Per-group threshold overrides. Each override maps a specific combination of |
| 261 | + * grouping_keys values to a replacement threshold list. Only present for grouped |
| 262 | + * cost alerts that have at least one override. |
| 263 | + */ |
| 264 | + threshold_overrides?: Array<Alert.ThresholdOverride> | null; |
252 | 265 | } |
253 | 266 |
|
254 | 267 | export namespace Alert { |
@@ -298,6 +311,42 @@ export namespace Alert { |
298 | 311 | export interface LicenseType { |
299 | 312 | id: string; |
300 | 313 | } |
| 314 | + |
| 315 | + export interface PriceFilter { |
| 316 | + /** |
| 317 | + * The property of the price to filter on. |
| 318 | + */ |
| 319 | + field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id'; |
| 320 | + |
| 321 | + /** |
| 322 | + * Should prices that match the filter be included or excluded. |
| 323 | + */ |
| 324 | + operator: 'includes' | 'excludes'; |
| 325 | + |
| 326 | + /** |
| 327 | + * The IDs or values that match this filter. |
| 328 | + */ |
| 329 | + values: Array<string>; |
| 330 | + } |
| 331 | + |
| 332 | + /** |
| 333 | + * A per-group threshold override on a grouped cost alert. |
| 334 | + * |
| 335 | + * An empty `thresholds` list means the group is silenced (never fires). A |
| 336 | + * non-empty list fully replaces the default thresholds for that group. |
| 337 | + */ |
| 338 | + export interface ThresholdOverride { |
| 339 | + /** |
| 340 | + * The values of the grouping keys that identify this group. The list length |
| 341 | + * matches the alert's grouping_keys. |
| 342 | + */ |
| 343 | + group_values: Array<string>; |
| 344 | + |
| 345 | + /** |
| 346 | + * The thresholds applied to this group. An empty list means the group is silenced. |
| 347 | + */ |
| 348 | + thresholds: Array<AlertsAPI.Threshold>; |
| 349 | + } |
301 | 350 | } |
302 | 351 |
|
303 | 352 | /** |
@@ -401,11 +450,67 @@ export interface AlertCreateForSubscriptionParams { |
401 | 450 | */ |
402 | 451 | metric_id?: string | null; |
403 | 452 |
|
| 453 | + /** |
| 454 | + * Filters to scope which prices are included in grouped cost alert evaluation. |
| 455 | + * Supports filtering by price_id, item_id, or price_type with includes/excludes |
| 456 | + * operators. Only applicable when grouping_keys is set. |
| 457 | + */ |
| 458 | + price_filters?: Array<AlertCreateForSubscriptionParams.PriceFilter> | null; |
| 459 | + |
404 | 460 | /** |
405 | 461 | * The pricing unit to use for grouped cost alerts. Required when grouping_keys is |
406 | 462 | * set. |
407 | 463 | */ |
408 | 464 | pricing_unit_id?: string | null; |
| 465 | + |
| 466 | + /** |
| 467 | + * Per-group threshold overrides. Each override maps a specific combination of |
| 468 | + * grouping_keys values to a list of thresholds that fully replaces the default |
| 469 | + * thresholds for that group. An empty thresholds list silences the group. Groups |
| 470 | + * without an override use the default thresholds. Only applicable when |
| 471 | + * grouping_keys is set. |
| 472 | + */ |
| 473 | + threshold_overrides?: Array<AlertCreateForSubscriptionParams.ThresholdOverride> | null; |
| 474 | +} |
| 475 | + |
| 476 | +export namespace AlertCreateForSubscriptionParams { |
| 477 | + export interface PriceFilter { |
| 478 | + /** |
| 479 | + * The property of the price to filter on. |
| 480 | + */ |
| 481 | + field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id'; |
| 482 | + |
| 483 | + /** |
| 484 | + * Should prices that match the filter be included or excluded. |
| 485 | + */ |
| 486 | + operator: 'includes' | 'excludes'; |
| 487 | + |
| 488 | + /** |
| 489 | + * The IDs or values that match this filter. |
| 490 | + */ |
| 491 | + values: Array<string>; |
| 492 | + } |
| 493 | + |
| 494 | + /** |
| 495 | + * Per-group threshold override on a grouped cost alert. |
| 496 | + * |
| 497 | + * - An empty `thresholds` list silences alerts for this group (never fires). |
| 498 | + * - A non-empty list fully replaces the default thresholds for this group. |
| 499 | + */ |
| 500 | + export interface ThresholdOverride { |
| 501 | + /** |
| 502 | + * The values of the grouping keys that identify this group. The list length must |
| 503 | + * match the alert's grouping_keys, and values appear in the same order as |
| 504 | + * grouping_keys. |
| 505 | + */ |
| 506 | + group_values: Array<string>; |
| 507 | + |
| 508 | + /** |
| 509 | + * The thresholds to apply to this group. An empty list silences alerts for this |
| 510 | + * group. A non-empty list fully replaces the default thresholds for this group. |
| 511 | + */ |
| 512 | + thresholds: Array<AlertsAPI.Threshold>; |
| 513 | + } |
409 | 514 | } |
410 | 515 |
|
411 | 516 | export interface AlertDisableParams { |
|
0 commit comments