All Products
Search
Document Center

Cloud Enterprise Network:AddTraficMatchRuleToTrafficMarkingPolicy

Last Updated:Apr 11, 2023

Adds a traffic classification rule to a traffic marking policy.

Operation Description

Usage notes

The AddTraficMatchRuleToTrafficMarkingPolicy operation is deprecated and will be discontinued soon. If you need to add a traffic classification rule to a traffic marking policy, call the AddTrafficMatchRuleToTrafficMarkingPolicy operation.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociation operation
cen:AddTraficMatchRuleToTrafficMarkingPolicy
  • CEN
    acs:cen:*:{#accountId}:ceninstance/{#CenId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

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. The token can contain only ASCII characters.

NoteIf you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each request.
123e4567-e89b-12d3-a456-426****
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request syntax, and limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and sends the request.
false
TrafficMarkingPolicyIdstringYes

The ID of the traffic marking policy.

tm-u9nxup5kww5po8****
TrafficMatchRulesarrayNo

The information about the traffic classification rule.

You can specify at most 50 traffic classification rules.

objectNo

The description of the traffic classification rule.

MatchDscpintegerNo

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.

NoteThe DSCP value that you specify for this parameter is the DSCP value that packets carry before they are transmitted over the inter-region connection.

You can specify at most 50 traffic classification rules.

5
DstCidrstringNo

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.

You can specify at most 50 traffic classification rules.

10.10.10.0/24
TrafficMatchRuleDescriptionstringNo

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.

You can specify at most 50 traffic classification rules.

desctest
ProtocolstringNo

The protocol that is used to match packets.

Valid values: HTTP, HTTPS, TCP, UDP, SSH, and Telnet. For more information, log on to the Cloud Enterprise Network (CEN) console.

You can specify at most 50 traffic classification rules.

HTTP
DstPortRangearrayNo

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 specify at most two ports. Take note of the following rules:

  • If you enter only one port number such as 1, the system matches the packets whose destination port is port 1.
  • If you enter two port numbers such as 1 and 200, the system matches the packets whose destination ports fall between 1 and 200.
  • If you enter two port numbers and one of them is -1, the other port number must also be -1. In this case, packets are considered a match regardless of the destination port.

You can specify at most 50 traffic classification rules.

integerNo

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 specify at most two ports. Take note of the following rules:

  • If you enter only one port number such as 1, the system matches the packets whose destination port is port 1.
  • If you enter two port numbers such as 1 and 200, the system matches the packets whose destination ports fall between 1 and 200.
  • If you enter two port numbers and one of them is -1, the other port number must also be -1. In this case, packets are considered a match regardless of the destination port.

You can specify at most 50 traffic classification rules.

80
SrcCidrstringNo

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.

You can specify at most 50 traffic classification rules.

192.168.10.0/24
SrcPortRangearrayNo

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 specify at most two ports. Take note of the following rules:

  • If you enter only one port number such as 1, the system matches the packets whose source port is 1.
  • If you enter two port numbers such as 1 and 200, the system matches the packets whose source ports fall between 1 and 200.
  • If you enter two port numbers and one of them is -1, the other port number must also be -1. In this case, packets are considered a match regardless of the source port.

You can specify at most 50 traffic classification rules.

integerNo

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 specify at most two ports. Take note of the following rules:

  • If you enter only one port number such as 1, the system matches the packets whose source port is 1.
  • If you enter two port numbers such as 1 and 200, the system matches the packets whose source ports fall between 1 and 200.
  • If you enter two port numbers and one of them is -1, the other port number must also be -1. In this case, packets are considered a match regardless of the source port.

You can specify at most 50 traffic classification rules.

200
TrafficMatchRuleNamestringNo

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.

You can specify at most 50 traffic classification rules.

nametest

Response parameters

ParameterTypeDescriptionExample
object

The response.

RequestIdstring

The ID of the request.

0876E54E-3E36-5C31-89F0-9EE8A9266F9A

Examples

Sample success responses

JSONformat

{
  "RequestId": "0876E54E-3E36-5C31-89F0-9EE8A9266F9A"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidTrafficMarkingPolicyId.NotFoundOperation is failed because traffic marking policy id is not found.The error message returned because the specified traffic marking policy ID (TrafficMarkingPolicyId) does not exist.
400InstanceExist.TrafficMatchRulesThe instance already exists.The error message returned because the specified traffic match rules (TrafficMatchRules) already exist.
400Duplicated.TrafficMatchRulesThe parameter TrafficMatchRules are duplicated.The error message returned because the traffic match rules (TrafficMatchRules) are duplicate.
400IllegalParam.SrcCidrSrcCidr is illegal.The error message returned because the specified source CIDR block is invalid.
400IncorrectStatus.TrafficMarkingPolicyThe status of TrafficMarkingPolicy is incorrect.The error message returned because the status of the traffic marking policy does not support this operation. Try again later.
400IllegalParam.DstCidrDstCidr is illegal.The error message returned because the specified destination CIDR block (DstCidr) is invalid.
400IllegalParam.ProtocolProtocol is illegal.The error message returned because the specified protocol is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-01-09The error codes of the API operation change.
Change itemChange content
Error CodesThe error codes of the API operation change.
    Error Codes 400 change
2022-09-19The API operation is deprecated.,The error codes of the API operation change.
Change itemChange content
API Deprecation DescriptionThe API operation is deprecated.
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
2021-11-26Add Operation