post https://{accountName}.{environment}.com.br/api/policy-engine/policies/
Creates a new policy from scratch.
Request body object has the following properties:
Attribute | Type | Description |
---|---|---|
name | string | Policy Name |
description | string | Policy description. This description is only for internal use of identification |
statements | array of objects | Requirements to the Policy be applied |
↳ effect | string | This field is not functional at the moment. To create a correct request, fill the field with Allow |
↳ actions | array of objects | Actions that the Policy will execute |
↳↳ id | string | Action ID. The possible values can be SendSlackMessage , SendEmail , and DeactivatePromotions |
↳↳ metadata | object | Data inside of the actions |
↳ resource | string | Scope on which this policy must be evaluated |
↳ condition | object | Condition to activate this policy. This object can have a maximum of ten recursive conditions |
↳↳ conditions | array of objects | List of conditions that will activate the policy |
↳↳↳ conditions | array | These are the conditions the actions can have. The possible values are [] , stringEquals , and numericGreaterThan |
↳↳↳ operation | string | The action of the condition. This operation possible values are None , stringEquals , stringEqualsIgnoreCase , numericEquals , numericLessThan , numericLessThanEquals , numericGreaterThan , numericGreaterThanEquals , bool , not , or , and , dateTimeUtcGreaterThan , dateTimeUtcLessThan , and between |
↳↳↳ key | string | The element that will define what the policy will influence. This field has the possible values skuId , brandId , discountPercentage |
↳↳↳ values | array | Value of the key |
↳↳ operation | string | This operation will determine if all the conditions need to be valid or at least one of them if the conditions array is not empty. The possible values to these fields are None , stringEquals , stringEqualsIgnoreCase , numericEquals , numericLessThan , numericLessThanEquals , numericGreaterThan , numericGreaterThanEquals , bool , not , or , and , dateTimeUtcGreaterThan , dateTimeUtcLessThan , and between |
Request body example:
{
"name": "TestAlarmBerenice",
"description": "TesteMarcosPromotionsAlert",
"statements": [
{
"effect": "Allow",
"actions": [
{
"id": "SendSlackMessage",
"metadata": {
"channel": "C01NJFF35R6",
"relatedUsers": [
"URUNDC2NB"
],
"alertDescription": "Avoid selling products from Berenice with a discount greater than 40%."
}
}
],
"resource": "vrn:vtex.promotions-alert:aws-us-east-1:kamila:master:/_v/promotions_alert",
"condition": {
"conditions": [
{
"conditions": [],
"operation": "stringEquals",
"key": "brandId",
"values": [
"2000001"
]
},
{
"conditions": [],
"operation": "numericGreaterThan",
"key": "discountPercentage",
"values": [
"40.00"
]
}
],
"operation": "and"
}
}
]
}
}
Response body example:
200 OK