Creating a Policy
Function
This API is used to create a policy.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{cloudProjectId}/rule-sets/create
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cloudProjectId |
Yes |
String |
Definition: Project ID. Constraints: N/A Value range: The value consists of 32 characters, including digits and letters. Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Definition: Policy name. Constraints: The policy name can contain only letters, digits, hyphens (-), and underscores (_). Value range: Enter a maximum of 128 characters. Default value: N/A |
cloud_project_id |
Yes |
String |
Definition: Project ID. Constraints: N/A Value range: The value consists of 32 characters, including digits and letters. Default value: N/A |
rules |
Yes |
Array of rules objects |
Definition: Rule details. Constraints: N/A Value range: No more than 20 rules. Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Definition: Rule ID. Constraints: N/A Value range: The value consists of 32 characters, including digits and letters. Default value: N/A |
is_valid |
Yes |
Boolean |
Definition: Whether to enable the rule. Constraints: N/A Value range:
Default value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
status |
Boolean |
Definition: Whether the update is successful. Value range:
|
rule_set_id |
String |
Definition: Policy ID. Value range: The value consists of 32 characters, including digits and letters. |
Example Requests
POST https://{endpoint}/v2/2d09f712e9504b61b034cc8f40e475a8/rule-sets/create { "name" : "New policy-20240625200400", "cloud_project_id" : "2d09f712e9504b61b034cc8f40e475a8", "rules" : [ { "id" : "597c7f2f775740a1bb522b03a16e6864", "is_valid" : true } ] }
Example Responses
Status code: 200
Response body for creating a policy.
{ "status" : true, "rule_set_id" : "e42be82e7d514437a322dce4d42bdec8" }
Status Codes
Status Code |
Description |
---|---|
200 |
Response body for creating a policy. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot