workers_versions
Creates, updates, deletes, gets or lists a workers_versions resource.
Overview
| Name | workers_versions |
| Type | Resource |
| Id | cloudflare.workers.workers_versions |
Fields
The following fields are returned by SELECT queries:
- get_by_account
- list_by_account
Get version success.
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Version identifier. |
annotations | object | Metadata about the version. |
assets | object | Configuration for assets within a Worker. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain. |
bindings | array | List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. |
compatibility_date | string | Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. (example: 2021-01-01) |
compatibility_flags | array | 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. (x-stainless-collection-type: set) |
containers | array | List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. (x-stainless-collection-type: set) |
created_on | string (date-time) | When the version was created. |
limits | object | Resource limits enforced at runtime. (x-stainless-terraform-configurability: computed_optional) |
main_module | string | The name of the main module in the modules array (e.g. the name of the module that exports a fetch handler). (example: index.js) |
migration_tag | string | Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. (example: v1) |
migrations | object | Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. |
modules | array | Code, sourcemaps, and other content used at runtime. This includes _headers and _redirects files used to configure Static Assets. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain. (x-stainless-collection-type: set) |
number | integer | The integer version number, starting from one. |
placement | object | Configuration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host. |
source | string | The client used to create the version. (example: wrangler) |
startup_time_ms | integer | Time in milliseconds spent on Worker startup. |
urls | array | All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. |
usage_model | string | Usage model for the version. (standard, bundled, unbound) (default: standard, example: standard) |
List versions success.
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Version identifier. |
annotations | object | Metadata about the version. |
assets | object | Configuration for assets within a Worker. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain. |
bindings | array | List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings. |
compatibility_date | string | Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. (example: 2021-01-01) |
compatibility_flags | array | 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. (x-stainless-collection-type: set) |
containers | array | List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. (x-stainless-collection-type: set) |
created_on | string (date-time) | When the version was created. |
limits | object | Resource limits enforced at runtime. (x-stainless-terraform-configurability: computed_optional) |
main_module | string | The name of the main module in the modules array (e.g. the name of the module that exports a fetch handler). (example: index.js) |
migration_tag | string | Durable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. (example: v1) |
migrations | object | Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed. |
modules | array | Code, sourcemaps, and other content used at runtime. This includes _headers and _redirects files used to configure Static Assets. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain. (x-stainless-collection-type: set) |
number | integer | The integer version number, starting from one. |
placement | object | Configuration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host. |
source | string | The client used to create the version. (example: wrangler) |
startup_time_ms | integer | Time in milliseconds spent on Worker startup. |
urls | array | All routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version. |
usage_model | string | Usage model for the version. (standard, bundled, unbound) (default: standard, example: standard) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_account | select | account_id, worker_id, version_id | include | Get details about a specific version. |
list_by_account | select | account_id, worker_id | page, per_page | List all versions for a Worker. |
create_by_account | insert | account_id, worker_id | deploy | Create a new version. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
version_id | string | |
worker_id | string | |
deploy | boolean | |
include | string | |
page | integer | Current page. |
per_page | integer | Items per-page. |
SELECT examples
- get_by_account
- list_by_account
Get details about a specific version.
SELECT
id,
annotations,
assets,
bindings,
compatibility_date,
compatibility_flags,
containers,
created_on,
limits,
main_module,
migration_tag,
migrations,
modules,
number,
placement,
source,
startup_time_ms,
urls,
usage_model
FROM cloudflare.workers.workers_versions
WHERE account_id = '{{ account_id }}' -- required
AND worker_id = '{{ worker_id }}' -- required
AND version_id = '{{ version_id }}' -- required
AND include = '{{ include }}'
;
List all versions for a Worker.
SELECT
id,
annotations,
assets,
bindings,
compatibility_date,
compatibility_flags,
containers,
created_on,
limits,
main_module,
migration_tag,
migrations,
modules,
number,
placement,
source,
startup_time_ms,
urls,
usage_model
FROM cloudflare.workers.workers_versions
WHERE account_id = '{{ account_id }}' -- required
AND worker_id = '{{ worker_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- create_by_account
- Manifest
Create a new version.
INSERT INTO cloudflare.workers.workers_versions (
annotations,
assets,
bindings,
compatibility_date,
compatibility_flags,
containers,
limits,
main_module,
migrations,
modules,
placement,
usage_model,
account_id,
worker_id,
deploy
)
SELECT
'{{ annotations }}',
'{{ assets }}',
'{{ bindings }}',
'{{ compatibility_date }}',
'{{ compatibility_flags }}',
'{{ containers }}',
'{{ limits }}',
'{{ main_module }}',
'{{ migrations }}',
'{{ modules }}',
'{{ placement }}',
'{{ usage_model }}',
'{{ account_id }}',
'{{ worker_id }}',
'{{ deploy }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: workers_versions
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the workers_versions resource.
- name: worker_id
value: "{{ worker_id }}"
description: Required parameter for the workers_versions resource.
- name: annotations
description: |
Metadata about the version.
value:
workers/message: "{{ workers/message }}"
workers/tag: "{{ workers/tag }}"
workers/triggered_by: "{{ workers/triggered_by }}"
- name: assets
description: |
Configuration for assets within a Worker. [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files should be included as modules named `_headers` and `_redirects` with content type `text/plain`.
value:
config:
html_handling: "{{ html_handling }}"
not_found_handling: "{{ not_found_handling }}"
run_worker_first:
- "{{ run_worker_first }}"
jwt: "{{ jwt }}"
- name: bindings
description: |
List of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
value:
- name: "{{ name }}"
type: "{{ type }}"
instance_name: "{{ instance_name }}"
namespace: "{{ namespace }}"
dataset: "{{ dataset }}"
database_id: "{{ database_id }}"
id: "{{ id }}"
part: "{{ part }}"
outbound:
params:
- name: "{{ name }}"
worker:
entrypoint: "{{ entrypoint }}"
environment: "{{ environment }}"
service: "{{ service }}"
class_name: "{{ class_name }}"
dispatch_namespace: "{{ dispatch_namespace }}"
environment: "{{ environment }}"
namespace_id: "{{ namespace_id }}"
script_name: "{{ script_name }}"
old_name: "{{ old_name }}"
version_id: "{{ version_id }}"
json: "{{ json }}"
certificate_id: "{{ certificate_id }}"
text: "{{ text }}"
pipeline: "{{ pipeline }}"
queue_name: "{{ queue_name }}"
simple:
limit: {{ limit }}
mitigation_timeout: {{ mitigation_timeout }}
period: {{ period }}
bucket_name: "{{ bucket_name }}"
jurisdiction: "{{ jurisdiction }}"
allowed_destination_addresses: "{{ allowed_destination_addresses }}"
allowed_sender_addresses: "{{ allowed_sender_addresses }}"
destination_address: "{{ destination_address }}"
entrypoint: "{{ entrypoint }}"
service: "{{ service }}"
index_name: "{{ index_name }}"
secret_name: "{{ secret_name }}"
store_id: "{{ store_id }}"
app_id: "{{ app_id }}"
algorithm: "{{ algorithm }}"
format: "{{ format }}"
key_base64: "{{ key_base64 }}"
key_jwk: "{{ key_jwk }}"
usages: "{{ usages }}"
workflow_name: "{{ workflow_name }}"
service_id: "{{ service_id }}"
network_id: "{{ network_id }}"
tunnel_id: "{{ tunnel_id }}"
- name: compatibility_date
value: "{{ compatibility_date }}"
description: |
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
- name: compatibility_flags
value:
- "{{ compatibility_flags }}"
description: |
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`.
default:
- name: containers
description: |
List of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script.
value:
- class_name: "{{ class_name }}"
- name: limits
description: |
Resource limits enforced at runtime.
value:
cpu_ms: {{ cpu_ms }}
subrequests: {{ subrequests }}
- name: main_module
value: "{{ main_module }}"
description: |
The name of the main module in the `modules` array (e.g. the name of the module that exports a `fetch` handler).
- name: migrations
description: |
Migrations for Durable Objects associated with the version. Migrations are applied when the version is deployed.
value:
new_tag: "{{ new_tag }}"
old_tag: "{{ old_tag }}"
deleted_classes:
- "{{ deleted_classes }}"
new_classes:
- "{{ new_classes }}"
new_sqlite_classes:
- "{{ new_sqlite_classes }}"
renamed_classes:
- from: "{{ from }}"
to: "{{ to }}"
transferred_classes:
- from: "{{ from }}"
from_script: "{{ from_script }}"
to: "{{ to }}"
steps:
- deleted_classes: "{{ deleted_classes }}"
new_classes: "{{ new_classes }}"
new_sqlite_classes: "{{ new_sqlite_classes }}"
renamed_classes: "{{ renamed_classes }}"
transferred_classes: "{{ transferred_classes }}"
- name: modules
description: |
Code, sourcemaps, and other content used at runtime. This includes [`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/#custom-headers) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files used to configure [Static Assets](https://developers.cloudflare.com/workers/static-assets/). `_headers` and `_redirects` files should be included as modules named `_headers` and `_redirects` with content type `text/plain`.
value:
- content_base64: "{{ content_base64 }}"
content_type: "{{ content_type }}"
name: "{{ name }}"
- name: placement
description: |
Configuration for [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). Specify mode='smart' for Smart Placement, or one of region/hostname/host.
value:
mode: "{{ mode }}"
region: "{{ region }}"
hostname: "{{ hostname }}"
host: "{{ host }}"
target:
- region: "{{ region }}"
hostname: "{{ hostname }}"
host: "{{ host }}"
- name: usage_model
value: "{{ usage_model }}"
description: |
Usage model for the version.
valid_values: ['standard', 'bundled', 'unbound']
default: standard
- name: deploy
value: {{ deploy }}