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. (monitor-user-template) (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_idwith_all_versionsRetrieve a monitor user template by its ID.
list_monitor_user_templatesselectRetrieve all monitor user templates.
create_monitor_user_templateinsertdataCreate a new monitor user template.
update_monitor_user_templatereplacetemplate_id, dataCreates a new version of an existing monitor user template.
delete_monitor_user_templatedeletetemplate_idDelete an existing monitor user template by its ID.
validate_monitor_user_templateexecdataValidate the structure and content of a monitor user template.
validate_existing_monitor_user_templateexectemplate_id, 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
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
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 with_all_versions = '{{ with_all_versions }}'
;

INSERT examples​

Create a new monitor user template.

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

REPLACE examples​

Creates a new version of an existing monitor user template.

REPLACE datadog.monitoring.user_templates
SET
data = '{{ data }}'
WHERE
template_id = '{{ template_id }}' --required
AND 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
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Validate the structure and content of a monitor user template.

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