8000 feat(api): api update by stainless-app[bot] · Pull Request #2205 · cloudflare/cloudflare-python · GitHub
[go: up one dir, main page]

Skip to content

feat(api): api update #2205

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1c6fe7515b7879a7cd51bbe9433aeee5d3d30feaf519f42d0d81c64b19f45875.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fd93545b8e1dc65050c8398d3b7b60fbfecb16998bd6df403eb558e051297765.yml
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ Note that requests that time out are [retried twice by default](#retries).

We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

You can enable logging by setting the environment variable `CLOUDFLARE_LOG` to `debug`.
You can enable logging by setting the environment variable `CLOUDFLARE_LOG` to `info`.

```shell
$ export CLOUDFLARE_LOG=debug
$ export CLOUDFLARE_LOG=info
```

Or to `debug` for more verbose logging.

### How to tell whether `None` means `null` or missing

In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
Expand Down
3 changes: 2 additions & 1 deletion src/cloudflare/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def model_dump(
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
warnings=warnings,
# warnings are not supported in Pydantic v1
warnings=warnings if PYDANTIC_V2 else True,
)
return cast(
"dict[str, Any]",
Expand Down
23 changes: 16 additions & 7 deletions src/cloudflare/types/pagerules/page_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"ActionMinify",
"ActionPurgeByPageRule",
"ActionResolveOverride",
"ActionResolveOverrideValue",
"ActionRespectStrongEtag",
]

Expand Down Expand Up @@ -194,6 +193,13 @@ class ActionCacheKeyFields(BaseModel):

class ActionCacheOnCookie(BaseModel):
id: Optional[Literal["cache_on_cookie"]] = None
"""
Apply the Cache Everything option (Cache Level setting) based on a regular
expression match against a cookie name.
"""

value: Optional[str] = None
"""The regular expression to use for matching cookie names in the request."""


class ActionCacheTTLByStatus(BaseModel):
Expand Down Expand Up @@ -253,6 +259,13 @@ class ActionEdgeCacheTTL(BaseModel):

class ActionExplicitCacheControl(BaseModel):
id: Optional[Literal["explicit_cache_control"]] = None
"""
Origin Cache Control is enabled by default for Free, Pro, and Business domains
and disabled by default for Enterprise domains.
"""

value: Optional[Literal["on", "off"]] = None
"""The status of Origin Cache Control."""


class ActionForwardingURLValue(BaseModel):
Expand Down Expand Up @@ -296,16 +309,12 @@ class ActionPurgeByPageRule(BaseModel):
id: Optional[Literal["purge_by_page_rule"]] = None


class ActionResolveOverrideValue(BaseModel):
value: Optional[str] = None
"""The origin address you want to override with."""


class ActionResolveOverride(BaseModel):
id: Optional[Literal["resolve_override"]] = None
"""Change the origin address to the value specified in this setting."""

value: Optional[ActionResolveOverrideValue] = None
value: Optional[str] = None
"""The origin address you want to override with."""


class ActionRespectStrongEtag(BaseModel):
Expand Down
23 changes: 16 additions & 7 deletions src/cloudflare/types/pagerules/pagerule_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"ActionMinify",
"ActionPurgeByPageRule",
"ActionResolveOverride",
"ActionResolveOverrideValue",
"ActionRespectStrongEtag",
]

Expand Down Expand Up @@ -219,6 +218,13 @@ class ActionCacheKeyFields(TypedDict, total=False):

class ActionCacheOnCookie(TypedDict, total=False):
id: Literal["cache_on_cookie"]
"""
Apply the Cache Everything option (Cache Level setting) based on a regular
expression match against a cookie name.
"""

value: str
"""The regular expression to use for matching cookie names in the request."""


class ActionCacheTTLByStatus(TypedDict, total=False):
Expand Down Expand Up @@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):

class ActionExplicitCacheControl(TypedDict, total=False):
id: Literal["explicit_cache_control"]
"""
Origin Cache Control is enabled by default for Free, Pro, and Business domains
and disabled by default for Enterprise domains.
"""

value: Literal["on", "off"]
"""The status of Origin Cache Control."""


