Evaluate
Perform evaluations
Evaluate arbitrary rego
Harness account ID
""Example: eBqAoNchMLKigC_qZ5EdCHarness organization ID
""Example: test-orgHarness project ID
""Example: test-projectHarness PAT key used to perform authorization
Aut occaecati repellendus illo consequatur dolores.Input to evaluate
{"message":"everyone"}Arbitrary rego to be evaluated
package test deny["should say hello world"] {input.message != "world"}OK response.
The values of any deny rego rules as returned by the rego engine
["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"]Any errors returned by the rego engine when this policy was evaluated
policy.rego:25: rego_parse_error: non-terminated string m == "testThe output returned by the rego engine when this policy was evaluated
{ "deny": [ "deployment stage 'deploy' does not have a HarnessApproval step" ], "stages_with_approval": [] }The severity of the policy that was selected while creating the policyset
Warn & ContinuePossible values: The overall status for this individual policy indicating whether it passed
errorPossible values: LargePayload: Bad Request response.
Unauthorized: Unauthorized response.
Forbidden: Forbidden response.
NotFound: Not Found response.
ScopeInfoError: Internal Server Error response.
BadGateway: Bad Gateway response.
POST /gateway/pm/api/v1/evaluate HTTP/1.1
Host: app.harness.io/
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 117
{
"input": {
"message": "everyone"
},
"rego": "package test\ndeny[\"should say hello world\"] {input.message != \"world\"}"
}{
"deny_messages": [
"deployment stage 'example-stage' does not have a HarnessApproval step",
"deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"
],
"error": "policy.rego:25: rego_parse_error: non-terminated string m == \"test",
"output": "{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}",
"policy": {
"account_id": "eBqAoNchMLKigC_qZ5EdC",
"cache_response": {
"cache_state": "STALE_CACHE",
"is_sync_enabled": true,
"last_updated_at": 1773917288158,
"ttl_left": 258234442
},
"created": 1636669297674,
"git_commit_sha": "1369b45c20fc685113adcfd1a08a914180ff3c0d",
"git_connector_ref": ".",
"git_default_branch": "main",
"git_default_branch_commit_sha": "1369b45c20fc685113adcfd1a08a914180ff3c0d",
"git_default_branch_file_id": "1369b45c20fc685113adcfd1a08a914180ff3c0d",
"git_default_branch_file_url": "",
"git_default_branch_update_error": {
"explanation": "File with given filepath [file.rego] already exists in Github, thus couldn't create a new file",
"hint": "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main].",
"message": "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."
},
"git_default_branch_updated": 1636669297674,
"git_file_id": "1369b45c20fc685113adcfd1a08a914180ff3c0d",
"git_file_url": "",
"git_path": ".harness/policy.rego",
"git_repo": "github.com/org/repo,omitempty",
"identifier": "policy-1",
"name": "Pipeline Approval",
"org_id": "test-org",
"parent_unique_id": "Aperiam quod.",
"polciy_size_in_bytes": 8751929130004460000,
"policy_package_name": "Eum qui praesentium.",
"policy_set_count": 3,
"project_id": "test-project",
"rego": "",
"unique_id": "Ullam quo libero illo officiis id quo.",
"updated": 1636669297674
},
"policy_severity": "Warn & Continue",
"status": "error"
}Last updated
Was this helpful?