1
1
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
3
- from typing import List , Optional
3
+ from typing import List , Union , Optional
4
4
from datetime import datetime
5
- from typing_extensions import Literal
5
+ from typing_extensions import Literal , Annotated , TypeAlias
6
6
7
7
from .target import Target
8
+ from ..._utils import PropertyInfo
8
9
from ..._models import BaseModel
10
+ from ..zones .ssl import SSL
11
+ from ..zones .waf import WAF
12
+ from ..zones .mirage import Mirage
13
+ from ..zones .polish import Polish
14
+ from ..zones .cache_level import CacheLevel
15
+ from ..zones .browser_check import BrowserCheck
16
+ from ..zones .rocket_loader import RocketLoader
17
+ from ..zones .ip_geolocation import IPGeolocation
18
+ from ..zones .security_level import SecurityLevel
19
+ from ..zones .always_use_https import AlwaysUseHTTPS
20
+ from ..zones .development_mode import DevelopmentMode
21
+ from ..zones .browser_cache_ttl import BrowserCacheTTL
22
+ from ..zones .email_obfuscation import EmailObfuscation
23
+ from ..zones .hotlink_protection import HotlinkProtection
24
+ from ..zones .response_buffering import ResponseBuffering
25
+ from ..zones .server_side_excludes import ServerSideExcludes
26
+ from ..zones .true_client_ip_header import TrueClientIPHeader
27
+ from ..zones .automatic_https_rewrites import AutomaticHTTPSRewrites
28
+ from ..zones .opportunistic_encryption import OpportunisticEncryption
29
+ from ..zones .origin_error_page_pass_thru import OriginErrorPagePassThru
30
+ from ..zones .sort_query_string_for_cache import SortQueryStringForCache
9
31
10
- __all__ = ["PageRule" , "Action" , "ActionValue" ]
32
+ __all__ = [
33
+ "PageRule" ,
34
+ "Action" ,
35
+ "ActionBypassCacheOnCookie" ,
36
+ "ActionCacheByDeviceType" ,
37
+ "ActionCacheDeceptionArmor" ,
38
+ "ActionCacheKey" ,
39
+ "ActionCacheKeyValue" ,
40
+ "ActionCacheKeyValueCookie" ,
41
+ "ActionCacheKeyValueHeader" ,
42
+ "ActionCacheKeyValueHost" ,
43
+ "ActionCacheKeyValueQueryString" ,
44
+ "ActionCacheKeyValueUser" ,
45
+ "ActionCacheKeyFields" ,
46
+ "ActionCacheOnCookie" ,
47
+ "ActionCacheTTLByStatus" ,
48
+ "ActionDDoSProtection" ,
49
+ "ActionDisableApps" ,
50
+ "ActionDisablePerformance" ,
51
+ "ActionDisableSecurity" ,
52
+ "ActionDisableZaraz" ,
53
+ "ActionEdgeCacheTTL" ,
54
+ "ActionExplicitCacheControl" ,
55
+ "ActionForwardingURL" ,
56
+ "ActionForwardingURLValue" ,
57
+ "ActionHostHeaderOverride" ,
58
+ "ActionMinify" ,
59
+ "ActionPurgeByPageRule" ,
60
+ "ActionResolveOverride" ,
61
+ "ActionResolveOverrideValue" ,
62
+ "ActionRespectStrongEtag" ,
63
+ ]
11
64
12
65
13
- class ActionValue (BaseModel ):
66
+ class ActionBypassCacheOnCookie (BaseModel ):
67
+ id : Optional [Literal ["bypass_cache_on_cookie" ]] = None
68
+ """
69
+ Bypass cache and fetch resources from the origin server if a regular expression
70
+ matches against a cookie name present in the request.
71
+ """
72
+
73
+ value : Optional [str ] = None
74
+ """The regular expression to use for matching cookie names in the request.
75
+
76
+ Refer to
77
+ [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting)
78
+ to learn about limited regular expression support.
79
+ """
80
+
81
+
82
+ class ActionCacheByDeviceType (BaseModel ):
83
+ id : Optional [Literal ["cache_by_device_type" ]] = None
84
+ """Separate cached content based on the visitor's device type."""
85
+
86
+ value : Optional [Literal ["on" , "off" ]] = None
87
+ """The status of Cache By Device Type."""
88
+
89
+
90
+ class ActionCacheDeceptionArmor (BaseModel ):
91
+ id : Optional [Literal ["cache_deception_armor" ]] = None
92
+ """
93
+ Protect from web cache deception attacks while still allowing static assets to
94
+ be cached. This setting verifies that the URL's extension matches the returned
95
+ `Content-Type`.
96
+ """
97
+
98
+ value : Optional [Literal ["on" , "off" ]] = None
99
+ """The status of Cache Deception Armor."""
100
+
101
+
102
+ class ActionCacheKeyValueCookie (BaseModel ):
103
+ check_presence : Optional [List [str ]] = None
104
+ """
105
+ A list of cookies to check for the presence of, without including their actual
106
+ values.
107
+ """
108
+
109
+ include : Optional [List [str ]] = None
110
+ """A list of cookies to include."""
111
+
112
+
113
+ class ActionCacheKeyValueHeader (BaseModel ):
114
+ check_presence : Optional [List [str ]] = None
115
+ """
116
+ A list of headers to check for the presence of, without including their actual
117
+ values.
118
+ """
119
+
120
+ exclude : Optional [List [str ]] = None
121
+ """A list of headers to ignore."""
122
+
123
+ include : Optional [List [str ]] = None
124
+ """A list of headers to include."""
125
+
126
+
127
+ class ActionCacheKeyValueHost (BaseModel ):
128
+ resolved : Optional [bool ] = None
129
+ """Whether to include the Host header in the HTTP request sent to the origin."""
130
+
131
+
132
+ class ActionCacheKeyValueQueryString (BaseModel ):
133
+ exclude : Union [Literal ["*" ], List [str ], None ] = None
134
+ """Ignore all query string parameters."""
135
+
136
+ include : Union [Literal ["*" ], List [str ], None ] = None
137
+ """Include all query string parameters."""
138
+
139
+
140
+ class ActionCacheKeyValueUser (BaseModel ):
141
+ device_type : Optional [bool ] = None
142
+ """
143
+ Classifies a request as `mobile`, `desktop`, or `tablet` based on the User
144
+ Agent.
145
+ """
146
+
147
+ geo : Optional [bool ] = None
148
+ """Includes the client's country, derived from the IP address."""
149
+
150
+ lang : Optional [bool ] = None
151
+ """
152
+ Includes the first language code contained in the `Accept-Language` header sent
153
+ by the client.
154
+ """
155
+
156
+
157
+ class ActionCacheKeyValue (BaseModel ):
158
+ cookie : Optional [ActionCacheKeyValueCookie ] = None
159
+ """Controls which cookies appear in the Cache Key."""
160
+
161
+ header : Optional [ActionCacheKeyValueHeader ] = None
162
+ """Controls which headers go into the Cache Key.
163
+
164
+ Exactly one of `include` or `exclude` is expected.
165
+ """
166
+
167
+ host : Optional [ActionCacheKeyValueHost ] = None
168
+ """Determines which host header to include in the Cache Key."""
169
+
170
+ query_string : Optional [ActionCacheKeyValueQueryString ] = None
171
+ """Controls which URL query string parameters go into the Cache Key.
172
+
173
+ Exactly one of `include` or `exclude` is expected.
174
+ """
175
+
176
+ user : Optional [ActionCacheKeyValueUser ] = None
177
+ """Feature fields to add features about the end-user (client) into the Cache Key."""
178
+
179
+
180
+ class ActionCacheKey (BaseModel ):
181
+ id : Optional [Literal ["cache_key" ]] = None
182
+ """
183
+ Control specifically what variables to include when deciding which resources to
184
+ cache. This allows customers to determine what to cache based on something other
185
+ than just the URL.
186
+ """
187
+
188
+ value : Optional [ActionCacheKeyValue ] = None
189
+
190
+
191
+ class ActionCacheKeyFields (BaseModel ):
192
+ id : Optional [Literal ["cache_key_fields" ]] = None
193
+
194
+
195
+ class ActionCacheOnCookie (BaseModel ):
196
+ id : Optional [Literal ["cache_on_cookie" ]] = None
197
+
198
+
199
+ class ActionCacheTTLByStatus (BaseModel ):
200
+ id : Optional [Literal ["cache_ttl_by_status" ]] = None
201
+
202
+
203
+ class ActionDDoSProtection (BaseModel ):
204
+ id : Optional [Literal ["ddos_protection" ]] = None
205
+
206
+
207
+ class ActionDisableApps (BaseModel ):
208
+ id : Optional [Literal ["disable_apps" ]] = None
209
+ """
210
+ Turn off all active
211
+ [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/)
212
+ (deprecated).
213
+ """
214
+
215
+
216
+ class ActionDisablePerformance (BaseModel ):
217
+ id : Optional [Literal ["disable_performance" ]] = None
218
+ """
219
+ Turn off
220
+ [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/),
221
+ [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/),
222
+ and [Polish](https://developers.cloudflare.com/images/polish/).
223
+ """
224
+
225
+
226
+ class ActionDisableSecurity (BaseModel ):
227
+ id : Optional [Literal ["disable_security" ]] = None
228
+ """
229
+ Turn off
230
+ [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/),
231
+ [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/),
232
+ [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/),
233
+ [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/),
234
+ and
235
+ [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/).
236
+ """
237
+
238
+
239
+ class ActionDisableZaraz (BaseModel ):
240
+ id : Optional [Literal ["disable_zaraz" ]] = None
241
+ """Turn off [Zaraz](https://developers.cloudflare.com/zaraz/)."""
242
+
243
+
244
+ class ActionEdgeCacheTTL (BaseModel ):
245
+ id : Optional [Literal ["edge_cache_ttl" ]] = None
246
+ """Specify how long to cache a resource in the Cloudflare global network.
247
+
248
+ _Edge Cache TTL_ is not visible in response headers.
249
+ """
250
+
251
+ value : Optional [int ] = None
252
+
253
+
254
+ class ActionExplicitCacheControl (BaseModel ):
255
+ id : Optional [Literal ["explicit_cache_control" ]] = None
256
+
257
+
258
+ class ActionForwardingURLValue (BaseModel ):
14
259
status_code : Optional [Literal [301 , 302 ]] = None
15
260
"""The status code to use for the URL redirect.
16
261
@@ -24,15 +269,102 @@ class ActionValue(BaseModel):
24
269
"""
25
270
26
271
27
- class Action (BaseModel ):
272
+ class ActionForwardingURL (BaseModel ):
28
273
id : Optional [Literal ["forwarding_url" ]] = None
29
274
"""Redirects one URL to another using an `HTTP 301/302` redirect.
30
275
31
276
Refer to
32
277
[Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/).
33
278
"""
34
279
35
- value : Optional [ActionValue ] = None
280
+ value : Optional [ActionForwardingURLValue ] = None
281
+
282
+
283
+ class ActionHostHeaderOverride (BaseModel ):
284
+ id : Optional [Literal ["host_header_override" ]] = None
285
+ """Apply a specific host header."""
286
+
287
+ value : Optional [str ] = None
288
+ """The hostname to use in the `Host` header"""
289
+
290
+
291
+ class ActionMinify (BaseModel ):
292
+ id : Optional [Literal ["minify" ]] = None
293
+
294
+
295
+ class ActionPurgeByPageRule (BaseModel ):
296
+ id : Optional [Literal ["purge_by_page_rule" ]] = None
297
+
298
+
299
+ class ActionResolveOverrideValue (BaseModel ):
300
+ value : Optional [str ] = None
301
+ """The origin address you want to override with."""
302
+
303
+
304
+ class ActionResolveOverride (BaseModel ):
305
+ id : Optional [Literal ["resolve_override" ]] = None
306
+ """Change the origin address to the value specified in this setting."""
307
+
308
+ value : Optional [ActionResolveOverrideValue ] = None
309
+
310
+
311
+ class ActionRespectStrongEtag (BaseModel ):
312
+ id : Optional [Literal ["respect_strong_etag" ]] = None
313
+ """
314
+ Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and
315
+ the origin server.
316
+ """
317
+
318
+ value : Optional [Literal ["on" , "off" ]] = None
319
+ """The status of Respect Strong ETags"""
320
+
321
+
322
+ Action : TypeAlias = Annotated [
323
+ Union [
324
+ AlwaysUseHTTPS ,
325
+ AutomaticHTTPSRewrites ,
326
+ BrowserCacheTTL ,
327
+ BrowserCheck ,
328
+ ActionBypassCacheOnCookie ,
329
+ ActionCacheByDeviceType ,
330
+ ActionCacheDeceptionArmor ,
331
+ ActionCacheKey ,
332
+ ActionCacheKeyFields ,
333
+ CacheLevel ,
334
+ ActionCacheOnCookie ,
335
+ ActionCacheTTLByStatus ,
336
+ ActionDDoSProtection ,
337
+ DevelopmentMode ,
338
+ ActionDisableApps ,
339
+ ActionDisablePerformance ,
340
+ ActionDisableSecurity ,
341
+ ActionDisableZaraz ,
342
+ ActionEdgeCacheTTL ,
343
+ EmailObfuscation ,
344
+ ActionExplicitCacheControl ,
345
+ ActionForwardingURL ,
346
+ ActionHostHeaderOverride ,
347
+ HotlinkProtection ,
348
+ IPGeolocation ,
349
+ ActionMinify ,
350
+ Mirage ,
351
+ OpportunisticEncryption ,
352
+ OriginErrorPagePassThru ,
353
+ Polish ,
354
+ ActionPurgeByPageRule ,
355
+ ActionResolveOverride ,
356
+ ActionRespectStrongEtag ,
357
+ ResponseBuffering ,
358
+ RocketLoader ,
359
+ SecurityLevel ,
360
+ ServerSideExcludes ,
361
+ SortQueryStringForCache ,
362
+ SSL ,
363
+ TrueClientIPHeader ,
364
+ WAF ,
365
+ ],
366
+ PropertyInfo (discriminator = "id" ),
367
+ ]
36
368
37
369
38
370
class PageRule (BaseModel ):
0 commit comments