Skip to content

Commit deda5e1

Browse files
feat(api): api update
1 parent 425bac4 commit deda5e1

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

.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%2Forb-87e16688d40cde735bc36efd40d8c12a7918919b18268d9c40b46d0cdf2f6251.yml
3-
openapi_spec_hash: 83f1f5a6fa7a07db4af09426232d0786
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d6a851f21804170f796637f1911c3382f1c57f5ed6b9b77cd7d0c6f74c06e174.yml
3+
openapi_spec_hash: 82df33badf54d0c7087a61145d379f58
44
config_hash: 3279841440b02d4e8303c961d6983492

src/orb/resources/alerts.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
alert_create_for_subscription_params,
1919
alert_create_for_external_customer_params,
2020
)
21-
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
21+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
2222
from .._utils import maybe_transform, async_maybe_transform
2323
from .._compat import cached_property
2424
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -353,7 +353,9 @@ def create_for_subscription(
353353
*,
354354
thresholds: Iterable[ThresholdParam],
355355
type: Literal["usage_exceeded", "cost_exceeded"],
356+
grouping_keys: Optional[SequenceNotStr[str]] | Omit = omit,
356357
metric_id: Optional[str] | Omit = omit,
358+
pricing_unit_id: Optional[str] | Omit = omit,
357359
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
358360
# The extra values given here take precedence over values defined on the client or passed to this method.
359361
extra_headers: Headers | None = None,
@@ -380,8 +382,14 @@ def create_for_subscription(
380382
381383
type: The type of alert to create. This must be a valid alert type.
382384
385+
grouping_keys: The property keys to group cost alerts by. Only applicable for cost_exceeded
386+
alerts.
387+
383388
metric_id: The metric to track usage for.
384389
390+
pricing_unit_id: The pricing unit to use for grouped cost alerts. Required when grouping_keys is
391+
set.
392+
385393
extra_headers: Send extra headers
386394
387395
extra_query: Add additional query parameters to the request
@@ -400,7 +408,9 @@ def create_for_subscription(
400408
{
401409
"thresholds": thresholds,
402410
"type": type,
411+
"grouping_keys": grouping_keys,
403412
"metric_id": metric_id,
413+
"pricing_unit_id": pricing_unit_id,
404414
},
405415
alert_create_for_subscription_params.AlertCreateForSubscriptionParams,
406416
),
@@ -835,7 +845,9 @@ async def create_for_subscription(
835845
*,
836846
thresholds: Iterable[ThresholdParam],
837847
type: Literal["usage_exceeded", "cost_exceeded"],
848+
grouping_keys: Optional[SequenceNotStr[str]] | Omit = omit,
838849
metric_id: Optional[str] | Omit = omit,
850+
pricing_unit_id: Optional[str] | Omit = omit,
839851
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
840852
# The extra values given here take precedence over values defined on the client or passed to this method.
841853
extra_headers: Headers | None = None,
@@ -862,8 +874,14 @@ async def create_for_subscription(
862874
863875
type: The type of alert to create. This must be a valid alert type.
864876
877+
grouping_keys: The property keys to group cost alerts by. Only applicable for cost_exceeded
878+
alerts.
879+
865880
metric_id: The metric to track usage for.
866881
882+
pricing_unit_id: The pricing unit to use for grouped cost alerts. Required when grouping_keys is
883+
set.
884+
867885
extra_headers: Send extra headers
868886
869887
extra_query: Add additional query parameters to the request
@@ -882,7 +900,9 @@ async def create_for_subscription(
882900
{
883901
"thresholds": thresholds,
884902
"type": type,
903+
"grouping_keys": grouping_keys,
885904
"metric_id": metric_id,
905+
"pricing_unit_id": pricing_unit_id,
886906
},
887907
alert_create_for_subscription_params.AlertCreateForSubscriptionParams,
888908
),

src/orb/types/alert.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,11 @@ class Alert(BaseModel):
105105
This field is only present for credit balance alerts.
106106
"""
107107

108+
grouping_keys: Optional[List[str]] = None
109+
"""The property keys to group cost alerts by.
110+
111+
Only present for cost alerts with grouping enabled.
112+
"""
113+
108114
license_type: Optional[LicenseType] = None
109115
"""Minified license type for alert serialization."""

src/orb/types/alert_create_for_subscription_params.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Iterable, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .threshold_param import ThresholdParam
910

1011
__all__ = ["AlertCreateForSubscriptionParams"]
@@ -17,5 +18,17 @@ class AlertCreateForSubscriptionParams(TypedDict, total=False):
1718
type: Required[Literal["usage_exceeded", "cost_exceeded"]]
1819
"""The type of alert to create. This must be a valid alert type."""
1920

21+
grouping_keys: Optional[SequenceNotStr[str]]
22+
"""The property keys to group cost alerts by.
23+
24+
Only applicable for cost_exceeded alerts.
25+
"""
26+
2027
metric_id: Optional[str]
2128
"""The metric to track usage for."""
29+
30+
pricing_unit_id: Optional[str]
31+
"""The pricing unit to use for grouped cost alerts.
32+
33+
Required when grouping_keys is set.
34+
"""

tests/api_resources/test_alerts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ def test_method_create_for_subscription_with_all_params(self, client: Orb) -> No
274274
subscription_id="subscription_id",
275275
thresholds=[{"value": 0}],
276276
type="usage_exceeded",
277+
grouping_keys=["string"],
277278
metric_id="metric_id",
279+
pricing_unit_id="pricing_unit_id",
278280
)
279281
assert_matches_type(Alert, alert, path=["response"])
280282

@@ -670,7 +672,9 @@ async def test_method_create_for_subscription_with_all_params(self, async_client
670672
subscription_id="subscription_id",
671673
thresholds=[{"value": 0}],
672674
type="usage_exceeded",
675+
grouping_keys=["string"],
673676
metric_id="metric_id",
677+
pricing_unit_id="pricing_unit_id",
674678
)
675679
assert_matches_type(Alert, alert, path=["response"])
676680

0 commit comments

Comments
 (0)