-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathscript.py
More file actions
368 lines (272 loc) · 11 KB
/
script.py
File metadata and controls
368 lines (272 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal, TypeAlias
from ..._models import BaseModel
from .scripts.consumer_script import ConsumerScript
__all__ = [
"Script",
"NamedHandler",
"Observability",
"ObservabilityLogs",
"ObservabilityTraces",
"Placement",
"PlacementUnionMember0",
"PlacementUnionMember1",
"PlacementUnionMember2",
"PlacementUnionMember3",
"PlacementUnionMember4",
"PlacementUnionMember5",
"PlacementUnionMember6",
"PlacementUnionMember7",
"PlacementUnionMember7Target",
"PlacementUnionMember7TargetRegion",
"PlacementUnionMember7TargetHostname",
"PlacementUnionMember7TargetHost",
]
class NamedHandler(BaseModel):
handlers: Optional[List[str]] = None
"""The names of handlers exported as part of the named export."""
name: Optional[str] = None
"""The name of the export."""
class ObservabilityLogs(BaseModel):
"""Log settings for the Worker."""
enabled: bool
"""Whether logs are enabled for the Worker."""
invocation_logs: bool
"""
Whether
[invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs)
are enabled for the Worker.
"""
destinations: Optional[List[str]] = None
"""A list of destinations where logs will be exported to."""
head_sampling_rate: Optional[float] = None
"""The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1."""
persist: Optional[bool] = None
"""Whether log persistence is enabled for the Worker."""
class ObservabilityTraces(BaseModel):
"""Trace settings for the Worker."""
destinations: Optional[List[str]] = None
"""A list of destinations where traces will be exported to."""
enabled: Optional[bool] = None
"""Whether traces are enabled for the Worker."""
head_sampling_rate: Optional[float] = None
"""The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1."""
persist: Optional[bool] = None
"""Whether trace persistence is enabled for the Worker."""
class Observability(BaseModel):
"""Observability settings for the Worker."""
enabled: bool
"""Whether observability is enabled for the Worker."""
head_sampling_rate: Optional[float] = None
"""The sampling rate for incoming requests.
From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
"""
logs: Optional[ObservabilityLogs] = None
"""Log settings for the Worker."""
traces: Optional[ObservabilityTraces] = None
"""Trace settings for the Worker."""
class PlacementUnionMember0(BaseModel):
mode: Literal["smart"]
"""
Enables
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember1(BaseModel):
region: str
"""Cloud region for targeted placement in format 'provider:region'."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember2(BaseModel):
hostname: str
"""HTTP hostname for targeted placement."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember3(BaseModel):
host: str
"""TCP host and port for targeted placement."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember4(BaseModel):
mode: Literal["targeted"]
"""Targeted placement mode."""
region: str
"""Cloud region for targeted placement in format 'provider:region'."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember5(BaseModel):
hostname: str
"""HTTP hostname for targeted placement."""
mode: Literal["targeted"]
"""Targeted placement mode."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember6(BaseModel):
host: str
"""TCP host and port for targeted placement."""
mode: Literal["targeted"]
"""Targeted placement mode."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
class PlacementUnionMember7TargetRegion(BaseModel):
region: str
"""Cloud region in format 'provider:region'."""
class PlacementUnionMember7TargetHostname(BaseModel):
hostname: str
"""HTTP hostname for targeted placement."""
class PlacementUnionMember7TargetHost(BaseModel):
host: str
"""TCP host:port for targeted placement."""
PlacementUnionMember7Target: TypeAlias = Union[
PlacementUnionMember7TargetRegion, PlacementUnionMember7TargetHostname, PlacementUnionMember7TargetHost
]
class PlacementUnionMember7(BaseModel):
mode: Literal["targeted"]
"""Targeted placement mode."""
target: List[PlacementUnionMember7Target]
"""Array of placement targets (currently limited to single target)."""
last_analyzed_at: Optional[datetime] = None
"""
The last time the script was analyzed for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
Placement: TypeAlias = Union[
PlacementUnionMember0,
PlacementUnionMember1,
PlacementUnionMember2,
PlacementUnionMember3,
PlacementUnionMember4,
PlacementUnionMember5,
PlacementUnionMember6,
PlacementUnionMember7,
]
class Script(BaseModel):
id: Optional[str] = None
"""The name used to identify the script."""
compatibility_date: Optional[str] = None
"""Date indicating targeted support in the Workers runtime.
Backwards incompatible fixes to the runtime following this date will not affect
this Worker.
"""
compatibility_flags: Optional[List[str]] = None
"""Flags that enable or disable certain features in the Workers runtime.
Used to enable upcoming features or opt in or out of specific changes not
included in a `compatibility_date`.
"""
created_on: Optional[datetime] = None
"""When the script was created."""
etag: Optional[str] = None
"""Hashed script content, can be used in a If-None-Match header when updating."""
handlers: Optional[List[str]] = None
"""The names of handlers exported as part of the default export."""
has_assets: Optional[bool] = None
"""Whether a Worker contains assets."""
has_modules: Optional[bool] = None
"""Whether a Worker contains modules."""
last_deployed_from: Optional[str] = None
"""The client most recently used to deploy this Worker."""
logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""
migration_tag: Optional[str] = None
"""
The tag of the Durable Object migration that was most recently applied for this
Worker.
"""
modified_on: Optional[datetime] = None
"""When the script was last modified."""
named_handlers: Optional[List[NamedHandler]] = None
"""
Named exports, such as Durable Object class implementations and named
entrypoints.
"""
observability: Optional[Observability] = None
"""Observability settings for the Worker."""
placement: Optional[Placement] = None
"""
Configuration for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
Specify mode='smart' for Smart Placement, or one of region/hostname/host.
"""
placement_mode: Optional[Literal["smart", "targeted"]] = None
"""
Configuration for
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
Specify mode='smart' for Smart Placement, or one of region/hostname/host.
"""
placement_status: Optional[Literal["SUCCESS", "UNSUPPORTED_APPLICATION", "INSUFFICIENT_INVOCATIONS"]] = None
"""
Status of
[Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
"""
tag: Optional[str] = None
"""The immutable ID of the script."""
tags: Optional[List[str]] = None
"""Tags associated with the Worker."""
tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""
usage_model: Optional[Literal["standard", "bundled", "unbound"]] = None
"""Usage model for the Worker invocations."""