Hi @jhabikal21,
There are two options when requesting the results of a policy evaluation for a given run:
- Policy Checks API
- Audit Trails API
The Policy Checks API is probably the best option as you will already have the :run_id
value, so it should be the simplest API call. The API response will be similar to the following:
{
"data": [
{
"id": "polchk-4tNLxoGPb9SF98ug",
"type": "policy-checks",
"attributes": {
"result": {
"result": true,
"passed": 2,
"total-failed": 0,
"hard-failed": 0,
"soft-failed": 0,
"advisory-failed": 0,
"duration-ms": 0,
"sentinel": {
"schema-version": 1,
"data": {
"": {
"can-override": false,
"error": null,
"policies": [
{
"allowed-failure": false,
"error": null,
"policy": "Foo",
"result": true,
"trace": {
"description": "",
"error": null,
"print": "",
"result": true,
"rules": {}
}
}
],
"result": true
},
"sentinel-from-scratch": {
"can-override": false,
"error": null,
"policies": [
{
"allowed-failure": false,
"error": null,
"policy": "sentinel-from-scratch/policy",
"result": true,
"trace": {
"description": "Exercise 09 - Debugging\n",
"error": null,
"print": "",
"result": true,
"rules": {
"main": {
"desc": "This Sentinel policy ensures that server instance type configuration does not violate a list of allowed types.",
"ident": "main",
"position": {
"filename": "./policy.sentinel",
"offset": 583,
"line": 18,
"column": 1
},
"value": []
}
}
}
}
],
"result": true
}
}
}
},
"status": "passed",
"status-timestamps": {
"passed-at": "2021-06-02T22:09:26+00:00",
"queued-at": "2021-06-02T22:09:25+00:00"
},
"permissions": {
"can-override": true
},
"actions": {
"is-overridable": false
},
"scope": "organization"
},
"relationships": {
"run": {
"data": {
"id": "run-xmmk1JMtETYv7wUi",
"type": "runs"
}
}
},
"links": {
"output": "/api/v2/policy-checks/polchk-4tNLxoGPb9SF98ug/output"
}
}
]
}