Updated on 2026-01-06 GMT+08:00

Creating a Policy

Function

Create a policy.

Calling Method

For details, see Calling APIs.

URI

POST /v1/cnad/policies

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Content-Type

Yes

String

Content-Type

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Policy name.

package_id

Yes

String

Instance ID.

description

No

String

Description

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Policy ID.

name

String

Policy name.

package_id

String

Instance ID.

description

String

Description

clean_threshold

Integer

Cleaning threshold.

Example Requests

Create a protection policy named name for the instance with ID 0c613ff9-2b63-4aa2-9333-e03541fe0d9a.

POST https://{endpoint}/v1/cnad/policies

{
  "name" : "name",
  "package_id" : "0c613ff9-2b63-4aa2-9333-e03541fe0d9a",
  "description" : ""
}

Example Responses

Status code: 200

OK

{
  "id" : "0c613ff9-2b63-4aa2-9333-e03541fe0d9a",
  "name" : "Name",
  "package_id" : "0c613ff9-2b63-4aa2-9333-e03541fe0d9a",
  "description" : "Description",
  "clean_threshold" : 100
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.