namespaces
Creates, updates, deletes, gets or lists a namespaces
resource.
Overview
Name | namespaces |
Type | Resource |
Id | digitalocean.serverless.namespaces |
Fields
The following fields are returned by SELECT
queries:
- functions_get_namespace
- functions_list_namespaces
A JSON response object with a key called namespace
. The object contains the properties associated
with the namespace.
Name | Datatype | Description |
---|---|---|
api_host | string | The namespace's API hostname. Each function in a namespace is provided an endpoint at the namespace's hostname. (example: https://api_host.io) |
created_at | string | UTC time string. (example: 2022-09-14T04:16:45Z) |
key | string | A random alpha numeric string. This key is used in conjunction with the namespace's UUID to authenticate a user to use the namespace via doctl , DigitalOcean's official CLI. (example: d1zcd455h01mqjfs4s2eaewyejehi5f2uj4etqq3h7cera8iwkub6xg5of1wdde2) |
label | string | The namespace's unique name. (example: my namespace) |
namespace | string | A unique string format of UUID with a prefix fn-. (example: fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
region | string | The namespace's datacenter region. (example: nyc1) |
updated_at | string | UTC time string. (example: 2022-09-14T04:16:45Z) |
uuid | string | The namespace's Universally Unique Identifier. (example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
An array of JSON objects with a key called namespaces
. Each object represents a namespace and contains
the properties associated with it.
Name | Datatype | Description |
---|---|---|
api_host | string | The namespace's API hostname. Each function in a namespace is provided an endpoint at the namespace's hostname. (example: https://api_host.io) |
created_at | string | UTC time string. (example: 2022-09-14T04:16:45Z) |
key | string | A random alpha numeric string. This key is used in conjunction with the namespace's UUID to authenticate a user to use the namespace via doctl , DigitalOcean's official CLI. (example: d1zcd455h01mqjfs4s2eaewyejehi5f2uj4etqq3h7cera8iwkub6xg5of1wdde2) |
label | string | The namespace's unique name. (example: my namespace) |
namespace | string | A unique string format of UUID with a prefix fn-. (example: fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
region | string | The namespace's datacenter region. (example: nyc1) |
updated_at | string | UTC time string. (example: 2022-09-14T04:16:45Z) |
uuid | string | The namespace's Universally Unique Identifier. (example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
functions_get_namespace | select | namespace_id | Gets the namespace details for the given namespace UUID. To get namespace details, send a GET request to /v2/functions/namespaces/$NAMESPACE_ID with no parameters. | |
functions_list_namespaces | select | Returns a list of namespaces associated with the current user. To get all namespaces, send a GET request to /v2/functions/namespaces . | ||
functions_create_namespace | insert | data__region , data__label | Creates a new serverless functions namespace in the desired region and associates it with the provided label. A namespace is a collection of functions and their associated packages, triggers, and project specifications. To create a namespace, send a POST request to /v2/functions/namespaces with the region and label properties. | |
functions_delete_namespace | delete | namespace_id | Deletes the given namespace. When a namespace is deleted all assets, in the namespace are deleted, this includes packages, functions and triggers. Deleting a namespace is a destructive operation and assets in the namespace are not recoverable after deletion. Some metadata is retained, such as activations, or soft deleted for reporting purposes. To delete namespace, send a DELETE request to /v2/functions/namespaces/$NAMESPACE_ID .A successful deletion returns a 204 response. |
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 |
---|---|---|
namespace_id | string | The ID of the namespace to be managed. (example: fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
SELECT
examples
- functions_get_namespace
- functions_list_namespaces
Gets the namespace details for the given namespace UUID. To get namespace details, send a GET request to /v2/functions/namespaces/$NAMESPACE_ID
with no parameters.
SELECT
api_host,
created_at,
key,
label,
namespace,
region,
updated_at,
uuid
FROM digitalocean.serverless.namespaces
WHERE namespace_id = '{{ namespace_id }}' -- required;
Returns a list of namespaces associated with the current user. To get all namespaces, send a GET request to /v2/functions/namespaces
.
SELECT
api_host,
created_at,
key,
label,
namespace,
region,
updated_at,
uuid
FROM digitalocean.serverless.namespaces;
INSERT
examples
- functions_create_namespace
- Manifest
Creates a new serverless functions namespace in the desired region and associates it with the provided label. A namespace is a collection of functions and their associated packages, triggers, and project specifications. To create a namespace, send a POST request to /v2/functions/namespaces
with the region
and label
properties.
INSERT INTO digitalocean.serverless.namespaces (
data__region,
data__label
)
SELECT
'{{ region }}' --required,
'{{ label }}' --required
RETURNING
namespace
;
# Description fields are for documentation purposes
- name: namespaces
props:
- name: region
value: string
description: >
The [datacenter region](https://docs.digitalocean.com/products/platform/availability-matrix/#available-datacenters) in which to create the namespace.
- name: label
value: string
description: >
The namespace's unique name.
DELETE
examples
- functions_delete_namespace
Deletes the given namespace. When a namespace is deleted all assets, in the namespace are deleted, this includes packages, functions and triggers. Deleting a namespace is a destructive operation and assets in the namespace are not recoverable after deletion. Some metadata is retained, such as activations, or soft deleted for reporting purposes.
To delete namespace, send a DELETE request to /v2/functions/namespaces/$NAMESPACE_ID
.
A successful deletion returns a 204 response.
DELETE FROM digitalocean.serverless.namespaces
WHERE namespace_id = '{{ namespace_id }}' --required;