Skip to content

Commit 57f4509

Browse files
feat(api): api update
1 parent 068ab47 commit 57f4509

11 files changed

Lines changed: 873 additions & 20 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

lib/orb/models/alert.rb

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,23 @@ class Alert < Orb::Internal::Type::BaseModel
8787
# @return [Orb::Models::Alert::LicenseType, nil]
8888
optional :license_type, -> { Orb::Alert::LicenseType }, nil?: true
8989

90-
# @!method initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:, balance_alert_status: nil, grouping_keys: nil, license_type: nil)
90+
# @!attribute price_filters
91+
# Filters scoping which prices are included in grouped cost alert evaluation.
92+
#
93+
# @return [Array<Orb::Models::Alert::PriceFilter>, nil]
94+
optional :price_filters, -> { Orb::Internal::Type::ArrayOf[Orb::Alert::PriceFilter] }, nil?: true
95+
96+
# @!attribute threshold_overrides
97+
# Per-group threshold overrides. Each override maps a specific combination of
98+
# grouping_keys values to a replacement threshold list. Only present for grouped
99+
# cost alerts that have at least one override.
100+
#
101+
# @return [Array<Orb::Models::Alert::ThresholdOverride>, nil]
102+
optional :threshold_overrides,
103+
-> { Orb::Internal::Type::ArrayOf[Orb::Alert::ThresholdOverride] },
104+
nil?: true
105+
106+
# @!method initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:, balance_alert_status: nil, grouping_keys: nil, license_type: nil, price_filters: nil, threshold_overrides: nil)
91107
# Some parameter documentations has been truncated, see {Orb::Models::Alert} for
92108
# more details.
93109
#
@@ -122,6 +138,10 @@ class Alert < Orb::Internal::Type::BaseModel
122138
# @param grouping_keys [Array<String>, nil] The property keys to group cost alerts by. Only present for cost alerts with gro
123139
#
124140
# @param license_type [Orb::Models::Alert::LicenseType, nil] Minified license type for alert serialization.
141+
#
142+
# @param price_filters [Array<Orb::Models::Alert::PriceFilter>, nil] Filters scoping which prices are included in grouped cost alert evaluation.
143+
#
144+
# @param threshold_overrides [Array<Orb::Models::Alert::ThresholdOverride>, nil] Per-group threshold overrides. Each override maps a specific combination of grou
125145

126146
# @see Orb::Models::Alert#metric
127147
class Metric < Orb::Internal::Type::BaseModel
@@ -226,6 +246,90 @@ class LicenseType < Orb::Internal::Type::BaseModel
226246
#
227247
# @param id [String]
228248
end
249+
250+
class PriceFilter < Orb::Internal::Type::BaseModel
251+
# @!attribute field
252+
# The property of the price to filter on.
253+
#
254+
# @return [Symbol, Orb::Models::Alert::PriceFilter::Field]
255+
required :field, enum: -> { Orb::Alert::PriceFilter::Field }
256+
257+
# @!attribute operator
258+
# Should prices that match the filter be included or excluded.
259+
#
260+
# @return [Symbol, Orb::Models::Alert::PriceFilter::Operator]
261+
required :operator, enum: -> { Orb::Alert::PriceFilter::Operator }
262+
263+
# @!attribute values
264+
# The IDs or values that match this filter.
265+
#
266+
# @return [Array<String>]
267+
required :values, Orb::Internal::Type::ArrayOf[String]
268+
269+
# @!method initialize(field:, operator:, values:)
270+
# @param field [Symbol, Orb::Models::Alert::PriceFilter::Field] The property of the price to filter on.
271+
#
272+
# @param operator [Symbol, Orb::Models::Alert::PriceFilter::Operator] Should prices that match the filter be included or excluded.
273+
#
274+
# @param values [Array<String>] The IDs or values that match this filter.
275+
276+
# The property of the price to filter on.
277+
#
278+
# @see Orb::Models::Alert::PriceFilter#field
279+
module Field
280+
extend Orb::Internal::Type::Enum
281+
282+
PRICE_ID = :price_id
283+
ITEM_ID = :item_id
284+
PRICE_TYPE = :price_type
285+
CURRENCY = :currency
286+
PRICING_UNIT_ID = :pricing_unit_id
287+
288+
# @!method self.values
289+
# @return [Array<Symbol>]
290+
end
291+
292+
# Should prices that match the filter be included or excluded.
293+
#
294+
# @see Orb::Models::Alert::PriceFilter#operator
295+
module Operator
296+
extend Orb::Internal::Type::Enum
297+
298+
INCLUDES = :includes
299+
EXCLUDES = :excludes
300+
301+
# @!method self.values
302+
# @return [Array<Symbol>]
303+
end
304+
end
305+
306+
class ThresholdOverride < Orb::Internal::Type::BaseModel
307+
# @!attribute group_values
308+
# The values of the grouping keys that identify this group. The list length
309+
# matches the alert's grouping_keys.
310+
#
311+
# @return [Array<String>]
312+
required :group_values, Orb::Internal::Type::ArrayOf[String]
313+
314+
# @!attribute thresholds
315+
# The thresholds applied to this group. An empty list means the group is silenced.
316+
#
317+
# @return [Array<Orb::Models::Threshold>]
318+
required :thresholds, -> { Orb::Internal::Type::ArrayOf[Orb::Threshold] }
319+
320+
# @!method initialize(group_values:, thresholds:)
321+
# Some parameter documentations has been truncated, see
322+
# {Orb::Models::Alert::ThresholdOverride} for more details.
323+
#
324+
# A per-group threshold override on a grouped cost alert.
325+
#
326+
# An empty `thresholds` list means the group is silenced (never fires). A
327+
# non-empty list fully replaces the default thresholds for that group.
328+
#
329+
# @param group_values [Array<String>] The values of the grouping keys that identify this group. The list length matche
330+
#
331+
# @param thresholds [Array<Orb::Models::Threshold>] The thresholds applied to this group. An empty list means the group is silenced.
332+
end
229333
end
230334
end
231335
end

