# evaluate#evaluate

Evaluate arbitrary rego

Endpoint: POST /pm/api/v1/evaluate
Version: 1.0
Security: 

## Query parameters:

  - `accountIdentifier` (string)
    Harness account ID
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `orgIdentifier` (string)
    Harness organization ID
    Example: "test-org"

  - `projectIdentifier` (string)
    Harness project ID
    Example: "test-project"

## Header parameters:

  - `x-api-key` (string)
    Harness PAT key used to perform authorization
    Example: "Rerum itaque earum consequatur odit et."

## Request fields (application/json):

  - `input` (any, required)
    Input to evaluate
    Example: {"message":"everyone"}

  - `rego` (string, required)
    Arbitrary rego to be evaluated
    Example: "package test\ndeny[\"should say hello world\"] {input.message != \"world\"}"

## Response 200 fields (application/json):

  - `deny_messages` (array, required)
    The values of any deny rego rules as returned by the rego engine
    Example: ["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"]

  - `error` (string, required)
    Any errors returned by the rego engine when this policy was evaluated
    Example: "policy.rego:25: rego_parse_error: non-terminated string m == \"test"

  - `output` (any, required)
    The output returned by the rego engine when this policy was evaluated
    Example: "{\n    \"deny\": [\n        \"deployment stage 'deploy' does not have a HarnessApproval step\"\n    ],\n    \"stages_with_approval\": []\n}"

  - `policy` (object, required)
    Example: {"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":"Eius voluptates maxime.","polciy_size_in_bytes":696467044857856100,"policy_package_name":"Dolorem tempore repellat.","policy_set_count":3,"project_id":"test-project","rego":"","unique_id":"Molestiae numquam consequatur aut temporibus rerum.","updated":1636669297674}

  - `policy.account_id` (string, required)
    Harness account ID associated with this policy
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `policy.cache_response` (object)
    Cache metadata from GitX getFile RPC
    Example: {"cache_state":"STALE_CACHE","is_sync_enabled":true,"last_updated_at":1773917288158,"ttl_left":258234442}

  - `policy.cache_response.cache_state` (string)
    Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)
    Example: "STALE_CACHE"

  - `policy.cache_response.is_sync_enabled` (boolean)
    Whether sync is enabled for this resource
    Example: true

  - `policy.cache_response.last_updated_at` (integer)
    Timestamp (millis) when cache was last updated
    Example: 1773917288158

  - `policy.cache_response.ttl_left` (integer)
    Remaining time-to-live in milliseconds
    Example: 258234442

  - `policy.created` (integer, required)
    Time the policy was created
    Example: 1636669297674

  - `policy.git_commit_sha` (string)
    The commit sha of the commit that last effected the file
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `policy.git_connector_ref` (string)
    The harness connector used for authenticating on the git provider
    Example: "."

  - `policy.git_default_branch` (string)
    The default branch, the service pulls in changes from this branch for policy evaluation
    Example: "main"

  - `policy.git_default_branch_commit_sha` (string)
    The commit sha of the commit that last effected the file in the default branch
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `policy.git_default_branch_file_id` (string)
    The file id of the file in the default branch, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `policy.git_default_branch_file_url` (string)
    The url of the file in the default branch

  - `policy.git_default_branch_update_error` (object)
    Example: {"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]."}

  - `policy.git_default_branch_update_error.explanation` (string, required)
    the explanation of the error
    Example: "File with given filepath [file.rego] already exists in Github, thus couldn't create a new file"

  - `policy.git_default_branch_update_error.hint` (string, required)
    the hint on how to resolve the error
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `policy.git_default_branch_update_error.message` (string, required)
    the message is a human-readable explanation specific to this occurrence of the problem
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `policy.git_default_branch_updated` (integer)
    The last time the service successfully pulled in changes from the default branch
    Example: 1636669297674

  - `policy.git_file_id` (string)
    The file id of the file, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `policy.git_file_url` (string)
    The url of the file on the fit provider

  - `policy.git_path` (string)
    The path to the file in the git repo
    Example: ".harness/policy.rego"

  - `policy.git_repo` (string)
    The git repo the policy resides in
    Example: "github.com/org/repo,omitempty"

  - `policy.identifier` (string, required)
    identifier of the policy
    Example: "policy-1"

  - `policy.name` (string, required)
    Name of the policy
    Example: "Pipeline Approval"

  - `policy.org_id` (string, required)
    Harness organization ID associated with this policy
    Example: "test-org"

  - `policy.parent_unique_id` (string)
    Parent unique identifier for the policy
    Example: "Eius voluptates maxime."

  - `policy.polciy_size_in_bytes` (integer)
    Size of the policy in bytes
    Example: 696467044857856100

  - `policy.policy_package_name` (string)
    Package name of the policy
    Example: "Dolorem tempore repellat."

  - `policy.policy_set_count` (integer)
    Count of policy sets associated with this policy
    Example: 3

  - `policy.project_id` (string, required)
    Harness project ID associated with this policy
    Example: "test-project"

  - `policy.rego` (string, required)
    Rego that defines the policy

  - `policy.unique_id` (string)
    Unique identifier for the policy
    Example: "Molestiae numquam consequatur aut temporibus rerum."

  - `policy.updated` (integer, required)
    Time the policy was last updated
    Example: 1636669297674

  - `policy_severity` (string)
    The severity of the policy that was selected while creating the policyset
    Enum: "Warn & Continue", "Error & Exit"

  - `status` (string, required)
    The overall status for this individual policy indicating whether it passed
    Enum: "error", "warning", "pass", "pending"

## Response 400 fields (application/vnd.goa.error):

  - `fault` (boolean, required)
    Is the error a server-side fault?
    Example: true

  - `id` (string, required)
    ID is a unique identifier for this particular occurrence of the problem.
    Example: "123abc"

  - `message` (string, required)
    Message is a human-readable explanation specific to this occurrence of the problem.
    Example: "parameter 'p' must be an integer"

  - `name` (string, required)
    Name is the name of this class of errors.
    Example: "bad_request"

  - `temporary` (boolean, required)
    Is the error temporary?
    Example: true

  - `timeout` (boolean, required)
    Is the error a timeout?
    Example: true


