import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone"
payload = { "target_cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({target_cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target_cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'{
"copied_secrets": [
"<string>"
],
"inherited_secrets": [
"<string>"
],
"installation_id": "<string>",
"message": "<string>",
"operation_id": "<string>",
"source_cluster_id": "<string>",
"status": "<string>",
"suppressed_secrets": [
"<string>"
],
"copied_operating_settings": [
"autonomy"
],
"backup_protection": "armed",
"environment_id": "<string>",
"environment_name": "<string>",
"follow_branches": [
"<string>"
],
"image_branch": "<string>",
"image_tag": "<string>",
"rule_has_no_build": true,
"warnings": [
"<string>"
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}Clone an application environment onto another cluster
Clones one environment of the application onto another cluster: the same image, deploy mode and accepted deploy options (replicas, resources, ports, every option but the addresses), queued as a deploy. Hostnames are claimed organisation-wide, so the copy keeps the target’s own address or derives a fresh one. A cluster the application already runs on is overwritten in place. With include_secrets the source’s own secret overrides are re-written under the target’s Vault path, its suppressions are copied, and the target’s other overrides return to the shared value; only key names are returned and each one is audited. environment_id is a stored environment id or the cluster id an unnamed environment is known by. Held to the applications.deploy permission, and applications.write as well when secrets are included. Bearer personal access token; the CLI twin of the browser route (no CSRF header).
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone"
payload = { "target_cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({target_cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target_cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'{
"copied_secrets": [
"<string>"
],
"inherited_secrets": [
"<string>"
],
"installation_id": "<string>",
"message": "<string>",
"operation_id": "<string>",
"source_cluster_id": "<string>",
"status": "<string>",
"suppressed_secrets": [
"<string>"
],
"copied_operating_settings": [
"autonomy"
],
"backup_protection": "armed",
"environment_id": "<string>",
"environment_name": "<string>",
"follow_branches": [
"<string>"
],
"image_branch": "<string>",
"image_tag": "<string>",
"rule_has_no_build": true,
"warnings": [
"<string>"
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The cluster the copy runs on.
Copy the source's own secret overrides and suppressions onto the target.
Consent that the copy's deploy sets up the CloudNativePG operator the application's database needs when the target cluster has none, exactly as prepare_database on a deploy. Requires stacks.write on the target cluster.
Name of the new environment (1 to 100 characters, no control characters). When given, the stored environment is created before anything else, the secrets are copied into its own scope, and the deploy binds to it; environment_id in the answer is then its id.
Branch patterns whose pushes the new environment follows, matched as a pipeline's when.branches. Needs environment_name. When given, the newest published build of a matching branch is deployed instead of the source's version; with none, the source's version is deployed and the first matching publish deploys. Absent or null is an environment updated by hand or by promotion; [] is refused.
1Which placement of a multi-cluster source environment to copy; absent copies the oldest one.
Copy the source environment's own who-runs-it layer, its operating expectations and its backup protection onto a named clone, each through its own write and checks (never widening what the new environment inherits). Absent or null is true. Skipped, not refused, for a caller without applications.write. An unnamed clone copies none.
Response
The deploy the clone queued and the secret keys it wrote.
Override keys written to the target.
Target override keys returned to the shared value.
Keys suppressed on the target, as on the source.
The operating settings copied onto the new environment. Empty when none were.
autonomy, operating_expectations, backup_protection What became of the source deployment's backup protection: pending when the deploy that creates the new stack arms the database-backup default, not_copied when the source is protected (or its protection could not be read) and the new deployment will not be. Null when the source is not protected or no operating settings were copied.
armed, pending, not_copied The new environment: its stored id when the clone named it, otherwise the target cluster's id.
The new environment's name; null when the clone named none.
The new environment's branch rule; null when it is updated by hand or by promotion.
The branch whose newest published build the first deploy runs. Absent when it runs the source environment's version.
The image tag the first deploy runs: the newest matching branch build, or the source's version. Empty when neither pins one.
True when follow_branches matches no published branch build yet: the source's version runs until a matching branch publishes one. Absent otherwise.