lib/orb/models/alert_create_for_subscription_params.rb

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,36 @@ class AlertCreateForSubscriptionParams < Orb::Internal::Type::BaseModel
3737
# @return [String, nil]
3838
optional :metric_id, String, nil?: true
3939

40+
# @!attribute price_filters
41+
# Filters to scope which prices are included in grouped cost alert evaluation.
42+
# Supports filtering by price_id, item_id, or price_type with includes/excludes
43+
# operators. Only applicable when grouping_keys is set.
44+
#
45+
# @return [Array<Orb::Models::AlertCreateForSubscriptionParams::PriceFilter>, nil]
46+
optional :price_filters,
47+
-> { Orb::Internal::Type::ArrayOf[Orb::AlertCreateForSubscriptionParams::PriceFilter] },
48+
nil?: true
49+
4050
# @!attribute pricing_unit_id
4151
# The pricing unit to use for grouped cost alerts. Required when grouping_keys is
4252
# set.
4353
#
4454
# @return [String, nil]
4555
optional :pricing_unit_id, String, nil?: true
4656

47-
# @!method initialize(subscription_id:, thresholds:, type:, grouping_keys: nil, metric_id: nil, pricing_unit_id: nil, request_options: {})
57+
# @!attribute threshold_overrides
58+
# Per-group threshold overrides. Each override maps a specific combination of
59+
# grouping_keys values to a list of thresholds that fully replaces the default
60+
# thresholds for that group. An empty thresholds list silences the group. Groups
61+
# without an override use the default thresholds. Only applicable when
62+
# grouping_keys is set.
63+
#
64+
# @return [Array<Orb::Models::AlertCreateForSubscriptionParams::ThresholdOverride>, nil]
65+
optional :threshold_overrides,
66+
-> { Orb::Internal::Type::ArrayOf[Orb::AlertCreateForSubscriptionParams::ThresholdOverride] },
67+
nil?: true
68+
69+
# @!method initialize(subscription_id:, thresholds:, type:, grouping_keys: nil, metric_id: nil, price_filters: nil, pricing_unit_id: nil, threshold_overrides: nil, request_options: {})
4870
# Some parameter documentations has been truncated, see
4971
# {Orb::Models::AlertCreateForSubscriptionParams} for more details.
5072
#
@@ -58,8 +80,12 @@ class AlertCreateForSubscriptionParams < Orb::Internal::Type::BaseModel
5880
#
5981
# @param metric_id [String, nil] The metric to track usage for.
6082
#
83+
# @param price_filters [Array<Orb::Models::AlertCreateForSubscriptionParams::PriceFilter>, nil] Filters to scope which prices are included in grouped cost alert evaluation. Sup
84+
#
6185
# @param pricing_unit_id [String, nil] The pricing unit to use for grouped cost alerts. Required when grouping_keys is
6286
#
87+
# @param threshold_overrides [Array<Orb::Models::AlertCreateForSubscriptionParams::ThresholdOverride>, nil] Per-group threshold overrides. Each override maps a specific combination of grou
88+
#
6389
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
6490

