Skip to content

Commit dc30faf

Browse files
feat(api): api update
1 parent e08110b commit dc30faf

3 files changed

Lines changed: 115 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 139
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb/orb-b13a08bfebe7b2efc4a5f8aa0b69015e2d58435a581b1578e3e67d76fdfb8cb0.yml
3-
openapi_spec_hash: bba0e6257d3d2f8612c5ad14b95839e2
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb/orb-7f97a69f22372b818e8d24a72f6020bcf2f0c6d6b3ad07abb8395c87ec4a72ee.yml
3+
openapi_spec_hash: a6261e730c54d08ad36f1b946e663fc3
44
config_hash: c01c1191b1cd696c7ca855ff6d28a8df

src/resources/alerts.ts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { APIResource } from '../resource';
44
import { isRequestOptions } from '../core';
55
import * as Core from '../core';
6+
import * as AlertsAPI from './alerts';
67
import * as Shared from './shared';
78
import { Page, type PageParams } from '../pagination';
89

@@ -249,6 +250,18 @@ export interface Alert {
249250
* Minified license type for alert serialization.
250251
*/
251252
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;
252265
}
253266

254267
export namespace Alert {
@@ -298,6 +311,42 @@ export namespace Alert {
298311
export interface LicenseType {
299312
id: string;
300313
}
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+
}
301350
}
302351

303352
/**
@@ -401,11 +450,67 @@ export interface AlertCreateForSubscriptionParams {
401450
*/
402451
metric_id?: string | null;
403452

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+
404460
/**
405461
* The pricing unit to use for grouped cost alerts. Required when grouping_keys is
406462
* set.
407463
*/
408464
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+
}
409514
}
410515

411516
export interface AlertDisableParams {

tests/api-resources/alerts.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,15 @@ describe('resource alerts', () => {
145145
type: 'usage_exceeded',
146146
grouping_keys: ['string'],
147147
metric_id: 'metric_id',
148+
price_filters: [
149+
{
150+
field: 'price_id',
151+
operator: 'includes',
152+
values: ['string'],
153+
},
154+
],
148155
pricing_unit_id: 'pricing_unit_id',
156+
threshold_overrides: [{ group_values: ['string'], thresholds: [{ value: 0 }] }],
149157
});
150158
});
151159

0 commit comments

Comments
 (0)