8000 feat(api): api update (#2205) · cloudflare/cloudflare-python@10cdb97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10cdb97

Browse files
feat(api): api update (#2205)
1 parent 608a648 commit 10cdb97

28 files changed

+141
-158
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1451
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1c6fe7515b7879a7cd51bbe9433aeee5d3d30feaf519f42d0d81c64b19f45875.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fd93545b8e1dc65050c8398d3b7b60fbfecb16998bd6df403eb558e051297765.yml

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ Note that requests that time out are [retried twice by default](#retries).
245245

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

248-
You can enable logging by setting the environment variable `CLOUDFLARE_LOG` to `debug`.
248+
You can enable logging by setting the environment variable `CLOUDFLARE_LOG` to `info`.
249249

250250
```shell
251-
$ export CLOUDFLARE_LOG=debug
251+
$ export CLOUDFLARE_LOG=info
252252
```
253253

254+
Or to `debug` for more verbose logging.
255+
254256
### How to tell whether `None` means `null` or missing
255257

256258
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`:

src/cloudflare/_compat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def model_dump(
145145
exclude=exclude,
146146
exclude_unset=exclude_unset,
147147
exclude_defaults=exclude_defaults,
148-
warnings=warnings,
148+
# warnings are not supported in Pydantic v1
149+
warnings=warnings if PYDANTIC_V2 else True,
149150
)
150151
return cast(
151152
"dict[str, Any]",

src/cloudflare/types/pagerules/page_rule.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"ActionMinify",
5959
"ActionPurgeByPageRule",
6060
"ActionResolveOverride",
61-
"ActionResolveOverrideValue",
6261
"ActionRespectStrongEtag",
6362
]
6463

@@ -194,6 +193,13 @@ class ActionCacheKeyFields(BaseModel):
194193

195194
class ActionCacheOnCookie(BaseModel):
196195
id: Optional[Literal["cache_on_cookie"]] = None
196+
"""
197+
Apply the Cache Everything option (Cache Level setting) based on a regular
198+
expression match against a cookie name.
199+
"""
200+
201+
value: Optional[str] = None
202+
"""The regular expression to use for matching cookie names in the request."""
197203

198204

199205
class ActionCacheTTLByStatus(BaseModel):
@@ -253,6 +259,13 @@ class ActionEdgeCacheTTL(BaseModel):
253259

254260
class ActionExplicitCacheControl(BaseModel):
255261
id: Optional[Literal["explicit_cache_control"]] = None
262+
"""
263+
Origin Cache Control is enabled by default for Free, Pro, and Business domains
264+
and disabled by default for Enterprise domains.
265+
"""
266+
267+
value: Optional[Literal["on", "off"]] = None
268+
"""The status of Origin Cache Control."""
256269

257270

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

298311

299-
class ActionResolveOverrideValue(BaseModel):
300-
value: Optional[str] = None
301-
"""The origin address you want to override with."""
302-
303-
304312
class ActionResolveOverride(BaseModel):
305313
id: Optional[Literal["resolve_override"]] = None
306314
"""Change the origin address to the value specified in this setting."""
307315

308-
value: Optional[ActionResolveOverrideValue] = None
316+
value: Optional[str] = None
317+
"""The origin address you want to override with."""
309318

310319

311320
class ActionRespectStrongEtag(BaseModel):

src/cloudflare/types/pagerules/pagerule_create_params.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"ActionMinify",
5858
"ActionPurgeByPageRule",
5959
"ActionResolveOverride",
60-
"ActionResolveOverrideValue",
6160
"ActionRespectStrongEtag",
6261
]
6362

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

220219
class ActionCacheOnCookie(TypedDict, total=False):
221220
id: Literal["cache_on_cookie"]
221+
"""
222+
Apply the Cache Everything option (Cache Level setting) based on a regular
223+
expression match against a cookie name.
224+
"""
225+
226+
value: str
227+
"""The regular expression to use for matching cookie names in the request."""
222228

223229

224230
class ActionCacheTTLByStatus(TypedDict, total=False):
@@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):
278284

279285
class ActionExplicitCacheControl(TypedDict, total=False):
280286
id: Literal["explicit_cache_control"]
287+
"""
288+
Origin Cache Control is enabled by default for Free, Pro, and Business domains
289+
and disabled by default for Enterprise domains.
290+
"""
291+
292+
value: Literal["on", "off"]
293+
"""The status of Origin Cache Control."""
281294

282295

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

323336

324-
class ActionResolveOverrideValue(TypedDict, total=False):
325-
value: str
326-
"""The origin address you want to override with."""
327-
328-
329337
class ActionResolveOverride(TypedDict, total=False):
330338
id: Literal["resolve_override"]
331339
"""Change the origin address to the value specified in this setting."""
332340

333-
value: ActionResolveOverrideValue
341+
value: str
342+
"""The origin address you want to override with."""
334343

335344

336345
class ActionRespectStrongEtag(TypedDict, total=False):

src/cloudflare/types/pagerules/pagerule_edit_params.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"ActionMinify",
5858
"ActionPurgeByPageRule",
5959
"ActionResolveOverride",
60-
"ActionResolveOverrideValue",
6160
"ActionRespectStrongEtag",
6261
]
6362

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

220219
class ActionCacheOnCookie(TypedDict, total=False):
221220
id: Literal["cache_on_cookie"]
221+
"""
222+
Apply the Cache Everything option (Cache Level setting) based on a regular
223+
expression match against a cookie name.
224+
"""
225+
226+
value: str
227+
"""The regular expression to use for matching cookie names in the request."""
222228

223229

224230
class ActionCacheTTLByStatus(TypedDict, total=False):
@@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):
278284

279285
class ActionExplicitCacheControl(TypedDict, total=False):
280286
id: Literal["explicit_cache_control"]
287+
"""
288+
Origin Cache Control is enabled by default for Free, Pro, and Business domains
289+
and disabled by default for Enterprise domains.
290+
"""
291+
292+
value: Literal["on", "off"]
293+
"""The status of Origin Cache Control."""
281294

282295

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

323336

324-
class ActionResolveOverrideValue(TypedDict, total=False):
325-
value: str
326-
"""The origin address you want to override with."""
327-
328-
329337
class ActionResolveOverride(TypedDict, total=False):
330338
id: Literal["resolve_override"]
331339
"""Change the origin address to the value specified in this setting."""
332340

333-
value: ActionResolveOverrideValue
341+
value: str
342+
"""The origin address you want to override with."""
334343

335344

336345
class ActionRespectStrongEtag(TypedDict, total=False):

src/cloudflare/types/pagerules/pagerule_update_params.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"ActionMinify",
5858
"ActionPurgeByPageRule",
5959
"ActionResolveOverride",
60-
"ActionResolveOverrideValue",
6160
"ActionRespectStrongEtag",
6261
]
6362

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

220219
class ActionCacheOnCookie(TypedDict, total=False):
221220
id: Literal["cache_on_cookie"]
221+
"""
222+
Apply the Cache Everything option (Cache Level setting) based on a regular
223+
expression match against a cookie name.
224+
"""
225+
226+
value: str
227+
"""The regular expression to use for matching cookie names in the request."""
222228

223229

224230
class ActionCacheTTLByStatus(TypedDict, total=False):
@@ -278,6 +284,13 @@ class ActionEdgeCacheTTL(TypedDict, total=False):
278284

279285
class ActionExplicitCacheControl(TypedDict, total=False):
280286
id: Literal["explicit_cache_control"]
287+
"""
288+
Origin Cache Control is enabled by default for Free, Pro, and Business domains
289+
and disabled by default for Enterprise domains.
290+
"""
291+
292+
value: Literal["on", "off"]
293+
"""The status of Origin Cache Control."""
281294

282295

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

323336

324-
class ActionResolveOverrideValue(TypedDict, total=False):
325-
value: str
326-
"""The origin address you want to override with."""
327-
328-
329337
class ActionResolveOverride(TypedDict, total=False):
330338
id: Literal["resolve_override"]
331339
"""Change the origin address to the value specified in this setting."""
332340

333-
value: ActionResolveOverrideValue
341+
value: str
342+
"""The origin address you want to override with."""
334343

335344

336345
class ActionRespectStrongEtag(TypedDict, total=False):

src/cloudflare/types/zones/automatic_https_rewrites.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010

1111
class AutomaticHTTPSRewrites(BaseModel):
1212
id: Optional[Literal["automatic_https_rewrites"]] = None
13+
"""Turn on or off Automatic HTTPS Rewrites."""
14+
15+
value: Optional[Literal["on", "off"]] = None
16+
"""The status of Automatic HTTPS Rewrites."""

src/cloudflare/types/zones/automatic_https_rewrites_param.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99

1010
class AutomaticHTTPSRewritesParam(TypedDict, total=False):
1111
id: Literal["automatic_https_rewrites"]
12+
"""Turn on or off Automatic HTTPS Rewrites."""
13+
14+
value: Literal["on", "off"]
15+
"""The status of Automatic HTTPS Rewrites."""

src/cloudflare/types/zones/ip_geolocation.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55

66
from ..._models import BaseModel
77

8-
__all__ = ["IPGeolocation", "Value"]
9-
10-
11-
class Value(BaseModel):
12-
value: Optional[Literal["on", "off"]] = None
13-
"""The status of adding the IP Geolocation Header."""
8+
__all__ = ["IPGeolocation"]
149

1510

1611
class IPGeolocation(BaseModel):
@@ -20,4 +15,5 @@ class IPGeolocation(BaseModel):
2015
corresponds to the visitor.
2116
"""
2217

23-
value: Optional[Value] = None
18+
value: Optional[Literal["on", "off"]] = None
19+
"""The status of adding the IP Geolocation Header."""

0 commit comments

Comments
 (0)
0