Skip to main content

namespaces_triggers

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

Overview

Namenamespaces_triggers
TypeResource
Iddigitalocean.functions.namespaces_triggers

Fields

NameDatatypeDescription
namestringThe trigger's unique name within the namespace.
created_atstringUTC time string.
functionstringName of function(action) that exists in the given namespace.
is_enabledbooleanIndicates weather the trigger is paused or unpaused.
namespacestringA unique string format of UUID with a prefix fn-.
scheduled_detailsobjectTrigger details for SCHEDULED type, where body is optional.
scheduled_runsobject
typestringString which indicates the type of trigger source like SCHEDULED.
updated_atstringUTC time string.

Methods

NameAccessible byRequired ParamsDescription
functions_get_triggerSELECTnamespace_id, trigger_nameGets the trigger details. To get the trigger details, send a GET request to /v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME.
functions_list_triggersSELECTnamespace_idReturns a list of triggers associated with the current user and namespace. To get all triggers, send a GET request to /v2/functions/namespaces/$NAMESPACE_ID/triggers.
functions_create_triggerINSERTnamespace_id, data__function, data__is_enabled, data__name, data__scheduled_details, data__typeCreates a new trigger for a given function in a namespace. To create a trigger, send a POST request to /v2/functions/namespaces/$NAMESPACE_ID/triggers with the name, function, type, is_enabled and scheduled_details properties.
functions_delete_triggerDELETEnamespace_id, trigger_nameDeletes the given trigger. To delete trigger, send a DELETE request to /v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME. A successful deletion returns a 204 response.
functions_update_triggerEXECnamespace_id, trigger_nameUpdates the details of the given trigger. To update a trigger, send a PUT request to /v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME with new values for the is_enabled or scheduled_details properties.

SELECT examples

Returns a list of triggers associated with the current user and namespace. To get all triggers, send a GET request to /v2/functions/namespaces/$NAMESPACE_ID/triggers.

SELECT
name,
created_at,
function,
is_enabled,
namespace,
scheduled_details,
scheduled_runs,
type,
updated_at
FROM digitalocean.functions.namespaces_triggers
WHERE namespace_id = '{{ namespace_id }}';

INSERT example

Use the following StackQL query and manifest file to create a new namespaces_triggers resource.

/*+ create */
INSERT INTO digitalocean.functions.namespaces_triggers (
data__name,
data__function,
data__type,
data__is_enabled,
data__scheduled_details,
namespace_id
)
SELECT
'{{ name }}',
'{{ function }}',
'{{ type }}',
'{{ is_enabled }}',
'{{ scheduled_details }}',
'{{ namespace_id }}'
;

DELETE example

Deletes the specified namespaces_triggers resource.

/*+ delete */
DELETE FROM digitalocean.functions.namespaces_triggers
WHERE namespace_id = '{{ namespace_id }}'
AND trigger_name = '{{ trigger_name }}';