Set the security baseline policy mode (audit or enforce) (browser session)
import requests
url = "https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode"
payload = {}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '{}'{
"commit_sha": "<string>",
"commit_url": "<string>",
"mode": "audit",
"valid": true
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}Security
Set the security baseline policy mode (audit or enforce) (browser session)
Switches the security baseline’s Kyverno policies between audit and enforce on one cluster by updating the policy add-on’s configuration through GitOps, and returns the resulting commit. Requires security.triage or security.manage; returns 404 when the baseline policy add-on is not installed. Mode off uninstalls every Kyverno add-on on the cluster; while a namespace move of one of them is still running it is refused with 422 and the error_code NAMESPACE_MOVE_IN_FLIGHT: nothing is cancelled or removed, and the same request is accepted once the move’s operation has finished. off is refused with 409 when a Kyverno add-on belongs to a stack a managed service owns: nothing is removed, and the add-on goes with the service’s retirement.
POST
/
org
/
clusters
/
imported
/
{cluster_id}
/
security
/
policy-mode
Set the security baseline policy mode (audit or enforce) (browser session)
import requests
url = "https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode"
payload = {}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-mode \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '{}'{
"commit_sha": "<string>",
"commit_url": "<string>",
"mode": "audit",
"valid": true
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}