import requests
url = "https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id}"
payload = { "in_scope": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({in_scope: true})
};
fetch('https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"in_scope": true
}
'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"in_scope": true,
"scope_reason": "all_clusters",
"policy_configured": true,
"policy_enabled": true,
"autonomy_level": "read_only",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Take a cluster out of the remediation scope
Takes one cluster out of the auto-remediation policy’s scope (in_scope: false) and answers the cluster’s scope afterwards, as the portal’s cluster switch does. A token may only narrow the scope: in_scope: true is refused with 403 and nothing is written, because a cluster in scope is one Ankra may act on by itself; put a cluster back in scope in the portal. Requires ai.manage in the token’s scopes and an organisation admin.
import requests
url = "https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id}"
payload = { "in_scope": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({in_scope: true})
};
fetch('https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/ai-remediation/policy/clusters/{cluster_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"in_scope": true
}
'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"in_scope": true,
"scope_reason": "all_clusters",
"policy_configured": true,
"policy_enabled": true,
"autonomy_level": "read_only",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Response
The cluster's scope.
One cluster's place in the auto-remediation policy's cluster scope. in_scope says only whether the policy's cluster lists admit the cluster; whether remediation actually runs there also needs policy_enabled and an autonomy_level other than read_only.
Why: all_clusters when there is no allow list and the cluster is not excluded, listed when the allow list names it, excluded when the exclusion list names it (whatever the allow list says), not_listed when an allow list is set that does not name it.
all_clusters, listed, excluded, not_listed