Skip to content

Commit 1c555af

Browse files
feat: feat(silences): add a new alert silencing api
1 parent 58ffe55 commit 1c555af

File tree

14 files changed

+1282
-2
lines changed

14 files changed

+1282
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1907
1+
configured_endpoints: 1912
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc732ca8d1d7f1c11a1ee579060ddfd8f953a3ad94fd5053056b53370129d040.yml
33
openapi_spec_hash: a3e1e833dfe13845abd1e2227993a979
4-
config_hash: 9e3a3f3e68822e0dc6f40af202c6c57e
4+
config_hash: 9adcf483820db7d64c827c03d68d005f

api.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4979,6 +4979,28 @@ Methods:
49794979
- <code title="delete /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.policies.<a href="./src/cloudflare/resources/alerting/policies.py">delete</a>(policy_id, \*, account_id) -> <a href="./src/cloudflare/types/alerting/policy_delete_response.py">PolicyDeleteResponse</a></code>
49804980
- <code title="get /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.policies.<a href="./src/cloudflare/resources/alerting/policies.py">get</a>(policy_id, \*, account_id) -> <a href="./src/cloudflare/types/alerting/policy.py">Optional[Policy]</a></code>
49814981

4982+
## Silences
4983+
4984+
Types:
4985+
4986+
```python
4987+
from cloudflare.types.alerting import (
4988+
SilenceCreateResponse,
4989+
SilenceUpdateResponse,
4990+
SilenceListResponse,
4991+
SilenceDeleteResponse,
4992+
SilenceGetResponse,
4993+
)
4994+
```
4995+
4996+
Methods:
4997+
4998+
- <code title="post /accounts/{account_id}/alerting/v3/silences">client.alerting.silences.<a href="./src/cloudflare/resources/alerting/silences.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/alerting/silence_create_params.py">params</a>) -> <a href="./src/cloudflare/types/alerting/silence_create_response.py">SilenceCreateResponse</a></code>
4999+
- <code title="put /accounts/{account_id}/alerting/v3/silences">client.alerting.silences.<a href="./src/cloudflare/resources/alerting/silences.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/alerting/silence_update_params.py">params</a>) -> <a href="./src/cloudflare/types/alerting/silence_update_response.py">SyncSinglePage[SilenceUpdateResponse]</a></code>
5000+
- <code title="get /accounts/{account_id}/alerting/v3/silences">client.alerting.silences.<a href="./src/cloudflare/resources/alerting/silences.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/alerting/silence_list_response.py">SyncSinglePage[SilenceListResponse]</a></code>
5001+
- <code title="delete /accounts/{account_id}/alerting/v3/silences/{silence_id}">client.alerting.silences.<a href="./src/cloudflare/resources/alerting/silences.py">delete</a>(silence_id, \*, account_id) -> <a href="./src/cloudflare/types/alerting/silence_delete_response.py">SilenceDeleteResponse</a></code>
5002+
- <code title="get /accounts/{account_id}/alerting/v3/silences/{silence_id}">client.alerting.silences.<a href="./src/cloudflare/resources/alerting/silences.py">get</a>(silence_id, \*, account_id) -> <a href="./src/cloudflare/types/alerting/silence_get_response.py">Optional[SilenceGetResponse]</a></code>
5003+
49825004
# D1
49835005

49845006
Types:

