Policies

The Policy resource

A policy provides details of a single OPA policy as declared in scalr-policy.hcl.

Key path

Description

type* (string)

Available values: policies

id (string)

attributes.enabled (boolean)

If set to false, the policy will not be evaluated during a run.

attributes.enforced-level (string)

Available values: hard-mandatory, soft-mandatory, advisory

The policy’s enforcement level.

  • hard-mandatory - cannot be overridden.

  • soft-mandatory - can be overridden through an approval by account admins and other authorized roles.

  • advisory - provides a warning only.

attributes.name (string)

The name of the policy.

relationships.policy-group (object)

The policy group this policy belongs to.

relationships.policy-group.data.type* (string)

Available values: policy-groups

relationships.policy-group.data.id* (string)

links.self (string)

Get a Policy

GET /policies/{policy}

Show details of a specific OPA policy.

Parameters
  • policy (string) – The ID of the policy to show.

Example Request:

GET /policies/{policy} HTTP/1.1
Host: my.scalr.io
Prefer: profile=preview
Status Codes
  • 200 OK – Success.

  • 403 Forbidden – User unauthorized to perform this action.

  • 404 Not Found – User not authorized or policy not found.

  • 4XX – Client error.

  • 5XX – Server error.

Request Headers
  • Prefer – Specifies the API profile that server should use to handle this request. For the list of supported profiles check out the Scalr documentation. (Required)