All Products
Search
Document Center

Cloud Enterprise Network:AddTrafficMatchRuleToTrafficMarkingPolicy

Last Updated:Mar 25, 2024

Adds a traffic classification rule to a traffic marking policy.

Operation description

AddTrafficMatchRuleToTrafficMarkingPolicy is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the ListTrafficMarkingPolicies operation 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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 keyAssociated operation
cen:AddTrafficMatchRuleToTrafficMarkingPolicyWrite
  • CenInstance
    acs:cen:*:{#accountId}:ceninstance/*
    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.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different.
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 format, 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****
TrafficMatchRulesobject []No

The traffic classification rules.

You can add at most 50 traffic classification rules in each call.

MatchDscpintegerNo

The Differentiated Services Code Point (DSCP) value that is used to match packets. Valid values: 0 to 63.

Packets that carry the specified DSCP value are considered a match. If you do not specify a DSCP value, 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.
5
DstCidrstringNo

The destination CIDR block that is used to match packets.

Packets whose destination IP addresses fall into the specified destination CIDR block are considered a match. If you do not specify a destination CIDR block, packets are considered a match regardless of the destination IP address.

10.10.10.0/24
TrafficMatchRuleDescriptionstringNo

The description of the traffic classification rule.

This parameter is optional. If you enter a description, it must be 1 to 256 characters in length, and cannot start with http:// or https://.

desctest
ProtocolstringNo

The protocol that is used to match packets.

Traffic classification rules support the following protocols: HTTP, HTTPS, TCP, UDP, SSH, and Telnet. For more information, log on to the Cloud Enterprise Network (CEN) console.

Some protocols use a specific port. Click to view protocols and ports.

  • If the protocol is ICMP, set the destination port to -1.
  • If the protocol is GRE, set the destination port to -1.
  • If the protocol is SSH, set the destination port to 22.
  • If the protocol is Telnet, set the destination port to 23.
  • If the protocol is HTTP, set the destination port to 80.
  • If the protocol is HTTPS, set the destination port to 443.
  • If the protocol is MS SQL, set the destination port to 1443.
  • If the protocol is Oracle, set the destination port to 1521.
  • If the protocol is Mysql, set the destination port to 3306.
  • If the protocol is RDP, set the destination port to 3389.
  • If the protocol is Postgre SQL, set the destination port to 5432.
  • If the protocol is Redis, set the destination port to 6379.
HTTP
DstPortRangearrayNo

The destination port range that is used to match packets. Valid values: -1 and 1 to 65535.

Packets whose destination ports fall into the specified destination port range are considered a match. If you do not specify destination port range, packets are considered a match regardless of the destination port.

You can specify at most two port numbers for this parameter. Take note of the following rules:

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

The destination port range that is used to match packets. Valid values: -1 and 1 to 65535.

Packets whose destination ports fall into the specified destination port range are considered a match. If you do not specify a destination port range, packets are considered a match regardless of the destination port.

You can enter at most two port numbers. Take note of the following rules:

  • If you enter only one port number, such as 1, packets whose destination port is 1 are considered a match.
  • If you enter two port numbers, such as 1 and 200, packets whose destination ports fall into 1 and 200 are considered a match.
  • 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.
80
SrcCidrstringNo

The source CIDR block that is used to match packets.

Packets whose source IP addresses fall into the specified source CIDR block are considered a match. If you do not specify a source CIDR block, packets are considered a match regardless of the source IP address.

192.168.10.0/24
SrcPortRangearrayNo

The source port range that is used to match packets. Valid values: -1 and 1 to 65535.

Packets whose source ports fall into the specified source port range are considered a match. If you do not specify a source port range, packets are considered a match regardless of the source port.

You can enter at most two port numbers. Take note of the following rules:

  • If you enter only one port number, such as 1, packets whose source port is 1 are considered a match.
  • If you enter two port numbers, such as 1 and 200, packets whose source ports fall into 1 and 200 are considered a match.
  • 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.
integerNo

The source port range that is used to match packets. Valid values: -1 and 1 to 65535.

Packets whose source ports fall into the specified source port range are considered a match. If you do not specify a source port range, packets are considered a match regardless of the source port.

You can enter at most two port numbers. Take note of the following rules:

  • If you enter only one port number, such as 1, packets whose source port is 1 are considered a match.
  • If you enter two port numbers, such as 1 and 200, packets whose source ports fall into 1 and 200 are considered a match.
  • 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.
200
TrafficMatchRuleNamestringNo

The name of the traffic classification rule.

The name can be empty or 1 to 128 characters in length, and cannot start with http:// or https://.

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.
400IllegalParam.SrcCidrThe specified SrcCidr is invalid.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.DstCidrThe specified DstCidr is invalid.The error message returned because the specified destination CIDR block (DstCidr) is invalid.
400IllegalParam.ProtocolThe specified Protocol is invalid.The error message returned because the specified protocol is invalid.
400Duplicated.TrafficMatchRulesThe parameter AddTrafficMatchRules are duplicated.-
400InstanceExist.TrafficMatchRulesThe instance already exists.The error message returned because the specified traffic match rules (TrafficMatchRules) already exist.
400MissingParam.TrafficMatchRulesThe parameter TrafficMatchRules is empty.-
400InvalidParameterInvalid parameter.The error message returned because the parameter is set to an invalid value.
400UnauthorizedThe AccessKeyId is unauthorized.The error message returned because you do not have the permissions to perform this operation.

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

Change history

Change timeSummary of changesOperation
2024-03-15The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-08-04The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-01-09The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change