import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment"
payload = { "environment": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({environment: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"environment": "<string>"
}
'{
"criticality": "production",
"environment": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "LOCK_TIMEOUT",
"retry_after": 123
}Set what a cluster is called and what it is for
The bearer twin of the portal’s environment control (ankra cluster update --environment): sets the environment label and, when the body carries one, the criticality that decides how loudly the cluster reports, in a single transaction. A body without a criticality leaves the stored one untouched and answers with the environment alone. An ImportCluster file’s metadata.environment is applied only when the import creates the cluster, so this is how a cluster moves between environments afterwards. A person’s own token records the label as that person’s choice of what the cluster is for (environment_source person). A service account’s token records it as automation, which confirms nothing, leaves the recorded source alone when the label does not change, and may not take production away from the cluster: moving it off a production label or lowering a production criticality answers 403. Nor may it relabel the cluster into or out of a dynamic cluster group with an environment selector, or change whether the cluster’s tickets pass the ticket notify allow-list: that answers 403 too, and nothing is written. Requires clusters.write at the cluster.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment"
payload = { "environment": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({environment: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/environment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"environment": "<string>"
}
'{
"criticality": "production",
"environment": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "LOCK_TIMEOUT",
"retry_after": 123
}