Skip to main content

namespaces

Creates, updates, deletes, gets or lists a namespaces resource.

Overview

Namenamespaces
TypeResource
Idcloudflare.workers_for_platforms.namespaces

Fields

The following fields are returned by SELECT queries:

Get a Workers for Platforms namespace.

NameDatatypeDescription
namespace_idstringAPI Resource UUID tag. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
namespace_namestringName of the Workers for Platforms dispatch namespace. (example: my-dispatch-namespace)
created_bystringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
created_onstring (date-time)When the script was created. (example: 2017-01-01T00:00:00Z)
modified_bystringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
modified_onstring (date-time)When the script was last modified. (example: 2017-01-01T00:00:00Z)
script_countintegerThe current number of scripts in this Dispatch Namespace.
trusted_workersbooleanWhether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the request.cf object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and request.cf is undefined. By default, Workers in a namespace are "untrusted".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, dispatch_namespaceGet a Workers for Platforms namespace.
listselectaccount_idFetch a list of Workers for Platforms namespaces.
createinsertaccount_idCreate a new Workers for Platforms namespace.
namespace_worker_patch_namespaceupdateaccount_id, dispatch_namespacePatch a Workers for Platforms namespace. Omitted fields are left unchanged.
namespace_worker_put_namespacereplaceaccount_id, dispatch_namespaceUpdate a Workers for Platforms namespace.
deletedeleteaccount_id, dispatch_namespaceDelete a Workers for Platforms namespace.

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.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
dispatch_namespacestringThe Workers-for-Platforms dispatch namespace.

SELECT examples

Get a Workers for Platforms namespace.

SELECT
namespace_id,
namespace_name,
created_by,
created_on,
modified_by,
modified_on,
script_count,
trusted_workers
FROM cloudflare.workers_for_platforms.namespaces
WHERE account_id = '{{ account_id }}' -- required
AND dispatch_namespace = '{{ dispatch_namespace }}' -- required
;

INSERT examples

Create a new Workers for Platforms namespace.

INSERT INTO cloudflare.workers_for_platforms.namespaces (
name,
account_id
)
SELECT
'{{ name }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Patch a Workers for Platforms namespace. Omitted fields are left unchanged.

UPDATE cloudflare.workers_for_platforms.namespaces
SET
name = '{{ name }}',
trusted_workers = {{ trusted_workers }}
WHERE
account_id = '{{ account_id }}' --required
AND dispatch_namespace = '{{ dispatch_namespace }}' --required
RETURNING
errors,
messages,
result,
success;

REPLACE examples

Update a Workers for Platforms namespace.

REPLACE cloudflare.workers_for_platforms.namespaces
SET
name = '{{ name }}',
trusted_workers = {{ trusted_workers }}
WHERE
account_id = '{{ account_id }}' --required
AND dispatch_namespace = '{{ dispatch_namespace }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete a Workers for Platforms namespace.

DELETE FROM cloudflare.workers_for_platforms.namespaces
WHERE account_id = '{{ account_id }}' --required
AND dispatch_namespace = '{{ dispatch_namespace }}' --required
;