You can call the ModifyPolicyInstance operation to update a policy instance in a specified Container Service for Kubernetes (ACK) cluster.
Debugging
Request syntax
PUT /clusters/cluster_id/policies/policy_name HTTP/1.1
Content-Type:application/json
{
"action" : "String",
"instance_name" : "String",
"namespaces" : [ "String" ]
}Request parameters
| Parameter | Type | Required | Example | Description |
| cluster_id | String | Yes | c8155823d057948c69a**** | The ID of the cluster that you want to manage. |
| policy_name | String | Yes | ACKAllowedRepos | The name of the policy. |
| Parameter | Type | Required | Example | Description |
| action | String | No | deny | The action of the policy. Valid values:
|
| instance_name | String | No | allowed-repos-cbhhb | The name of the policy instance that you want to update. |
| namespace | String | No | ["test3","test4"] | The applicable scope of the policy instance. Default value: "". This indicates all namespaces in the cluster. |
| parameters | Map | No | "restrictedNamespaces": [ "test" ] | Parameters of the policy instance. For more information about parameter configuration rules, see Predefined security policies of ACK. |
Response syntax
HTTP/1.1 200 OK
Content-Type:application/json
{
"instances" : [ "String" ]
}Response parameters
| Parameter | Type | Example | Description |
| instances | Array of String | [ "allowed-repos-kqxnc" ] | The policy instance that is updated. |
Sample requests
Submit the following sample request to update a policy instance in a specified ACK cluster:
PUT /clusters/c8155823d057948c69a****/policies/ACKAllowedRepos HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json
{
"action" : "deny",
"instance_name" : "allowed-repos-cbhhb",
"namespaces" : [ "[\"test3\",\"test4\"]" ]
}Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyPolicyInstanceResponse>
<instances>allowed-repos-cbhhb</instances>
</ModifyPolicyInstanceResponse>JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"instances" : [ "allowed-repos-cbhhb" ]
}Error codes
For a list of error codes, visit the API Error Center.