Skip to main content

user_templates

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

Overview

Nameuser_templates
TypeResource
Iddatadog.monitoring.user_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier. (example: 00000000-0000-1234-0000-000000000000)
attributesobjectA monitor user template object.
typestringMonitor user template resource type. (default: monitor-user-template, example: monitor-user-template)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_monitor_user_templateselecttemplate_id, regionwith_all_versionsRetrieve a monitor user template by its ID.
list_monitor_user_templatesselectregionRetrieve all monitor user templates.
create_monitor_user_templateinsertregion, data__dataCreate a new monitor user template.
update_monitor_user_templatereplacetemplate_id, region, data__dataCreates a new version of an existing monitor user template.
delete_monitor_user_templatedeletetemplate_id, regionDelete an existing monitor user template by its ID.
validate_monitor_user_templateexecregion, dataValidate the structure and content of a monitor user template.
validate_existing_monitor_user_templateexectemplate_id, region, dataValidate the structure and content of an existing monitor user template being updated to 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.

NameDatatypeDescription
regionstring(default: datadoghq.com)
template_idstringID of the monitor user template.
with_all_versionsbooleanWhether to include all versions of the template in the response in the versions field. (example: false)

SELECT examples

Retrieve a monitor user template by its ID.

SELECT
id,
attributes,
type
FROM datadog.monitoring.user_templates
WHERE template_id = '{{ template_id }}' -- required
AND region = '{{ region }}' -- required
AND with_all_versions = '{{ with_all_versions }}'
;

INSERT examples

Create a new monitor user template.

INSERT INTO datadog.monitoring.user_templates (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data
;

REPLACE examples

Creates a new version of an existing monitor user template.

REPLACE datadog.monitoring.user_templates
SET
data__data = '{{ data }}'
WHERE
template_id = '{{ template_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Delete an existing monitor user template by its ID.

DELETE FROM datadog.monitoring.user_templates
WHERE template_id = '{{ template_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Validate the structure and content of a monitor user template.

EXEC datadog.monitoring.user_templates.validate_monitor_user_template 
@region='{{ region }}' --required
@@json=
'{
"data": "{{ data }}"
}'
;