Adds a traffic classification rule to a traffic marking policy.
Usage notes
AddTrafficMatchRuleToTrafficMarkingPolicy is an asynchronous operation. After you send a request, the request ID is returned but the operation is still being performed in the system background. You can call ListTrafficMarkingPolicies to query the status of a traffic classification rule.
- If a traffic classification rule is in the Creating state, the traffic classification rule is being created. In this case, you can query the traffic classification rule but cannot perform other operations.
- If a traffic classification rule is in the Active state, the traffic classification rule is added to the traffic marking policy.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | AddTrafficMatchRuleToTrafficMarkingPolicy |
The operation that you want to perform. Set the value to AddTrafficMatchRuleToTrafficMarkingPolicy. |
| ClientToken | String | No | 123e4567-e89b-12d3-a456-426**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken can contain only ASCII characters. Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
|
| DryRun | Boolean | No | false |
Specifies whether only to precheck the request. Valid values:
|
| TrafficMarkingPolicyId | String | Yes | tm-u9nxup5kww5po8**** |
The ID of the traffic marking policy. |
| TrafficMatchRules.N.MatchDscp | Integer | No | 5 |
The differentiated services code point (DSCP) value that is used to match packets. Valid values: 0 to 63. The traffic classification rule matches the packets that contain the specified DSCP value. If you do not set this parameter, packets are considered a match regardless of the DSCP value. Note The DSCP value that you specify for this parameter is the DSCP value that packets
carry before they are transmitted over the inter-region connection.
|
| TrafficMatchRules.N.DstCidr | String | No | 10.10.10.0/24 |
The destination CIDR block that is used to match packets. The traffic classification rule matches the packets whose destination IP addresses fall within the specified destination CIDR block. If you do not set this parameter, packets are considered a match regardless of the DSCP value. |
| TrafficMatchRules.N.TrafficMatchRuleDescription | String | No | desctest |
The description of the traffic classification rule. The description must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The description must start with a letter. |
| TrafficMatchRules.N.Protocol | String | No | HTTP |
The protocol used to match data packets. Valid values: HTTP, HTTPS, TCP, UDP, SSH, and Telnet. For more information, log on to the CEN console. |
| TrafficMatchRules.N.DstPortRange.N | Integer | No | 80 |
The destination port range that is used to match packets. Valid values: -1 and 1 to 65535. The traffic classification rule matches the packets whose destination ports fall within the destination port range. If you do not set this parameter, packets are considered a match regardless of the DSCP value. You can enter up to two port numbers. Take note of the following rules:
|
| TrafficMatchRules.N.SrcCidr | String | No | 192.168.10.0/24 |
The source CIDR block that is used to match packets. The traffic classification rule matches the packets whose source IP addresses fall within the specified source CIDR block. If you do not set this parameter, packets are considered a match regardless of the source IP address. |
| TrafficMatchRules.N.SrcPortRange.N | Integer | No | 200 |
The source port range that is used to match packets. Valid values: -1 and 1 to 65535. The traffic classification rule matches the packets whose source ports fall within the source port range. If you do not set this parameter, packets are considered a match regardless of the source port. You can enter up to two port numbers. Take note of the following rules:
|
| TrafficMatchRules.N.TrafficMatchRuleName | String | No | nametest |
The name of the traffic classification rule. The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| RequestId | String | 0876E54E-3E36-5C31-89F0-9EE8A9266F9A |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=AddTraficMatchRuleToTrafficMarkingPolicy
&ClientToken=123e4567-e89b-12d3-a456-426****
&DryRun=false
&TrafficMarkingPolicyId=tm-u9nxup5kww5po8****
&TrafficMatchRules=[{"MatchDscp":5,"DstCidr":"10.10.10.0/24","TrafficMatchRuleDescription":"desctest","Protocol":"HTTP","DstPortRange":[80],"SrcCidr":"192.168.10.0/24","SrcPortRange":[200],"TrafficMatchRuleName":"nametest"}]
&Common request parameters
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<AddTraficMatchRuleToTrafficMarkingPolicyResponse>
<RequestId>0876E54E-3E36-5C31-89F0-9EE8A9266F9A</RequestId>
</AddTraficMatchRuleToTrafficMarkingPolicyResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0876E54E-3E36-5C31-89F0-9EE8A9266F9A"
}
Error codes
For a list of error codes, visit the API Error Center.