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
accountIdentifierstringOptionalDefault:
Harness account ID
""Example: eBqAoNchMLKigC_qZ5EdCorgIdentifierstringOptionalDefault:
Harness organization ID
""Example: test-orgprojectIdentifierstringOptionalDefault:
Harness project ID
""Example: test-projectHeader parameters
x-api-keystringOptionalExample:
Harness PAT key used to perform authorization
Non eveniet.Responses
200
OK response.
application/json
Example policies and input
descstringRequiredExample:
Longer description of the example
This is a pipeline exampleinputstringRequiredExample:
Example input to illustrate the rego policy
{"message": "everyone"}namestringRequiredExample:
Example name
Pipeline exampleregostringRequiredExample:
Example rego policy
package test deny["should say hello world"] {input.message != "world"}typestringRequiredExample:
The type of entity illustrated in this example
pipeline400
BadRequest: Bad Request response.
application/vnd.goa.error
401
Unauthorized: Unauthorized response.
application/vnd.goa.error
403
Forbidden: Forbidden response.
application/vnd.goa.error
404
NotFound: Not Found response.
application/vnd.goa.error
500
InternalServer: Internal Server Error response.
application/vnd.goa.error
502
BadGateway: Bad Gateway response.
application/vnd.goa.error
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?