Skip to content

feat(api): api update #2474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1542
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2f8a0617b1fa22b1c401d2276be0fd66dd2eee35c9005a9ea2d2deea7ee55637.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1b7e8a8d202a9d07964ed940d0213d0a0b90fbe9580df0f4586579f526c11eca.yml
37 changes: 13 additions & 24 deletions src/cloudflare/resources/magic_network_monitoring/rules/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from typing import List, Type, Optional, cast
from typing_extensions import Literal

import httpx

Expand Down Expand Up @@ -64,7 +65,7 @@ def create(
self,
*,
account_id: str,
duration: str,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
name: str,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
bandwidth: float | NotGiven = NOT_GIVEN,
Expand All @@ -85,9 +86,7 @@ def create(
Args:
duration: The amount of time that the rule threshold must be exceeded to send an alert
notification. The final value must be equivalent to one of the following 8
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
least one unit must be provided.
values ["1m","5m","10m","15m","20m","30m","45m","60m"].

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down Expand Up @@ -140,7 +139,7 @@ def update(
self,
*,
account_id: str,
duration: str,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
name: str,
id: str | NotGiven = NOT_GIVEN,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
Expand All @@ -160,9 +159,7 @@ def update(
Args:
duration: The amount of time that the rule threshold must be exceeded to send an alert
notification. The final value must be equivalent to one of the following 8
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
least one unit must be provided.
values ["1m","5m","10m","15m","20m","30m","45m","60m"].

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down Expand Up @@ -297,7 +294,7 @@ def edit(
account_id: str,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
bandwidth: float | NotGiven = NOT_GIVEN,
duration: str | NotGiven = NOT_GIVEN,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"] | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
packet_threshold: float | NotGiven = NOT_GIVEN,
prefixes: List[str] | NotGiven = NOT_GIVEN,
Expand All @@ -323,9 +320,7 @@ def edit(

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

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down Expand Up @@ -440,7 +435,7 @@ async def create(
self,
*,
account_id: str,
duration: str,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
name: str,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
bandwidth: float | NotGiven = NOT_GIVEN,
Expand All @@ -461,9 +456,7 @@ async def create(
Args:
duration: The amount of time that the rule threshold must be exceeded to send an alert
notification. The final value must be equivalent to one of the following 8
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
least one unit must be provided.
values ["1m","5m","10m","15m","20m","30m","45m","60m"].

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down Expand Up @@ -516,7 +509,7 @@ async def update(
self,
*,
account_id: str,
duration: str,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"],
name: str,
id: str | NotGiven = NOT_GIVEN,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
Expand All @@ -536,9 +529,7 @@ async def update(
Args:
duration: The amount of time that the rule threshold must be exceeded to send an alert
notification. The final value must be equivalent to one of the following 8
values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format is
AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at
least one unit must be provided.
values ["1m","5m","10m","15m","20m","30m","45m","60m"].

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down Expand Up @@ -673,7 +664,7 @@ async def edit(
account_id: str,
automatic_advertisement: Optional[bool] | NotGiven = NOT_GIVEN,
bandwidth: float | NotGiven = NOT_GIVEN,
duration: str | NotGiven = NOT_GIVEN,
duration: Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"] | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
packet_threshold: float | NotGiven = NOT_GIVEN,
prefixes: List[str] | NotGiven = NOT_GIVEN,
Expand All @@ -699,9 +690,7 @@ async def edit(

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

name: The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9,
underscore (\\__), dash (-), period (.), and tilde (~). You can’t have a space in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

from ..._models import BaseModel

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

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

name: str
"""The name of the rule.

Expand All @@ -34,6 +26,9 @@ class MagicNetworkMonitoringRule(BaseModel):

prefixes: List[str]

type: Literal["threshold", "zscore", "advanced_ddos"]
"""MNM rule type."""

id: Optional[str] = None
"""The id of the rule. Must be unique."""

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

duration: Optional[Literal["1m", "5m", "10m", "15m", "20m", "30m", "45m", "60m"]] = None
"""
The amount of time that the rule threshold must be exceeded to send an alert
notification. The final value must be equivalent to one of the following 8
values ["1m","5m","10m","15m","20m","30m","45m","60m"].
"""

packet_threshold: Optional[float] = None
"""The number of packets per second for the rule.

When this value is exceeded for the set duration, an alert notification is sent.
Minimum of 1 and no maximum.
"""

prefix_match: Optional[Literal["exact", "subnet", "supernet"]] = None
"""
Prefix match type to be applied for a prefix auto advertisement when using an
advanced_ddos rule.
"""

zscore_sensitivity: Optional[Literal["low", "medium", "high"]] = None
"""Level of sensitivity set for zscore rules."""

zscore_target: Optional[Literal["bits", "packets"]] = None
"""Target of the zscore rule analysis."""
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
from __future__ import annotations

from typing import List, Optional
from typing_extensions import Required, TypedDict
from typing_extensions import Literal, Required, TypedDict

__all__ = ["RuleCreateParams"]


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

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

name: Required[str]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from typing import List, Optional
from typing_extensions import Required, TypedDict
from typing_extensions import Literal, Required, TypedDict

__all__ = ["RuleEditParams"]

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

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

name: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
from __future__ import annotations

from typing import List, Optional
from typing_extensions import Required, TypedDict
from typing_extensions import Literal, Required, TypedDict

__all__ = ["RuleUpdateParams"]


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

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

name: Required[str]
Expand Down
Loading