import requests
url = "https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations \
--header 'Authorization: Bearer <token>'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_name": "<string>",
"detail": "<string>",
"policies": [
{
"category": "<string>",
"fail_count": 123,
"pass_count": 123,
"policy": "<string>",
"severity": "<string>",
"top_namespaces": [
{
"fail_count": 123,
"namespace": "<string>"
}
],
"warn_count": 123
}
],
"policy_mode": "audit",
"report_count": 123,
"status": "available",
"totals": {
"error": 123,
"fail": 123,
"pass": 123,
"skip": 123,
"warn": 123
},
"platform_posture": {
"status": "available",
"detail": "<string>",
"evaluated_workloads": 123,
"exempt_namespaces": [
"<string>"
],
"cache_as_of": "2023-11-07T05:31:56Z",
"totals": {
"error": 123,
"fail": 123,
"pass": 123,
"skip": 123,
"warn": 123
},
"policies": [
{
"category": "<string>",
"fail_count": 123,
"pass_count": 123,
"policy": "<string>",
"severity": "<string>",
"top_namespaces": [
{
"fail_count": 123,
"namespace": "<string>"
}
],
"warn_count": 123
}
],
"pod_security": {
"status": "available",
"detail": "<string>",
"mode": "audit",
"standard": "baseline",
"exempt_namespaces": [
"<string>"
],
"namespaces_total": 123,
"namespaces_labelled": 123,
"namespaces_enforced": 123
}
}
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>",
"error_code": "CLUSTER_OFFLINE",
"retry_after": 123
}Get one imported cluster's aggregated policy violations
import requests
url = "https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/org/clusters/imported/{cluster_id}/security/policy-violations \
--header 'Authorization: Bearer <token>'{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_name": "<string>",
"detail": "<string>",
"policies": [
{
"category": "<string>",
"fail_count": 123,
"pass_count": 123,
"policy": "<string>",
"severity": "<string>",
"top_namespaces": [
{
"fail_count": 123,
"namespace": "<string>"
}
],
"warn_count": 123
}
],
"policy_mode": "audit",
"report_count": 123,
"status": "available",
"totals": {
"error": 123,
"fail": 123,
"pass": 123,
"skip": 123,
"warn": 123
},
"platform_posture": {
"status": "available",
"detail": "<string>",
"evaluated_workloads": 123,
"exempt_namespaces": [
"<string>"
],
"cache_as_of": "2023-11-07T05:31:56Z",
"totals": {
"error": 123,
"fail": 123,
"pass": 123,
"skip": 123,
"warn": 123
},
"policies": [
{
"category": "<string>",
"fail_count": 123,
"pass_count": 123,
"policy": "<string>",
"severity": "<string>",
"top_namespaces": [
{
"fail_count": 123,
"namespace": "<string>"
}
],
"warn_count": 123
}
],
"pod_security": {
"status": "available",
"detail": "<string>",
"mode": "audit",
"standard": "baseline",
"exempt_namespaces": [
"<string>"
],
"namespaces_total": 123,
"namespaces_labelled": 123,
"namespaces_enforced": 123
}
}
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>",
"error_code": "CLUSTER_OFFLINE",
"retry_after": 123
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Response
The cluster's aggregated Kyverno policy-report rollup (per-policy pass/warn/fail counts with top offending namespaces) plus the stored audit/enforce mode; not_available with a detail when Kyverno has published nothing.
Show child attributes
Show child attributes
audit, enforce available, not_available Show child attributes
Show child attributes
The platform's own evaluation of the cluster's workloads (Pod Security Standards and configuration-audit checks) from the resource cache. policies lists the whole check catalogue: pass_count counts workloads the check applied to and did not fail, fail_count the ones it failed, so a check nothing failed shows as passing and a check that applied to nothing shows 0/0. not_available with a detail means the cache is not fully synced or could not be read, never that nothing was found. pod_security is the enforcement half of the block: what the cluster's stored pod-security manifest declares and how many namespaces carry the Pod Security Admission labels.
Show child attributes
Show child attributes