diff --git a/.stats.yml b/.stats.yml index 79bbbc19c23..a0ecfde3be8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1321 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c7d13bc2b1e78dbaff4150bd44de8a77629619b38db7beb3ab2b0eccab2b0948.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e41a368def1043afe2da6c1a8caa6010941e5880eb2f70a62babdaaf9e03c251.yml diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py index bd7c415a47b..ecf569b9efa 100644 --- a/src/cloudflare/resources/rulesets/rules.py +++ b/src/cloudflare/resources/rulesets/rules.py @@ -1003,6 +1003,126 @@ def create( """ ... + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + def create( self, ruleset_id: str, @@ -1026,6 +1146,8 @@ def create( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -2130,6 +2252,128 @@ def edit( """ ... + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args(["ruleset_id"]) def edit( self, @@ -2155,6 +2399,8 @@ def edit( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_edit_params.BlockRuleActionParameters | object @@ -3193,6 +3439,126 @@ async def create( """ ... + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + ruleset_id: str, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleCreateResponse: + """Adds a new rule to an account or zone ruleset. + + The rule will be added to the end + of the existing list of rules in the ruleset by default. + + Args: + ruleset_id: The unique ID of the ruleset. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + async def create( self, ruleset_id: str, @@ -3216,6 +3582,8 @@ async def create( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -4320,6 +4688,128 @@ async def edit( """ ... + @overload + async def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def edit( + self, + rule_id: str, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expression: str | NotGiven = NOT_GIVEN, + logging: LoggingParam | NotGiven = NOT_GIVEN, + ref: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RuleEditResponse: + """ + Updates an existing rule in an account or zone ruleset. + + Args: + ruleset_id: The unique ID of the ruleset. + + rule_id: The unique ID of the rule. + + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + id: The unique ID of the rule. + + action: The action to perform when the rule matches. + + action_parameters: The parameters configuring the rule's action. + + description: An informative description of the rule. + + enabled: Whether the rule should be executed. + + expression: The expression defining which traffic will match the rule. + + logging: An object configuring the rule's logging behavior. + + ref: The reference of the rule (the rule ID by default). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args(["ruleset_id"]) async def edit( self, @@ -4345,6 +4835,8 @@ async def edit( | Literal["skip"] | Literal["set_cache_settings"] | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_edit_params.BlockRuleActionParameters | object diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py index 476a9254497..d88c9679596 100644 --- a/src/cloudflare/types/rulesets/phase_get_response.py +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index d1e457901af..27f4398d8c9 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -32,6 +32,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -110,6 +112,58 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py index a92b28cb216..3e00524ec11 100644 --- a/src/cloudflare/types/rulesets/phase_update_response.py +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py index bf04a129360..3c7d7b05653 100644 --- a/src/cloudflare/types/rulesets/phases/version_get_response.py +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py index e08bad9f0e5..f027d1e1dc5 100644 --- a/src/cloudflare/types/rulesets/rule_create_params.py +++ b/src/cloudflare/types/rulesets/rule_create_params.py @@ -76,6 +76,8 @@ "RulesetsLogCustomFieldRuleActionParametersCookieField", "RulesetsLogCustomFieldRuleActionParametersRequestField", "RulesetsLogCustomFieldRuleActionParametersResponseField", + "RulesetsDDoSDynamicRule", + "RulesetsForceConnectionCloseRule", ] @@ -1205,6 +1207,70 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): """The response fields to log.""" +class RulesetsDDoSDynamicRule(TypedDict, total=False): + account_id: str + """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + + zone_id: str + """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RulesetsForceConnectionCloseRule(TypedDict, total=False): + account_id: str + """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + + zone_id: str + """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + RuleCreateParams = Union[ BlockRule, ChallengeRule, @@ -1222,4 +1288,6 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): SkipRule, SetCacheSettingsRule, RulesetsLogCustomFieldRule, + RulesetsDDoSDynamicRule, + RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py index 9a729d3fbe1..04e3457f902 100644 --- a/src/cloudflare/types/rulesets/rule_create_response.py +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py index 1b6810d585e..25d801cd5aa 100644 --- a/src/cloudflare/types/rulesets/rule_delete_response.py +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py index 86c8418e7c8..8382c7d8687 100644 --- a/src/cloudflare/types/rulesets/rule_edit_params.py +++ b/src/cloudflare/types/rulesets/rule_edit_params.py @@ -76,6 +76,8 @@ "RulesetsLogCustomFieldRuleActionParametersCookieField", "RulesetsLogCustomFieldRuleActionParametersRequestField", "RulesetsLogCustomFieldRuleActionParametersResponseField", + "RulesetsDDoSDynamicRule", + "RulesetsForceConnectionCloseRule", ] @@ -1253,6 +1255,76 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): """The response fields to log.""" +class RulesetsDDoSDynamicRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + account_id: str + """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + + zone_id: str + """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RulesetsForceConnectionCloseRule(TypedDict, total=False): + ruleset_id: Required[str] + """The unique ID of the ruleset.""" + + account_id: str + """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + + zone_id: str + """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + RuleEditParams = Union[ BlockRule, ChallengeRule, @@ -1270,4 +1342,6 @@ class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): SkipRule, SetCacheSettingsRule, RulesetsLogCustomFieldRule, + RulesetsDDoSDynamicRule, + RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py index 3bf0100ef6f..47dd4534324 100644 --- a/src/cloudflare/types/rulesets/rule_edit_response.py +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_params.py b/src/cloudflare/types/rulesets/ruleset_create_params.py index 6d34a46fac5..4e372271bef 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_params.py +++ b/src/cloudflare/types/rulesets/ruleset_create_params.py @@ -32,6 +32,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -110,6 +112,58 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_response.py b/src/cloudflare/types/rulesets/ruleset_create_response.py index f87b58ceec8..bfeacd5afd4 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_response.py +++ b/src/cloudflare/types/rulesets/ruleset_create_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_get_response.py b/src/cloudflare/types/rulesets/ruleset_get_response.py index d5864df9b91..328ba42b25a 100644 --- a/src/cloudflare/types/rulesets/ruleset_get_response.py +++ b/src/cloudflare/types/rulesets/ruleset_get_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_update_params.py b/src/cloudflare/types/rulesets/ruleset_update_params.py index ce723859ed9..e2ff9a9fcb8 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_params.py +++ b/src/cloudflare/types/rulesets/ruleset_update_params.py @@ -32,6 +32,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -110,6 +112,58 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """The action to perform when the rule matches.""" + + action_parameters: object + """The parameters configuring the rule's action.""" + + description: str + """An informative description of the rule.""" + + enabled: bool + """Whether the rule should be executed.""" + + expression: str + """The expression defining which traffic will match the rule.""" + + logging: LoggingParam + """An object configuring the rule's logging behavior.""" + + ref: str + """The reference of the rule (the rule ID by default).""" + + Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -127,4 +181,6 @@ class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): SkipRuleParam, SetCacheSettingsRuleParam, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_update_response.py b/src/cloudflare/types/rulesets/ruleset_update_response.py index d2aaaa91d6f..9fb84d0d26a 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_response.py +++ b/src/cloudflare/types/rulesets/ruleset_update_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py index 4d61f17e3ec..abb1cfae6c7 100644 --- a/src/cloudflare/types/rulesets/version_get_response.py +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py index 62def70b1fd..058c549bc29 100644 --- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -33,6 +33,8 @@ "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", ] @@ -97,6 +99,76 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): """The reference of the rule (the rule ID by default).""" +class RuleRulesetsDDoSDynamicRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["ddos_dynamic"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + +class RuleRulesetsForceConnectionCloseRule(BaseModel): + last_updated: datetime + """The timestamp of when the rule was last modified.""" + + version: str + """The version of the rule.""" + + id: Optional[str] = None + """The unique ID of the rule.""" + + action: Optional[Literal["force_connection_close"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[object] = None + """The parameters configuring the rule's action.""" + + categories: Optional[List[str]] = None + """The categories of the rule.""" + + description: Optional[str] = None + """An informative description of the rule.""" + + enabled: Optional[bool] = None + """Whether the rule should be executed.""" + + expression: Optional[str] = None + """The expression defining which traffic will match the rule.""" + + logging: Optional[Logging] = None + """An object configuring the rule's logging behavior.""" + + ref: Optional[str] = None + """The reference of the rule (the rule ID by default).""" + + Rule = Annotated[ Union[ BlockRule, @@ -115,6 +187,8 @@ class RuleRulesetsLogCustomFieldRule(BaseModel): SkipRule, SetCacheSettingsRule, RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ], PropertyInfo(discriminator="action"), ] diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py index 1496d433303..b457e152f24 100644 --- a/tests/api_resources/rulesets/test_rules.py +++ b/tests/api_resources/rulesets/test_rules.py @@ -1394,6 +1394,156 @@ def test_path_params_create_overload_16(self, client: Cloudflare) -> None: account_id="string", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create_overload_17(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create_overload_17(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create_overload_17(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create_overload_18(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create_overload_18(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create_overload_18(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_delete(self, client: Cloudflare) -> None: @@ -3072,6 +3222,184 @@ def test_path_params_edit_overload_16(self, client: Cloudflare) -> None: account_id="string", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_with_all_params_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_edit_overload_17(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_edit_overload_17(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_edit_overload_17(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_with_all_params_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_edit_overload_18(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_edit_overload_18(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_edit_overload_18(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + class TestAsyncRules: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -4313,7 +4641,86 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy "respect_strong_etags": True, "serve_stale": {"disable_stale_while_updating": True}, }, - description="Set cache settings when the hostname address is not example.com", + description="Set cache settings when the hostname address is not example.com", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log_custom_field", + action_parameters={ + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + }, + description="Log custom field when the IP address is not 1.1.1.1", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, @@ -4323,7 +4730,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4336,7 +4743,7 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4351,7 +4758,7 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_create_overload_16(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.create( "", @@ -4372,7 +4779,7 @@ async def test_path_params_create_overload_15(self, async_client: AsyncCloudflar @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4381,18 +4788,14 @@ async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: rule = await async_client.rulesets.rules.create( "2f2feab2026849078ba485f918791bdc", account_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="log_custom_field", - action_parameters={ - "cookie_fields": [{"name": "cookie_name_1"}], - "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], - "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], - }, - description="Log custom field when the IP address is not 1.1.1.1", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", enabled=True, expression="ip.src ne 1.1.1.1", logging={"enabled": True}, @@ -4402,7 +4805,7 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4415,7 +4818,7 @@ async def test_raw_response_create_overload_16(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4430,7 +4833,82 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_create_overload_17(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_create_overload_18(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): await async_client.rulesets.rules.with_raw_response.create( "", @@ -6126,3 +6604,181 @@ async def test_path_params_edit_overload_16(self, async_client: AsyncCloudflare) ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + enabled=True, + expression="ip.src ne 1.1.1.1", + logging={"enabled": True}, + ref="my_ref", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + )