Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent 04f7e9d commit a9f75be
Show file tree
Hide file tree
Showing 27 changed files with 836 additions and 4,335 deletions.
4 changes: 4 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2932,7 +2932,11 @@ Types:

```python
from cloudflare.types import (
BlockRule,
ExecuteRule,
LogRule,
Ruleset,
SkipRule,
RulesetCreateResponse,
RulesetUpdateResponse,
RulesetGetResponse,
Expand Down
48 changes: 24 additions & 24 deletions src/cloudflare/resources/rulesets/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -115,7 +115,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -235,7 +235,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -294,10 +294,10 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsBlockRuleActionParameters
| rule_create_params.RulesetsExecuteRuleActionParameters
action_parameters: rule_create_params.BlockRuleActionParameters
| rule_create_params.ExecuteRuleActionParameters
| object
| rule_create_params.RulesetsSkipRuleActionParameters
| rule_create_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -428,7 +428,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -489,7 +489,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -611,7 +611,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -672,10 +672,10 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters
| rule_edit_params.RulesetsExecuteRuleActionParameters
action_parameters: rule_edit_params.BlockRuleActionParameters
| rule_edit_params.ExecuteRuleActionParameters
| object
| rule_edit_params.RulesetsSkipRuleActionParameters
| rule_edit_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -752,7 +752,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -812,7 +812,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -932,7 +932,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -991,10 +991,10 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.RulesetsBlockRuleActionParameters
| rule_create_params.RulesetsExecuteRuleActionParameters
action_parameters: rule_create_params.BlockRuleActionParameters
| rule_create_params.ExecuteRuleActionParameters
| object
| rule_create_params.RulesetsSkipRuleActionParameters
| rule_create_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1125,7 +1125,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1186,7 +1186,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1308,7 +1308,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1369,10 +1369,10 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters
| rule_edit_params.RulesetsExecuteRuleActionParameters
action_parameters: rule_edit_params.BlockRuleActionParameters
| rule_edit_params.ExecuteRuleActionParameters
| object
| rule_edit_params.RulesetsSkipRuleActionParameters
| rule_edit_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
Expand Down
8 changes: 8 additions & 0 deletions src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
from .snippet import Snippet as Snippet
from .edge_ips import EdgeIPs as EdgeIPs
from .hostname import Hostname as Hostname
from .log_rule import LogRule as LogRule
from .settings import Settings as Settings
from .calls_app import CallsApp as CallsApp
from .component import Component as Component
from .dns_param import DNSParam as DNSParam
from .page_rule import PageRule as PageRule
from .rate_plan import RatePlan as RatePlan
from .skip_rule import SkipRule as SkipRule
from .block_rule import BlockRule as BlockRule
from .d1_binding import D1Binding as D1Binding
from .hyperdrive import Hyperdrive as Hyperdrive
from .membership import Membership as Membership
Expand All @@ -61,6 +64,7 @@
from .route_param import RouteParam as RouteParam
from .rules_param import RulesParam as RulesParam
from .check_region import CheckRegion as CheckRegion
from .execute_rule import ExecuteRule as ExecuteRule
from .header_param import HeaderParam as HeaderParam
from .health_check import HealthCheck as HealthCheck
from .origin_param import OriginParam as OriginParam
Expand All @@ -77,14 +81,17 @@
from .hostname_param import HostnameParam as HostnameParam
from .ip_list_params import IPListParams as IPListParams
from .labeled_region import LabeledRegion as LabeledRegion
from .log_rule_param import LogRuleParam as LogRuleParam
from .warp_connector import WARPConnector as WARPConnector
from .allowed_origins import AllowedOrigins as AllowedOrigins
from .custom_hostname import CustomHostname as CustomHostname
from .firewall_filter import FirewallFilter as FirewallFilter
from .origin_steering import OriginSteering as OriginSteering
from .random_steering import RandomSteering as RandomSteering
from .service_binding import ServiceBinding as ServiceBinding
from .skip_rule_param import SkipRuleParam as SkipRuleParam
from .adaptive_routing import AdaptiveRouting as AdaptiveRouting
from .block_rule_param import BlockRuleParam as BlockRuleParam
from .geo_restrictions import GeoRestrictions as GeoRestrictions
from .ip_list_response import IPListResponse as IPListResponse
from .mtls_certificate import MTLSCertificate as MTLSCertificate
Expand All @@ -109,6 +116,7 @@
from .client_certificate import ClientCertificate as ClientCertificate
from .custom_certificate import CustomCertificate as CustomCertificate
from .dnssec_edit_params import DNSSECEditParams as DNSSECEditParams
from .execute_rule_param import ExecuteRuleParam as ExecuteRuleParam
from .filter_list_params import FilterListParams as FilterListParams
from .health_check_param import HealthCheckParam as HealthCheckParam
from .http_configuration import HTTPConfiguration as HTTPConfiguration
Expand Down
61 changes: 61 additions & 0 deletions src/cloudflare/types/block_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

from .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from .._models import BaseModel

__all__ = ["BlockRule", "ActionParameters", "ActionParametersResponse"]


class ActionParametersResponse(BaseModel):
content: str
"""The content to return."""

content_type: str
"""The type of the content to return."""

status_code: int
"""The status code to return."""


class ActionParameters(BaseModel):
response: Optional[ActionParametersResponse] = None
"""The response to show when the block is applied."""


class BlockRule(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["block"]] = None
"""The action to perform when the rule matches."""

action_parameters: Optional[ActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
"""An object configuring the rule's logging behavior."""

ref: Optional[str] = None
"""The reference of the rule (the rule ID by default)."""
51 changes: 51 additions & 0 deletions src/cloudflare/types/block_rule_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, Required, TypedDict

from ..types import shared_params

__all__ = ["BlockRuleParam", "ActionParameters", "ActionParametersResponse"]


class ActionParametersResponse(TypedDict, total=False):
content: Required[str]
"""The content to return."""

content_type: Required[str]
"""The type of the content to return."""

status_code: Required[int]
"""The status code to return."""


class ActionParameters(TypedDict, total=False):
response: ActionParametersResponse
"""The response to show when the block is applied."""


class BlockRuleParam(TypedDict, total=False):
id: str
"""The unique ID of the rule."""

action: Literal["block"]
"""The action to perform when the rule matches."""

action_parameters: ActionParameters
"""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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
"""An object configuring the rule's logging behavior."""

ref: str
"""The reference of the rule (the rule ID by default)."""
Loading

0 comments on commit a9f75be

Please sign in to comment.