import requests
url = "https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/labels"
payload = {
"remove": ["tier"],
"set": { "team": "payments" }
}
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({remove: ['tier'], set: {team: 'payments'}})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/labels', 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/{cluster_id}/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"remove": [
"tier"
],
"set": {
"team": "payments"
}
}
'{
"cluster_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"environment": "production",
"labels": {
"team": "payments"
},
"reserved_keys": [
"environment"
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "LOCK_TIMEOUT",
"retry_after": 123
}Change cluster labels
Sets and removes labels on this cluster (ankra cluster label set|rm): set adds or overwrites labels, remove deletes keys (removing a key the cluster does not carry is not an error). A label moves the cluster into or out of every dynamic cluster group that selects on it, and so changes what members holding a group-scoped role may do on it; the change therefore requires clusters.write for the whole organisation, not only on the cluster. Keys are 1-63 lowercase letters, digits, ., _, - or /; values are 1-63 letters, digits, ., _ or -; a cluster carries at most 32 labels; the environment key is reserved. Only a person may move the cluster into or out of a dynamic cluster group: a service account’s token may still change labels, but a change that would join or leave any dynamic group is refused with 403 and writes nothing. Every change is recorded in the organisation’s audit log; a change that leaves the labels as they were records nothing. Answers the labels after the change.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/labels"
payload = {
"remove": ["tier"],
"set": { "team": "payments" }
}
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({remove: ['tier'], set: {team: 'payments'}})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/{cluster_id}/labels', 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/{cluster_id}/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"remove": [
"tier"
],
"set": {
"team": "payments"
}
}
'{
"cluster_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"environment": "production",
"labels": {
"team": "payments"
},
"reserved_keys": [
"environment"
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "LOCK_TIMEOUT",
"retry_after": 123
}Authorizations
Body
Response
Successful response
The labels on one cluster.