For the complete documentation index, see llms.txt. This page is also available as Markdown.

Examples

Example rego policies and corresponding input

get

list examples

Required scopes
This endpoint requires the following scopes:
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
accountIdentifierstringOptional

Harness account ID

Default: ""Example: eBqAoNchMLKigC_qZ5EdC
orgIdentifierstringOptional

Harness organization ID

Default: ""Example: test-org
projectIdentifierstringOptional

Harness project ID

Default: ""Example: test-project
Header parameters
x-api-keystringOptional

Harness PAT key used to perform authorization

Example: Non eveniet.
Responses
200

OK response.

application/json

Example policies and input

descstringRequired

Longer description of the example

Example: This is a pipeline example
inputstringRequired

Example input to illustrate the rego policy

Example: {"message": "everyone"}
namestringRequired

Example name

Example: Pipeline example
regostringRequired

Example rego policy

Example: package test deny["should say hello world"] {input.message != "world"}
typestringRequired

The type of entity illustrated in this example

Example: pipeline
get/api/v1/examples
GET /gateway/pm/api/v1/examples HTTP/1.1
Host: app.harness.io/
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "desc": "This is a pipeline example",
    "input": "{\"message\": \"everyone\"}",
    "name": "Pipeline example",
    "rego": "package test\ndeny[\"should say hello world\"] {input.message != \"world\"}",
    "type": "pipeline",
    "variables": [
      {
        "default": [
          "JiraUpdate",
          "HarnessApproval"
        ],
        "desc": "The required steps that the policy enforces",
        "id": "requiredsteps",
        "name": "Required Steps",
        "type": "selectOne",
        "values": [
          "JiraUpdate",
          "HarnessApproval"
        ]
      },
      {
        "default": [
          "JiraUpdate",
          "HarnessApproval"
        ],
        "desc": "The required steps that the policy enforces",
        "id": "requiredsteps",
        "name": "Required Steps",
        "type": "selectOne",
        "values": [
          "JiraUpdate",
          "HarnessApproval"
        ]
      }
    ]
  },
  {
    "desc": "This is a pipeline example",
    "input": "{\"message\": \"everyone\"}",
    "name": "Pipeline example",
    "rego": "package test\ndeny[\"should say hello world\"] {input.message != \"world\"}",
    "type": "pipeline",
    "variables": [
      {
        "default": [
          "JiraUpdate",
          "HarnessApproval"
        ],
        "desc": "The required steps that the policy enforces",
        "id": "requiredsteps",
        "name": "Required Steps",
        "type": "selectOne",
        "values": [
          "JiraUpdate",
          "HarnessApproval"
        ]
      },
      {
        "default": [
          "JiraUpdate",
          "HarnessApproval"
        ],
        "desc": "The required steps that the policy enforces",
        "id": "requiredsteps",
        "name": "Required Steps",
        "type": "selectOne",
        "values": [
          "JiraUpdate",
          "HarnessApproval"
        ]
      }
    ]
  }
]

Last updated

Was this helpful?