Skip to content

Commit f7a03e2

Browse files
feat(api): api update (#2474)
1 parent 277d4ee commit f7a03e2

File tree

7 files changed

+68
-71
lines changed

7 files changed

+68
-71
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1542
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2f8a0617b1fa22b1c401d2276be0fd66dd2eee35c9005a9ea2d2deea7ee55637.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1b7e8a8d202a9d07964ed940d0213d0a0b90fbe9580df0f4586579f526c11eca.yml

src/cloudflare/resources/magic_network_monitoring/rules/rules.py

+13-24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import List, Type, Optional, cast
6+
from typing_extensions import Literal
67

78
import httpx
89

@@ -64,7 +65,7 @@ def create(
6465
self,
6566
*,
6667
account_id: str,
67-
duration: str,
68+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
6869
name: str,
6970
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
7071
bandwidth: float | NotGiven = NOT_GIVEN,
@@ -85,9 +86,7 @@ def create(
8586
Args:
8687
duration: The amount of time that the rule threshold must be exceeded to send an alert
8788
notification. The final value must be equivalent to one of the following 8
88-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
89-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
90-
least one unit must be provided.
89+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
9190
9291
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
9392
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
@@ -140,7 +139,7 @@ def update(
140139
self,
141140
*,
142141
account_id: str,
143-
duration: str,
142+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
144143
name: str,
145144
id: str | NotGiven = NOT_GIVEN,
146145
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
@@ -160,9 +159,7 @@ def update(
160159
Args:
161160
duration: The amount of time that the rule threshold must be exceeded to send an alert
162161
notification. The final value must be equivalent to one of the following 8
163-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
164-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
165-
least one unit must be provided.
162+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
166163
167164
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
168165
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
@@ -297,7 +294,7 @@ def edit(
297294
account_id: str,
298295
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
299296
bandwidth: float | NotGiven = NOT_GIVEN,
300-
duration: str | NotGiven = NOT_GIVEN,
297+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"] | NotGiven = NOT_GIVEN,
301298
name: str | NotGiven = NOT_GIVEN,
302299
packet_threshold: float | NotGiven = NOT_GIVEN,
303300
prefixes: List[str] | NotGiven = NOT_GIVEN,
@@ -323,9 +320,7 @@ def edit(
323320
324321
duration: The amount of time that the rule threshold must be exceeded to send an alert
325322
notification. The final value must be equivalent to one of the following 8
326-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
327-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
328-
least one unit must be provided.
323+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
329324
330325
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
331326
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
@@ -440,7 +435,7 @@ async def create(
440435
self,
441436
*,
442437
account_id: str,
443-
duration: str,
438+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
444439
name: str,
445440
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
446441
bandwidth: float | NotGiven = NOT_GIVEN,
@@ -461,9 +456,7 @@ async def create(
461456
Args:
462457
duration: The amount of time that the rule threshold must be exceeded to send an alert
463458
notification. The final value must be equivalent to one of the following 8
464-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
465-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
466-
least one unit must be provided.
459+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
467460
468461
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
469462
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
@@ -516,7 +509,7 @@ async def update(
516509
self,
517510
*,
518511
account_id: str,
519-
duration: str,
512+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
520513
name: str,
521514
id: str | NotGiven = NOT_GIVEN,
522515
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
@@ -536,9 +529,7 @@ async def update(
536529
Args:
537530
duration: The amount of time that the rule threshold must be exceeded to send an alert
538531
notification. The final value must be equivalent to one of the following 8
539-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
540-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
541-
least one unit must be provided.
532+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
542533
543534
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
544535
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
@@ -673,7 +664,7 @@ async def edit(
673664
account_id: str,
674665
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
675666
bandwidth: float | NotGiven = NOT_GIVEN,
676-
duration: str | NotGiven = NOT_GIVEN,
667+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"] | NotGiven = NOT_GIVEN,
677668
name: str | NotGiven = NOT_GIVEN,
678669
packet_threshold: float | NotGiven = NOT_GIVEN,
679670
prefixes: List[str] | NotGiven = NOT_GIVEN,
@@ -699,9 +690,7 @@ async def edit(
699690
700691
duration: The amount of time that the rule threshold must be exceeded to send an alert
701692
notification. The final value must be equivalent to one of the following 8
702-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
703-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
704-
least one unit must be provided.
693+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
705694
706695
name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
707696
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in

src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import List, Optional
4+
from typing_extensions import Literal
45

56
from ..._models import BaseModel
67

@@ -15,15 +16,6 @@ class MagicNetworkMonitoringRule(BaseModel):
1516
available for users of Magic Transit.
1617
"""
1718

18-
duration: str
19-
"""
20-
The amount of time that the rule threshold must be exceeded to send an alert
21-
notification. The final value must be equivalent to one of the following 8
22-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
23-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
24-
least one unit must be provided.
25-
"""
26-
2719
name: str
2820
"""The name of the rule.
2921
@@ -34,6 +26,9 @@ class MagicNetworkMonitoringRule(BaseModel):
3426

3527
prefixes: List[str]
3628

29+
type: Literal["threshold", "zscore", "advanced_ddos"]
30+
"""MNM rule type."""
31+
3732
id: Optional[str] = None
3833
"""The id of the rule. Must be unique."""
3934

@@ -44,9 +39,28 @@ class MagicNetworkMonitoringRule(BaseModel):
4439
Minimum of 1 and no maximum.
4540
"""
4641

42+
duration: Optional[Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"]] = None
43+
"""
44+
The amount of time that the rule threshold must be exceeded to send an alert
45+
notification. The final value must be equivalent to one of the following 8
46+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
47+
"""
48+
4749
packet_threshold: Optional[float] = None
4850
"""The number of packets per second for the rule.
4951
5052
When this value is exceeded for the set duration, an alert notification is sent.
5153
Minimum of 1 and no maximum.
5254
"""
55+
56+
prefix_match: Optional[Literal["exact", "subnet", "supernet"]] = None
57+
"""
58+
Prefix match type to be applied for a prefix auto advertisement when using an
59+
advanced_ddos rule.
60+
"""
61+
62+
zscore_sensitivity: Optional[Literal["low", "medium", "high"]] = None
63+
"""Level of sensitivity set for zscore rules."""
64+
65+
zscore_target: Optional[Literal["bits", "packets"]] = None
66+
"""Target of the zscore rule analysis."""

src/cloudflare/types/magic_network_monitoring/rule_create_params.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
from __future__ import annotations
44

55
from typing import List, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = ["RuleCreateParams"]
99

1010

1111
class RuleCreateParams(TypedDict, total=False):
1212
account_id: Required[str]
1313

14-
duration: Required[str]
14+
duration: Required[Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"]]
1515
"""
1616
The amount of time that the rule threshold must be exceeded to send an alert
1717
notification. The final value must be equivalent to one of the following 8
18-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
19-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
20-
least one unit must be provided.
18+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
2119
"""
2220

2321
name: Required[str]

src/cloudflare/types/magic_network_monitoring/rule_edit_params.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import List, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = ["RuleEditParams"]
99

@@ -25,13 +25,11 @@ class RuleEditParams(TypedDict, total=False):
2525
Minimum of 1 and no maximum.
2626
"""
2727

28-
duration: str
28+
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"]
2929
"""
3030
The amount of time that the rule threshold must be exceeded to send an alert
3131
notification. The final value must be equivalent to one of the following 8
32-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
33-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
34-
least one unit must be provided.
32+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
3533
"""
3634

3735
name: str

src/cloudflare/types/magic_network_monitoring/rule_update_params.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
from __future__ import annotations
44

55
from typing import List, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = ["RuleUpdateParams"]
99

1010

1111
class RuleUpdateParams(TypedDict, total=False):
1212
account_id: Required[str]
1313

14-
duration: Required[str]
14+
duration: Required[Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"]]
1515
"""
1616
The amount of time that the rule threshold must be exceeded to send an alert
1717
notification. The final value must be equivalent to one of the following 8
18-
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
19-
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
20-
least one unit must be provided.
18+
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
2119
"""
2220

2321
name: Required[str]

0 commit comments

Comments
 (0)