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/{clusterid}/policies/{policyname}
Content-type: application/json
{
"action": "warn",
"namespaces": ["test2"],
"instance_name": "allowed-repos-cbhhb",
"parameters": {
"repos": [
"registry.cn-beijing.aliyuncs.com/acs/",
"registry.cn-hangzhou.aliyuncs.com/acs/"
]
}
}'
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. |
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/c1231xxxxx/policies/ACKAllowedRepos Common request header
{
"action": "warn",
"namespaces": ["test2"],
"instance_name": "allowed-repos-cbhhb",
"parameters": {
"repos": [
"registry.cn-beijing.aliyuncs.com/acs/",
"registry.cn-hangzhou.aliyuncs.com/acs/"
]
}
}'
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.