You can call the DeployPolicyInstance operation to deploy a policy instance in a specified Container Service for Kubernetes (ACK) cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers. For more information, refer to the documentation of common request parameters.

Request syntax

POST /clusters/{cluster_id}/policies/{policy_name} HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
cluster_id String Path Yes c8155823d057948c69a****

The ID of the cluster that you want to query.

policy_name String Path Yes ACKNoEnvVarSecrets

The name of the policy.

Object Body No

The structure of the request.

action String Body No deny

The action of the policy. Valid values:

  • deny: Deployments that match the policy are denied.
  • warn: Alerts are generated for Deployments that match the policy.
parameters Map Body No null

The parameters of the policy instance.

Response parameters

Parameter Type Example Description
instances Array of String [ "allowed-repos-kqxnc" ]

The policy instance that is deployed.

Examples

Sample requests

POST /clusters/c1231xxxxx/policies/ACKAllowedRepos  Common request header

{
	"action": "deny",
	"namespaces": ["test3","test4"],
	"parameters": {
		"repos": [
			"registry.cn-beijing.aliyuncs.com/acs/",
			"registry.cn-beijing.aliyuncs.com/acs/"
		]
	}
}

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DeployPolicyInstanceResponse>
    <instances>allowed-repos-kqxnc</instances>
</DeployPolicyInstanceResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "instances" : [ "allowed-repos-kqxnc" ]
}

Error codes

For a list of error codes, visit the API Error Center.