6591
# The type of alert to create. This must be a valid alert type.
@@ -72,6 +98,93 @@ module Type
7298
# @!method self.values
7399
# @return [Array<Symbol>]
74100
end
101+
102+
class PriceFilter < Orb::Internal::Type::BaseModel
103+
# @!attribute field
104+
# The property of the price to filter on.
105+
#
106+
# @return [Symbol, Orb::Models::AlertCreateForSubscriptionParams::PriceFilter::Field]
107+
required :field, enum: -> { Orb::AlertCreateForSubscriptionParams::PriceFilter::Field }
108+
109+
# @!attribute operator
110+
# Should prices that match the filter be included or excluded.
111+
#
112+
# @return [Symbol, Orb::Models::AlertCreateForSubscriptionParams::PriceFilter::Operator]
113+
required :operator, enum: -> { Orb::AlertCreateForSubscriptionParams::PriceFilter::Operator }
114+
115+
# @!attribute values
116+
# The IDs or values that match this filter.
117+
#
118+
# @return [Array<String>]
119+
required :values, Orb::Internal::Type::ArrayOf[String]
120+
121+
# @!method initialize(field:, operator:, values:)
122+
# @param field [Symbol, Orb::Models::AlertCreateForSubscriptionParams::PriceFilter::Field] The property of the price to filter on.
123+
#
124+
# @param operator [Symbol, Orb::Models::AlertCreateForSubscriptionParams::PriceFilter::Operator] Should prices that match the filter be included or excluded.
125+
#
126+
# @param values [Array<String>] The IDs or values that match this filter.
127+
128+
# The property of the price to filter on.
129+
#
130+
# @see Orb::Models::AlertCreateForSubscriptionParams::PriceFilter#field
131+
module Field
132+
extend Orb::Internal::Type::Enum
133+
134+
PRICE_ID = :price_id
135+
ITEM_ID = :item_id
136+
PRICE_TYPE = :price_type
137+
CURRENCY = :currency
138+
PRICING_UNIT_ID = :pricing_unit_id
139+
140+
# @!method self.values
141+
# @return [Array<Symbol>]
142+
end
143+
144+
# Should prices that match the filter be included or excluded.
145+
#
146+
# @see Orb::Models::AlertCreateForSubscriptionParams::PriceFilter#operator
147+
module Operator
148+
extend Orb::Internal::Type::Enum
149+
150+
INCLUDES = :includes
151+
EXCLUDES = :excludes
152+
153+
# @!method self.values
154+
# @return [Array<Symbol>]
155+
end
156+
end
157+
158+
class ThresholdOverride < Orb::Internal::Type::BaseModel
159+
# @!attribute group_values
160+
# The values of the grouping keys that identify this group. The list length must
161+
# match the alert's grouping_keys, and values appear in the same order as
162+
# grouping_keys.
163+
#
164+
# @return [Array<String>]
165+
required :group_values, Orb::Internal::Type::ArrayOf[String]
166+
167+
# @!attribute thresholds
168+
# The thresholds to apply to this group. An empty list silences alerts for this
169+
# group. A non-empty list fully replaces the default thresholds for this group.
170+
#
171+
# @return [Array<Orb::Models::Threshold>]
172+
required :thresholds, -> { Orb::Internal::Type::ArrayOf[Orb::Threshold] }
173+
174+
# @!method initialize(group_values:, thresholds:)
175+
# Some parameter documentations has been truncated, see
176+
# {Orb::Models::AlertCreateForSubscriptionParams::ThresholdOverride} for more
177+
# details.
178+
#
179+
# Per-group threshold override on a grouped cost alert.
180+
#
181+
# - An empty `thresholds` list silences alerts for this group (never fires).
182+
# - A non-empty list fully replaces the default thresholds for this group.
183+
#
184+
# @param group_values [Array<String>] The values of the grouping keys that identify this group. The list length must m
185+
#
186+
# @param thresholds [Array<Orb::Models::Threshold>] The thresholds to apply to this group. An empty list silences alerts for this gr
187+
end
75188
end
76189
end
77190
end

lib/orb/resources/alerts.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def create_for_external_customer(external_customer_id, params)
194194
# per metric that is a part of the subscription. Alerts are triggered based on
195195
# usage or cost conditions met during the current billing cycle.
196196
#
197-
# @overload create_for_subscription(subscription_id, thresholds:, type:, grouping_keys: nil, metric_id: nil, pricing_unit_id: nil, request_options: {})
197+
# @overload create_for_subscription(subscription_id, thresholds:, type:, grouping_keys: nil, metric_id: nil, price_filters: nil, pricing_unit_id: nil, threshold_overrides: nil, request_options: {})
198198
#
199199
# @param subscription_id [String]
200200
#
@@ -206,8 +206,12 @@ def create_for_external_customer(external_customer_id, params)
206206
#
207207
# @param metric_id [String, nil] The metric to track usage for.
208208
#
209+
# @param price_filters [Array<Orb::Models::AlertCreateForSubscriptionParams::PriceFilter>, nil] Filters to scope which prices are included in grouped cost alert evaluation. Sup
210+
#
209211
# @param pricing_unit_id [String, nil] The pricing unit to use for grouped cost alerts. Required when grouping_keys is
210212
#
213+
# @param threshold_overrides [Array<Orb::Models::AlertCreateForSubscriptionParams::ThresholdOverride>, nil] Per-group threshold overrides. Each override maps a specific combination of grou
214+
#
211215
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
212216
#
213217
# @return [Orb::Models::Alert]

0 commit comments

Comments
 (0)