From ad2b6bd7ae6e066606003f3d2b45cbcc34821db5 Mon Sep 17 00:00:00 2001 From: Phillip Baker Date: Thu, 6 Feb 2020 10:42:21 -0500 Subject: [PATCH] [api] [monitors] Add option for force delete. --- content/en/api/monitors/code_snippets/api-monitor-delete.py | 3 +++ content/en/api/monitors/code_snippets/api-monitor-delete.sh | 3 +++ content/en/api/monitors/monitors_delete.md | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/content/en/api/monitors/code_snippets/api-monitor-delete.py b/content/en/api/monitors/code_snippets/api-monitor-delete.py index 27ed829314f96..6d133ab679a11 100644 --- a/content/en/api/monitors/code_snippets/api-monitor-delete.py +++ b/content/en/api/monitors/code_snippets/api-monitor-delete.py @@ -9,3 +9,6 @@ # Delete a monitor api.Monitor.delete(2081) + +# Force delete a monitor to override warnings +api.Monitor.delete(2081, force=True) diff --git a/content/en/api/monitors/code_snippets/api-monitor-delete.sh b/content/en/api/monitors/code_snippets/api-monitor-delete.sh index f8660a8400c8d..8b218d8f0d362 100644 --- a/content/en/api/monitors/code_snippets/api-monitor-delete.sh +++ b/content/en/api/monitors/code_snippets/api-monitor-delete.sh @@ -8,3 +8,6 @@ monitor_id= # Delete a monitor curl -X DELETE "https://api.datadoghq.com/api/v1/monitor/${monitor_id}?api_key=${api_key}&application_key=${app_key}" + +# Force delete a monitor +curl -X DELETE "https://api.datadoghq.com/api/v1/monitor/${monitor_id}?force=true&api_key=${api_key}&application_key=${app_key}" \ No newline at end of file diff --git a/content/en/api/monitors/monitors_delete.md b/content/en/api/monitors/monitors_delete.md index 8a218dce85a6f..69dee35a69125 100644 --- a/content/en/api/monitors/monitors_delete.md +++ b/content/en/api/monitors/monitors_delete.md @@ -9,4 +9,8 @@ external_redirect: /api/#delete-a-monitor **ARGUMENTS**: -This endpoint takes no JSON arguments. +If a monitor is used elsewhere, this endpoint returns an error because the monitor is referenced. + +* **`force`** [*optional*, *default*=**False**]: + + Boolean: Force delete the monitor. The monitor is deleted even if it's referenced by other resources (e.g. SLO, composite monitor).