class ActionForwardingURLValue(TypedDict, total=False):
Expand Down Expand Up @@ -321,16 +334,12 @@ class ActionPurgeByPageRule(TypedDict, total=False):
id: Literal["purge_by_page_rule"]


class ActionResolveOverrideValue(TypedDict, total=False):
value: str
"""The origin address you want to override with."""


class ActionResolveOverride(TypedDict, total=False):
id: Literal["resolve_override"]
"""Change the origin address to the value specified in this setting."""

value: ActionResolveOverrideValue
value: str
"""The origin address you want to override with."""


class ActionRespectStrongEtag(TypedDict, total=False):
Expand Down
23 changes: 16 additions & 7 deletions src/cloudflare/types/pagerules/pagerule_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"ActionMinify",
"ActionPurgeByPageRule",
"ActionResolveOverride",
"ActionResolveOverrideValue",
"ActionRespectStrongEtag",
]

Expand Down Expand Up @@ -219,6 +218,13 @@ class ActionCacheKeyFields(TypedDict, total=False):

class ActionCacheOnCookie(TypedDict, total=False):
id: Literal["cache_on_cookie"]
"""
Apply the Cache Everything option (Cache Level setting) based on a regular
expression match against a cookie name.
"""

value: str
"""The regular expression to use for matching cookie names in the request."""


class ActionCacheTTLByStatus(TypedDict, total=False):
Expand Down Expand Up @@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):

class ActionExplicitCacheControl(TypedDict, total=False):
id: Literal["explicit_cache_control"]
"""
Origin Cache Control is enabled by default for Free, Pro, and Business domains
and disabled by default for Enterprise domains.
"""

value: Literal["on", "off"]
"""The status of Origin Cache Control."""


class ActionForwardingURLValue(TypedDict, total=False):
Expand Down Expand Up @@ -321,16 +334,12 @@ class ActionPurgeByPageRule(TypedDict, total=False):
id: Literal["purge_by_page_rule"]


class ActionResolveOverrideValue(TypedDict, total=False):
value: str
"""The origin address you want to override with."""


class ActionResolveOverride(TypedDict, total=False):
id: Literal["resolve_override"]
"""Change the origin address to the value specified in this setting."""

value: ActionResolveOverrideValue
value: str
"""The origin address you want to override with."""


class ActionRespectStrongEtag(TypedDict, total=False):
Expand Down
23 changes: 16 additions & 7 deletions src/cloudflare/types/pagerules/pagerule_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"ActionMinify",
"ActionPurgeByPageRule",
"ActionResolveOverride",
"ActionResolveOverrideValue",
"ActionRespectStrongEtag",
]

Expand Down Expand Up @@ -219,6 +218,13 @@ class ActionCacheKeyFields(TypedDict, total=False):

class ActionCacheOnCookie(TypedDict, total=False):
id: Literal["cache_on_cookie"]
"""
Apply the Cache Everything option (Cache Level setting) based on a regular
expression match against a cookie name.
"""

value: str
"""The regular expression to use for matching cookie names in the request."""


class ActionCacheTTLByStatus(TypedDict, total=False):
Expand Down Expand Up @@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):

class ActionExplicitCacheControl(TypedDict, total=False):
id: Literal["explicit_cache_control"]
"""
Origin Cache Control is enabled by default for Free, Pro, and Business domains
and disabled by default for Enterprise domains.
"""

value: Literal["on", "off"]
"""The status of Origin Cache Control."""


class ActionForwardingURLValue(TypedDict, total=False):
Expand Down Expand Up @@ -321,16 +334,12 @@ class ActionPurgeByPageRule(TypedDict, total=False):
id: Literal["purge_by_page_rule"]


class ActionResolveOverrideValue(TypedDict, total=False):
value: str
"""The origin address you want to override with."""


class ActionResolveOverride(TypedDict, total=False):
id: Literal["resolve_override"]
"""Change the origin address to the value specified in this setting."""

value: ActionResolveOverrideValue
value: str
"""The origin address you want to override with."""


class ActionRespectStrongEtag(TypedDict, total=False):
Expand Down
4 changes: 4 additions & 0 deletions src/cloudflare/types/zones/automatic_https_rewrites.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

