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"
}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. 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"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
PAT organisation override.
Path Parameters
Body
Response
Successful response
The labels on one cluster.
The cluster's labels, key to value.
Show child attributes
Show child attributes
The cluster's own environment, which dynamic groups select on under the reserved environment key. Changed on the cluster, never through labels.
Keys no label may carry.