1.7. Policy API
1.7.1. Overview 复制链接链接已复制到粘贴板!
This documentation is for the Policy resource for Red Hat Advanced Cluster Management for Kubernetes. The Policy resource has four possible requests: create, query, delete and update.
1.7.1.1. Version information 复制链接链接已复制到粘贴板!
Version : 2.0.0
1.7.1.2. Contact information 复制链接链接已复制到粘贴板!
Contact Email : apiteam@swagger.io
1.7.1.3. License information 复制链接链接已复制到粘贴板!
License : Apache 2.0
License URL : http://www.apache.org/licenses/LICENSE-2.0.html
Terms of service : http://swagger.io/terms/
1.7.1.4. URI scheme 复制链接链接已复制到粘贴板!
BasePath : /kubernetes/apis
Schemes : HTTPS
1.7.1.5. Tags 复制链接链接已复制到粘贴板!
- policy.open-cluster-management.io/v1 : Create and manage policies
1.7.1.6. External Docs 复制链接链接已复制到粘贴板!
Description : Find out more about Swagger.
URL : http://swagger.io
1.7.2. Paths 复制链接链接已复制到粘贴板!
1.7.2.1. Create a policy 复制链接链接已复制到粘贴板!
POST /policy.open-cluster-management.io/v1/v1alpha1/namespaces/{namespace}/policies/{policy_name}
1.7.2.1.1. Description 复制链接链接已复制到粘贴板!
Create a policy.
1.7.2.1.2. Parameters 复制链接链接已复制到粘贴板!
| Type | Name | Description | Schema |
|---|---|---|---|
| Header |
COOKIE | Authorization: Bearer {ACCESS_TOKEN} ; ACCESS_TOKEN is the user access token. | string |
| Path |
namespace | Namespace that you want to use, for example, default. | string |
| Body |
body | Parameters describing the policy to be created. |
1.7.2.1.3. Responses 复制链接链接已复制到粘贴板!
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Success | No Content |
| 403 | Access forbidden | No Content |
| 404 | Resource not found | No Content |
| 500 | Internal service error | No Content |
| 503 | Service unavailable | No Content |
1.7.2.1.4. Consumes 复制链接链接已复制到粘贴板!
-
application/json
1.7.2.1.5. Tags 复制链接链接已复制到粘贴板!
- policy.open-cluster-management.io
1.7.2.1.6. Example HTTP request 复制链接链接已复制到粘贴板!
1.7.2.1.6.1. Request body 复制链接链接已复制到粘贴板!
{
"apiVersion": "policy.open-cluster-management.io/v1/v1alpha1",
"kind": "Policy",
"metadata": {
"name": "test-policy-swagger",
"description": "Example body for Policy API Swagger docs"
},
"spec": {
"remediationAction": "enforce",
"namespaces": {
"include": [
"default"
],
"exclude": [
"kube*"
]
},
"policy-templates": {
"kind": "ConfigurationPolicy",
"apiVersion": "policy.open-cluster-management.io/v1alpha1",
"complianceType": "musthave",
"metadata": {
"namespace": null,
"name": "test-role"
},
"selector": {
"matchLabels": {
"cloud": "IBM"
}
},
"spec" : {
"object-templates": {
"complianceType": "mustHave",
"objectDefinition": {
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "Role",
"metadata": {
"name": "role-policy",
},
"rules": [
{
"apiGroups": [
"extensions",
"apps"
],
"resources": [
"deployments"
],
"verbs": [
"get",
"list",
"watch",
"delete"
]
},
{
"apiGroups": [
"core"
],
"resources": [
"pods"
],
"verbs": [
"create",
"update",
"patch"
]
},
{
"apiGroups": [
"core"
],
"resources": [
"secrets"
],
"verbs": [
"get",
"watch",
"list",
"create",
"delete",
"update",
"patchß"
],
},
],
},
},
},
},
1.7.2.2. Query all policies 复制链接链接已复制到粘贴板!
GET /policy.open-cluster-management.io/v1/v1alpha1/namespaces/{namespace}/policies/{policy_name}
1.7.2.2.1. Description 复制链接链接已复制到粘贴板!
Query your policies for more details.
1.7.2.2.2. Parameters 复制链接链接已复制到粘贴板!
| Type | Name | Description | Schema |
|---|---|---|---|
| Header |
COOKIE | Authorization: Bearer {ACCESS_TOKEN} ; ACCESS_TOKEN is the user access token. | string |
| Path |
namespace | Namespace that you want to apply the policy to, for example, default. | string |
1.7.2.2.3. Responses 复制链接链接已复制到粘贴板!
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Success | No Content |
| 403 | Access forbidden | No Content |
| 404 | Resource not found | No Content |
| 500 | Internal service error | No Content |
| 503 | Service unavailable | No Content |
1.7.2.2.4. Consumes 复制链接链接已复制到粘贴板!
-
application/json
1.7.2.2.5. Tags 复制链接链接已复制到粘贴板!
- policy.open-cluster-management.io
1.7.2.3. Query a single policy 复制链接链接已复制到粘贴板!
GET /policy.open-cluster-management.io/v1/v1alpha1/namespaces/{namespace}/policies/{policy_name}
1.7.2.3.1. Description 复制链接链接已复制到粘贴板!
Query a single policy for more details.
1.7.2.3.2. Parameters 复制链接链接已复制到粘贴板!
| Type | Name | Description | Schema |
|---|---|---|---|
| Header |
COOKIE | Authorization: Bearer {ACCESS_TOKEN} ; ACCESS_TOKEN is the user access token. | string |
| Path |
policy_name | Name of the policy that you want to query. | string |
| Path |
namespace | Namespace that you want to use, for example, default. | string |
1.7.2.3.3. Responses 复制链接链接已复制到粘贴板!
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Success | No Content |
| 403 | Access forbidden | No Content |
| 404 | Resource not found | No Content |
| 500 | Internal service error | No Content |
| 503 | Service unavailable | No Content |
1.7.2.3.4. Tags 复制链接链接已复制到粘贴板!
- policy.open-cluster-management.io
1.7.2.4. Delete a policy 复制链接链接已复制到粘贴板!
DELETE /policy.open-cluster-management.io/v1/v1alpha1/namespaces/{namespace}/policies/{policy_name}
1.7.2.4.1. Parameters 复制链接链接已复制到粘贴板!
| Type | Name | Description | Schema |
|---|---|---|---|
| Header |
COOKIE | Authorization: Bearer {ACCESS_TOKEN} ; ACCESS_TOKEN is the user access token. | string |
| Path |
policy_name | Name of the policy that you want to delete. | string |
| Path |
namespace | Namespace that you want to use, for example, default. | string |
1.7.2.4.2. Responses 复制链接链接已复制到粘贴板!
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Success | No Content |
| 403 | Access forbidden | No Content |
| 404 | Resource not found | No Content |
| 500 | Internal service error | No Content |
| 503 | Service unavailable | No Content |
1.7.2.4.3. Tags 复制链接链接已复制到粘贴板!
- policy.open-cluster-management.io
1.7.3. Definitions 复制链接链接已复制到粘贴板!
1.7.3.1. Policy 复制链接链接已复制到粘贴板!
| Name | Description | Schema |
|---|---|---|
|
apiVersion | The versioned schema of Policy. | string |
|
kind | String value that represents the REST resource. | string |
|
metadata | Describes rules that define the policy. | object |
spec
| Name | Description | Schema |
|---|---|---|
|
remediationAction | Value that represents how violations are handled as defined in the resource. | string |
|
namespace | Value that represents which namespaces the policy is applied. | string |
policy-templates
| Name | Description | Schema |
|---|---|---|
|
apiVersion | The versioned schema of Policy. | string |
|
kind | String value that represents the REST resource. | string |
|
complianceType | The compliance standard. | string |
|
metadata | Describes rules that define the policy. | object |
|
clusterConditions | Section to define labels. | string |
|
rules | string |
selector
| Name | Description | Schema |
|---|---|---|
|
matchLabels | The label that is required for the policy to be applied to a namespace. | object |
|
cloud | The label that is required for the policy to be applied to a cloud provider. | string |
rules
| Name | Description | Schema |
|---|---|---|
|
apiGroups | List of APIs that the rule applies to. | string |
|
resources | A list of resource types. | object |
|
verbs | A list of verbs. | string |