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
|
Parameter |
Type |
Description |
|---|---|---|
|
items |
Array of UCSConstraintTemplate objects |
Constraint template list |
|
kind |
String |
API type |
|
apiVersion |
String |
API version |
|
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 |
|
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. |
|
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 |
|
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
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 500
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot