Updated on 2025-12-01 GMT+08:00

Obtaining the Policy Definition List

Function

This API is used to obtain the policy definition list.

URI

GET /v1/policydefinitions

Request Parameters

None

Response Parameters

Status code: 200

Table 1 Response body parameters

Parameter

Type

Description

items

Array of UCSConstraintTemplate objects

Constraint template list

kind

String

API type

apiVersion

String

API version

Table 2 UCSConstraintTemplate

Parameter

Type

Description

kind

String

API type. The value is fixed at ConstraintTemplate.

apiVersion

String

API version

metadata

ObjectMeta object

Constraint template metadata

spec

Object

Attribute details of the constraint template

Table 3 ObjectMeta

Parameter

Type

Description

uid

String

Resource ID

name

String

Resource name

generateName

String

If no name is provided, the server uses the prefix to generate a unique name.

namespace

String

Namespace

labels

Map<String,String>

Label

annotations

Map<String,String>

Annotation

creationTimestamp

String

Creation time

updateTimestamp

String

Update time

resourceVersion

String

Internal version of a resource

generation

String

Generation of the desired resource state

managedFields

Array of ManagedFieldsEntry objects

Fields managed by workflows

ownerReferences

Array of OwnerReference objects

Ownership, dependencies, and garbage collection mechanism of objects. It supports resource management by the controller.

Table 4 ManagedFieldsEntry

Parameter

Type

Description

manager

String

Manager name

operation

String

Operation type that causes this entry being created. The value can only be Apply or Update.

apiVersion

String

Resource API version used by a manager for defining fields

time

String

Timestamp when this entry was created or last updated

fieldsType

String

Field structure format. The value is fixed at "FieldsV1".

fieldsV1

Object

Information about the managed fields

Table 5 OwnerReference

Parameter

Type

Description

apiVersion

String

API version of the referent

kind

String

Type of the referent

name

String

Name of the referent

uid

String

UID of the referent

controller

Boolean

If the value is true, this reference points to the controller that manages the resource.

blockOwnerDeletion

Boolean

If the value is true and the owner has a finalizer named foregroundDeletion, the owner cannot be deleted until this reference is removed.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

-

String

-

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

-

String

-

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

-

String

-

Example Requests

None

Example Responses

Status code: 200

Policy definition list obtained

{
  "items" : [ {
    "kind" : "ConstraintTemplate",
    "apiVersion" : "templates.gatekeeper.sh/v1beta1",
    "metadata" : {
      "name" : "k8spspvolumetypes",
      "uid" : "f1519ae2-adf8-11ed-9f9c-0255ac100186",
      "creationTimestamp" : "2023-02-16 12:53:43.050938 +0000 UTC",
      "updateTimestamp" : "2025-11-05 03:29:41.797896 +0000 UTC",
      "annotations" : {
        "description-chinese" : "Restricting the volume mount type used by pods",
        "name-chinese" : "K8sPSPVolumeTypes",
        "tag-chinese" : "Container/Application security policy"
      }
    },
    "spec" : {
      "type" : "security",
      "tag" : "k1",
      "officialTag" : "Container/ApplicationSecurityPolicies",
      "level" : "3",
      "targetKind" : "Pod",
      "official" : true,
      "description" : "Restricts mountable volume types to those specified by the user. Corresponds to the `volumes` field in a PodSecurityPolicy.",
      "constraintTemplate" : {
        "kind" : "ConstraintTemplate",
        "apiVersion" : "templates.gatekeeper.sh/v1",
        "metadata" : {
          "name" : "k8spspvolumetypes",
          "creationTimestamp" : null,
          "annotations" : {
            "description" : "Restricts mountable volume types to those specified by the user. Corresponds to the `volumes` field in a PodSecurityPolicy.",
            "description-chinese" : "Restricting the volume mount type used by pods",
            "level" : "3",
            "metadata.gatekeeper.sh/title" : "Volume Types",
            "metadata.gatekeeper.sh/version" : "1.0.0",
            "name-chinese" : "K8sPSPVolumeTypes",
            "tag" : "Container/ApplicationSecurityPolicies",
            "tag-chinese" : "Container/Application security policy",
            "targetKind" : "Pod",
            "type" : "security"
          }
        }
      }
    }
  } ]
}

Status Codes

Status Code

Description

200

Policy definition list obtained

400

Client request error. The server could not execute the request.

404

Resources not found

500

Internal server error

Error Codes

See Error Codes.