|
11 | 11 | from .. import _legacy_response
|
12 | 12 | from ..types import (
|
13 | 13 | alert_list_params,
|
| 14 | + alert_update_params, |
14 | 15 | alert_create_for_customer_params,
|
15 | 16 | alert_create_for_subscription_params,
|
16 | 17 | alert_create_for_external_customer_params,
|
@@ -72,6 +73,52 @@ def retrieve(
|
72 | 73 | cast_to=Alert,
|
73 | 74 | )
|
74 | 75 |
|
| 76 | + def update( |
| 77 | + self, |
| 78 | + alert_configuration_id: str, |
| 79 | + *, |
| 80 | + thresholds: Iterable[alert_update_params.Threshold], |
| 81 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 82 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 83 | + extra_headers: Headers | None = None, |
| 84 | + extra_query: Query | None = None, |
| 85 | + extra_body: Body | None = None, |
| 86 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 87 | + idempotency_key: str | None = None, |
| 88 | + ) -> Alert: |
| 89 | + """ |
| 90 | + This endpoint updates the thresholds of an alert. |
| 91 | +
|
| 92 | + Args: |
| 93 | + thresholds: The thresholds that define the values at which the alert will be triggered. |
| 94 | +
|
| 95 | + extra_headers: Send extra headers |
| 96 | +
|
| 97 | + extra_query: Add additional query parameters to the request |
| 98 | +
|
| 99 | + extra_body: Add additional JSON properties to the request |
| 100 | +
|
| 101 | + timeout: Override the client-level default timeout for this request, in seconds |
| 102 | +
|
| 103 | + idempotency_key: Specify a custom idempotency key for this request |
| 104 | + """ |
| 105 | + if not alert_configuration_id: |
| 106 | + raise ValueError( |
| 107 | + f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
| 108 | + ) |
| 109 | + return self._put( |
| 110 | + f"/alerts/{alert_configuration_id}", |
| 111 | + body=maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams), |
| 112 | + options=make_request_options( |
| 113 | + extra_headers=extra_headers, |
| 114 | + extra_query=extra_query, |
| 115 | + extra_body=extra_body, |
| 116 | + timeout=timeout, |
| 117 | + idempotency_key=idempotency_key, |
| 118 | + ), |
| 119 | + cast_to=Alert, |
| 120 | + ) |
| 121 | + |
75 | 122 | def list(
|
76 | 123 | self,
|
77 | 124 | *,
|
@@ -496,6 +543,52 @@ async def retrieve(
|
496 | 543 | cast_to=Alert,
|
497 | 544 | )
|
498 | 545 |
|
| 546 | + async def update( |
| 547 | + self, |
| 548 | + alert_configuration_id: str, |
| 549 | + *, |
| 550 | + thresholds: Iterable[alert_update_params.Threshold], |
| 551 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 552 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 553 | + extra_headers: Headers | None = None, |
| 554 | + extra_query: Query | None = None, |
| 555 | + extra_body: Body | None = None, |
| 556 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 557 | + idempotency_key: str | None = None, |
| 558 | + ) -> Alert: |
| 559 | + """ |
| 560 | + This endpoint updates the thresholds of an alert. |
| 561 | +
|
| 562 | + Args: |
| 563 | + thresholds: The thresholds that define the values at which the alert will be triggered. |
| 564 | +
|
| 565 | + extra_headers: Send extra headers |
| 566 | +
|
| 567 | + extra_query: Add additional query parameters to the request |
| 568 | +
|
| 569 | + extra_body: Add additional JSON properties to the request |
| 570 | +
|
| 571 | + timeout: Override the client-level default timeout for this request, in seconds |
| 572 | +
|
| 573 | + idempotency_key: Specify a custom idempotency key for this request |
| 574 | + """ |
| 575 | + if not alert_configuration_id: |
| 576 | + raise ValueError( |
| 577 | + f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
| 578 | + ) |
| 579 | + return await self._put( |
| 580 | + f"/alerts/{alert_configuration_id}", |
| 581 | + body=await async_maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams), |
| 582 | + options=make_request_options( |
| 583 | + extra_headers=extra_headers, |
| 584 | + extra_query=extra_query, |
| 585 | + extra_body=extra_body, |
| 586 | + timeout=timeout, |
| 587 | + idempotency_key=idempotency_key, |
| 588 | + ), |
| 589 | + cast_to=Alert, |
| 590 | + ) |
| 591 | + |
499 | 592 | def list(
|
500 | 593 | self,
|
501 | 594 | *,
|
@@ -885,6 +978,9 @@ def __init__(self, alerts: Alerts) -> None:
|
885 | 978 | self.retrieve = _legacy_response.to_raw_response_wrapper(
|
886 | 979 | alerts.retrieve,
|
887 | 980 | )
|
| 981 | + self.update = _legacy_response.to_raw_response_wrapper( |
| 982 | + alerts.update, |
| 983 | + ) |
888 | 984 | self.list = _legacy_response.to_raw_response_wrapper(
|
889 | 985 | alerts.list,
|
890 | 986 | )
|
@@ -912,6 +1008,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
|
912 | 1008 | self.retrieve = _legacy_response.async_to_raw_response_wrapper(
|
913 | 1009 | alerts.retrieve,
|
914 | 1010 | )
|
| 1011 | + self.update = _legacy_response.async_to_raw_response_wrapper( |
| 1012 | + alerts.update, |
| 1013 | + ) |
915 | 1014 | self.list = _legacy_response.async_to_raw_response_wrapper(
|
916 | 1015 | alerts.list,
|
917 | 1016 | )
|
@@ -939,6 +1038,9 @@ def __init__(self, alerts: Alerts) -> None:
|
939 | 1038 | self.retrieve = to_streamed_response_wrapper(
|
940 | 1039 | alerts.retrieve,
|
941 | 1040 | )
|
| 1041 | + self.update = to_streamed_response_wrapper( |
| 1042 | + alerts.update, |
| 1043 | + ) |
942 | 1044 | self.list = to_streamed_response_wrapper(
|
943 | 1045 | alerts.list,
|
944 | 1046 | )
|
@@ -966,6 +1068,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
|
966 | 1068 | self.retrieve = async_to_streamed_response_wrapper(
|
967 | 1069 | alerts.retrieve,
|
968 | 1070 | )
|
| 1071 | + self.update = async_to_streamed_response_wrapper( |
| 1072 | + alerts.update, |
| 1073 | + ) |
969 | 1074 | self.list = async_to_streamed_response_wrapper(
|
970 | 1075 | alerts.list,
|
971 | 1076 | )
|
|
0 commit comments