diff --git a/static/img/docs/create_copy.png b/static/img/docs/create_copy.png new file mode 100644 index 00000000..402b4066 Binary files /dev/null and b/static/img/docs/create_copy.png differ diff --git a/templates/docs/cloning_checks.html b/templates/docs/cloning_checks.html new file mode 100644 index 00000000..d972fe6b --- /dev/null +++ b/templates/docs/cloning_checks.html @@ -0,0 +1,29 @@ +

Cloning Checks

+

You can individually clone individual checks SITE_NAME from the "Check Details" +page:

+

The "Create a Copy" button

+

The "Create a Copy..." function creates a new check in the same project, and copies +over the following:

+ +

The newly created check has a different ping URL and it starts with an empty log.

+

Cloning All Checks Into a New Project

+

It is sometimes useful to clone an entire project. For example, when recreating +an existing deployment in a new region. The SITE_NAME web interface does +not have a function to clone an entire project, but this can be done relatively +easily using the Management API calls. Below is an example using Python +and the requests library:

+
import requests
+
+API_URL = "SITE_ROOT/api/v1/checks/"
+SOURCE_PROJECT_READONLY_KEY = "..."
+TARGET_PROJECT_KEY = "..."
+
+r = requests.get(API_URL, headers={"X-Api-Key": SOURCE_PROJECT_READONLY_KEY})
+for check in r.json()["checks"]:
+    print("Cloning %s" % check["name"])
+    requests.post(API_URL, json=check, headers={"X-Api-Key": TARGET_PROJECT_KEY})
+
\ No newline at end of file diff --git a/templates/docs/cloning_checks.md b/templates/docs/cloning_checks.md new file mode 100644 index 00000000..9ea315a0 --- /dev/null +++ b/templates/docs/cloning_checks.md @@ -0,0 +1,36 @@ +# Cloning Checks + +You can individually clone individual checks SITE_NAME from the "Check Details" +page: + +![The "Create a Copy" button](IMG_URL/create_copy.png) + +The "Create a Copy..." function creates a new check in the same project, and copies +over the following: + +* Name, tags, description +* Schedule +* Assigned notification methods + +The newly created check has a different ping URL and it starts with an empty log. + +## Cloning All Checks Into a New Project + +It is sometimes useful to clone an entire project. For example, when recreating +an existing deployment in a new region. The SITE_NAME web interface does +not have a function to clone an entire project, but this can be done relatively +easily using the [Management API](../api/) calls. Below is an example using Python +and the requests library: + +```python +import requests + +API_URL = "SITE_ROOT/api/v1/checks/" +SOURCE_PROJECT_READONLY_KEY = "..." +TARGET_PROJECT_KEY = "..." + +r = requests.get(API_URL, headers={"X-Api-Key": SOURCE_PROJECT_READONLY_KEY}) +for check in r.json()["checks"]: + print("Cloning %s" % check["name"]) + requests.post(API_URL, json=check, headers={"X-Api-Key": TARGET_PROJECT_KEY}) +``` diff --git a/templates/front/base_docs.html b/templates/front/base_docs.html index 277ad4ca..5d7a1481 100644 --- a/templates/front/base_docs.html +++ b/templates/front/base_docs.html @@ -31,6 +31,7 @@ {% include "front/docs_nav_item.html" with slug="signalling_failures" title="Signalling failures" %} {% include "front/docs_nav_item.html" with slug="measuring_script_run_time" title="Measuring script run time" %} {% include "front/docs_nav_item.html" with slug="attaching_logs" title="Attaching logs" %} + {% include "front/docs_nav_item.html" with slug="cloning_checks" title="Cloning Checks" %} {% include "front/docs_nav_item.html" with slug="api" title="Management API" %}