class AutomaticHTTPSRewrites(BaseModel):
id: Optional[Literal["automatic_https_rewrites"]] = None
"""Turn on or off Automatic HTTPS Rewrites."""

value: Optional[Literal["on", "off"]] = None
"""The status of Automatic HTTPS Rewrites."""
4 changes: 4 additions & 0 deletions src/cloudflare/types/zones/automatic_https_rewrites_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@

class AutomaticHTTPSRewritesParam(TypedDict, total=False):
id: Literal["automatic_https_rewrites"]
"""Turn on or off Automatic HTTPS Rewrites."""

value: Literal["on", "off"]
"""The status of Automatic HTTPS Rewrites."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/ip_geolocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

from ..._models import BaseModel

__all__ = ["IPGeolocation", "Value"]


class Value(BaseModel):
value: Optional[Literal["on", "off"]] = None
"""The status of adding the IP Geolocation Header."""
__all__ = ["IPGeolocation"]


class IPGeolocation(BaseModel):
Expand All @@ -20,4 +15,5 @@ class IPGeolocation(BaseModel):
corresponds to the visitor.
"""

value: Optional[Value] = None
value: Optional[Literal["on", "off"]] = None
"""The status of adding the IP Geolocation Header."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/ip_geolocation_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

from typing_extensions import Literal, TypedDict

__all__ = ["IPGeolocationParam", "Value"]


class Value(TypedDict, total=False):
value: Literal["on", "off"]
"""The status of adding the IP Geolocation Header."""
__all__ = ["IPGeolocationParam"]


class IPGeolocationParam(TypedDict, total=False):
Expand All @@ -19,4 +14,5 @@ class IPGeolocationParam(TypedDict, total=False):
corresponds to the visitor.
"""

value: Value
value: Literal["on", "off"]
"""The status of adding the IP Geolocation Header."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/mirage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

from ..._models import BaseModel

__all__ = ["Mirage", "Value"]


class Value(BaseModel):
value: Optional[Literal["on", "off"]] = None
"""The status of Mirage."""
__all__ = ["Mirage"]


class Mirage(BaseModel):
Expand All @@ -21,4 +16,5 @@ class Mirage(BaseModel):
HTTP/1.
"""

value: Optional[Value] = None
value: Optional[Literal["on", "off"]] = None
"""The status of Mirage."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/mirage_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

from typing_extensions import Literal, TypedDict

__all__ = ["MirageParam", "Value"]


class Value(TypedDict, total=False):
value: Literal["on", "off"]
"""The status of Mirage."""
__all__ = ["MirageParam"]


class MirageParam(TypedDict, total=False):
Expand All @@ -20,4 +15,5 @@ class MirageParam(TypedDict, total=False):
HTTP/1.
"""

value: Value
value: Literal["on", "off"]
"""The status of Mirage."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/opportunistic_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

from ..._models import BaseModel

__all__ = ["OpportunisticEncryption", "Value"]


class Value(BaseModel):
value: Optional[Literal["on", "off"]] = None
"""The status of Opportunistic Encryption."""
__all__ = ["OpportunisticEncryption"]


class OpportunisticEncryption(BaseModel):
Expand All @@ -21,4 +16,5 @@ class OpportunisticEncryption(BaseModel):
for otherwise vulnerable requests.
"""

value: Optional[Value] = None
value: Optional[Literal["on", "off"]] = None
"""The status of Opportunistic Encryption."""
10 changes: 3 additions & 7 deletions src/cloudflare/types/zones/opportunistic_encryption_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

from typing_extensions import Literal, TypedDict

__all__ = ["OpportunisticEncryptionParam", "Value"]


class Value(TypedDict, total=False):
value: Literal["on", "off"]
"""The status of Opportunistic Encryption."""
__all__ = ["OpportunisticEncryptionParam"]


class OpportunisticEncryptionParam(TypedDict, total=False):
Expand All @@ -20,4 +15,5 @@ class OpportunisticEncryptionParam(TypedDict, total=False):
for otherwise vulnerable requests.
"""

value: Value
value: Literal["on", "off"]
"""The status of Opportunistic Encryption."""
Loading
0