policysets

Create, edit and delete Governance policy sets

policysets#list

List all policy sets

Security or
Request
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
per_page
integer <int64> [ 1 .. 100 ]
Default: 50

Number of results per page

Example: per_page=20
page
integer <int64> >= 0
Default: 0

Page number (starting from 0)

Example: page=4
identifierFilter
string
Default: ""

Comma separated List of Identifiers to filter on

Example: identifierFilter=test-projectId1, test-projectId2
searchTerm
string
Default: ""

Filter results by partial name match

Example: searchTerm=poli
sort
string
Default: "name,ASC"

Sort order for results

Enum: "name,ASC" "name,DESC" "updated,ASC" "updated,DESC"
Example: sort=name,DESC
type
string non-empty

Filter results by type

Example: type=pipeline
action
string non-empty

Filter results by action

Example: action=onrun
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Provident fugit molestiae harum.
Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

get/pm/api/v1/policysets
Request samples
Response samples
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    }
]

policysets#create

Create a policy set

Security or
Request
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Magni quidem natus.
Request Body schema: application/json
required
action
required
string non-empty

Action that triggers the policy set

description
string

Description of the policy set

enabled
required
boolean

Only enabled policy sets are evaluated when evaluating by type/action

identifier
required
string non-empty

Identifier for the policy set

name
required
string non-empty

Name of the policy set

type
required
string non-empty

Type of input suitable for the policy set

Responses
201

Created response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

post/pm/api/v1/policysets
Request samples
application/json
{
  • "action": "onrun",
  • "description": "Captures critical production policies",
  • "enabled": true,
  • "identifier": "policyset-1",
  • "name": "Production Policies",
  • "type": "pipeline"
}
Response samples
application/json
{
  • "account_id": "eBqAoNchMLKigC_qZ5EdC",
  • "action": "onrun",
  • "created": 1636669297674,
  • "description": "Captures critical production policies",
  • "enabled": true,
  • "entity_selector": "all_entities_in_scope",
  • "identifier": "policyset-1",
  • "name": "Production Policies",
  • "org_id": "test-org",
  • "policies": [
    ],
  • "project_id": "test-project",
  • "resource_groups": [
    ],
  • "type": "pipeline",
  • "updated": 1636669297674
}

policysets#delete

Delete a policy set by identifier

Security or
Request
path Parameters
identifier
required
string non-empty

Identifier of the policy set

Examples:
policyset-1
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Eligendi quisquam.
Responses
204

No Content response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

delete/pm/api/v1/policysets/{identifier}
Request samples

policysets#find

Find a policy set by identifier

Security or
Request
path Parameters
identifier
required
string non-empty

Identifier of the policy set to retrieve

Examples:
policyset-1
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Voluptas fuga.
Responses
200

OK response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

get/pm/api/v1/policysets/{identifier}
Request samples
Response samples
application/json
{
  • "account_id": "eBqAoNchMLKigC_qZ5EdC",
  • "action": "onrun",
  • "created": 1636669297674,
  • "description": "Captures critical production policies",
  • "enabled": true,
  • "entity_selector": "all_entities_in_scope",
  • "identifier": "policyset-1",
  • "name": "Production Policies",
  • "org_id": "test-org",
  • "policies": [
    ],
  • "project_id": "test-project",
  • "resource_groups": [
    ],
  • "type": "pipeline",
  • "updated": 1636669297674
}

policysets#update

Update a policy set by identifier

Security or
Request
path Parameters
identifier
required
string

Identifier of the policy set

Example: policyset-1
query Parameters
accountIdentifier
string
Default: ""

Harness account ID

Example: accountIdentifier=eBqAoNchMLKigC_qZ5EdC
orgIdentifier
string
Default: ""

Harness organization ID

Example: orgIdentifier=test-org
projectIdentifier
string
Default: ""

Harness project ID

Example: projectIdentifier=test-project
header Parameters
x-api-key
string

Harness PAT key used to perform authorization

Example: Quia et sed.
Request Body schema: application/json
required
action
string non-empty

Action that triggers the policy set

description
string

Description of the policy set

enabled
boolean

Only enabled policy sets are evaluated when evaluating by type/action

entity_selector
string

A string enum value which determines which entities the policy set applies to during evaluation. This feature is not available for all accounts, Contact support if you wish to have it enabled.

Enum: "all_entities_in_scope" "all_entities_in_resource_groups"
name
string

Name of the policy set

Array of objects (Linkedpolicyidentifier)

Policies linked to this policy set

Array of objects (ResourceGroupIdentifier)

Resource groups that contain the resources that this policy set should be evaluated for. Resource groups are not supported for flag or custom policy sets. This feature is not available for all accounts, Contact support if you wish to have it enabled.

type
string

Type of input suitable for the policy set

Responses
204

No Content response.

400

BadRequest: Bad Request response.

401

Unauthorized: Unauthorized response.

403

Forbidden: Forbidden response.

404

NotFound: Not Found response.

500

InternalServer: Internal Server Error response.

502

BadGateway: Bad Gateway response.

patch/pm/api/v1/policysets/{identifier}
Request samples
application/json
{
  • "action": "onrun",
  • "description": "Captures critical production policies",
  • "enabled": true,
  • "entity_selector": "all_entities_in_scope",
  • "name": "Production Policies",
  • "policies": [
    ],
  • "resource_groups": [
    ],
  • "type": "pipeline"
}