src/cloudflare/resources/alerting/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
PoliciesResourceWithStreamingResponse,
2525
AsyncPoliciesResourceWithStreamingResponse,
2626
)
27+
from .silences import (
28+
SilencesResource,
29+
AsyncSilencesResource,
30+
SilencesResourceWithRawResponse,
31+
AsyncSilencesResourceWithRawResponse,
32+
SilencesResourceWithStreamingResponse,
33+
AsyncSilencesResourceWithStreamingResponse,
34+
)
2735
from .destinations import (
2836
DestinationsResource,
2937
AsyncDestinationsResource,
@@ -66,6 +74,12 @@
6674
"AsyncPoliciesResourceWithRawResponse",
6775
"PoliciesResourceWithStreamingResponse",
6876
"AsyncPoliciesResourceWithStreamingResponse",
77+
"SilencesResource",
78+
"AsyncSilencesResource",
79+
"SilencesResourceWithRawResponse",
80+
"AsyncSilencesResourceWithRawResponse",
81+
"SilencesResourceWithStreamingResponse",
82+
"AsyncSilencesResourceWithStreamingResponse",
6983
"AlertingResource",
7084
"AsyncAlertingResource",
7185
"AlertingResourceWithRawResponse",

src/cloudflare/resources/alerting/alerting.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
PoliciesResourceWithStreamingResponse,
1919
AsyncPoliciesResourceWithStreamingResponse,
2020
)
21+
from .silences import (
22+
SilencesResource,
23+
AsyncSilencesResource,
24+
SilencesResourceWithRawResponse,
25+
AsyncSilencesResourceWithRawResponse,
26+
SilencesResourceWithStreamingResponse,
27+
AsyncSilencesResourceWithStreamingResponse,
28+
)
2129
from ..._compat import cached_property
2230
from ..._resource import SyncAPIResource, AsyncAPIResource
2331
from .available_alerts import (
@@ -57,6 +65,10 @@ def history(self) -> HistoryResource:
5765
def policies(self) -> PoliciesResource:
5866
return PoliciesResource(self._client)
5967

68+
@cached_property
69+
def silences(self) -> SilencesResource:
70+
return SilencesResource(self._client)
71+
6072
@cached_property
6173
def with_raw_response(self) -> AlertingResourceWithRawResponse:
6274
"""
@@ -94,6 +106,10 @@ def history(self) -> AsyncHistoryResource:
94106
def policies(self) -> AsyncPoliciesResource:
95107
return AsyncPoliciesResource(self._client)
96108

109+
@cached_property
110+
def silences(self) -> AsyncSilencesResource:
111+
return AsyncSilencesResource(self._client)
112+
97113
@cached_property
98114
def with_raw_response(self) -> AsyncAlertingResourceWithRawResponse:
99115
"""
@@ -134,6 +150,10 @@ def history(self) -> HistoryResourceWithRawResponse:
134150
def policies(self) -> PoliciesResourceWithRawResponse:
135151
return PoliciesResourceWithRawResponse(self._alerting.policies)
136152

153+
@cached_property
154+
def silences(self) -> SilencesResourceWithRawResponse:
155+
return SilencesResourceWithRawResponse(self._alerting.silences)
156+
137157

138158
class AsyncAlertingResourceWithRawResponse:
139159
def __init__(self, alerting: AsyncAlertingResource) -> None:
@@ -155,6 +175,10 @@ def history(self) -> AsyncHistoryResourceWithRawResponse:
155175
def policies(self) -> AsyncPoliciesResourceWithRawResponse:
156176
return AsyncPoliciesResourceWithRawResponse(self._alerting.policies)
157177

178+
@cached_property
179+
def silences(self) -> AsyncSilencesResourceWithRawResponse:
180+
return AsyncSilencesResourceWithRawResponse(self._alerting.silences)
181+
158182

159183
class AlertingResourceWithStreamingResponse:
160184
def __init__(self, alerting: AlertingResource) -> None:
@@ -176,6 +200,10 @@ def history(self) -> HistoryResourceWithStreamingResponse:
176200
def policies(self) -> PoliciesResourceWithStreamingResponse:
177201
return PoliciesResourceWithStreamingResponse(self._alerting.policies)
178202

203+
@cached_property
204+
def silences(self) -> SilencesResourceWithStreamingResponse:
205+
return SilencesResourceWithStreamingResponse(self._alerting.silences)
206+
179207

180208
class AsyncAlertingResourceWithStreamingResponse:
181209
def __init__(self, alerting: AsyncAlertingResource) -> None:
@@ -196,3 +224,7 @@ def history(self) -> AsyncHistoryResourceWithStreamingResponse:
196224
@cached_property
197225
def policies(self) -> AsyncPoliciesResourceWithStreamingResponse:
198226
return AsyncPoliciesResourceWithStreamingResponse(self._alerting.policies)
227+
228+
@cached_property
229+
def silences(self) -> AsyncSilencesResourceWithStreamingResponse:
230+
return AsyncSilencesResourceWithStreamingResponse(self._alerting.silences)

0 commit comments

Comments
 (0)