Creates a traffic classification rule for a quality of service (QoS) policy.

Prerequisites

A traffic throttling rule is created. For more information, see CreateQosCar.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameter

Parameter Type Required Example Description
Action String Yes CreateQosPolicy

The operation that you want to perform. Set the value to CreateQosPolicy.

Description String No desctest

The description of the traffic classification rule.

The description must be 1 to 512 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.

RegionId String Yes cn-shanghai

The ID of the region to which the QoS policy belongs.

QosId String Yes qos-xitd8690ucu8ro****

The ID of the QoS policy.

Priority Integer Yes 3

The priority of the traffic throttling policy to which the traffic classification rule belongs.

Valid values: 1 to 3. A smaller value indicates a higher priority.

SourceCidr String Yes 10.10.10.0/24

The source CIDR block.

Specify the value of this parameter in CIDR notation. Example: 192.168.1.0/24.

DestCidr String Yes 10.10.20.0/24

The destination CIDR block.

Specify the value of this parameter in CIDR notation. Example: 192.168.10.0/24.

IpProtocol String Yes TCP

The type of the protocol that applies to the traffic classification rule.

The supported protocols provided in this topic are for reference only. The actual protocols in the console shall prevail.

SourcePortRange String Yes 80/80

The source port range.

Valid values: 1 to 65535 and -1.

Examples:

  • 1/200: a port range from 1 to 200
  • 80/80: port 80
  • -1/-1: all ports
DestPortRange String Yes 80/80

The destination port range.

Valid values: 1 to 65535 and -1.

Examples:

  • 1/200: a port range from 1 to 200
  • 80/80: port 80
  • -1/-1: all ports
StartTime String No 2022-07-14T16:41:33+0800

The time when the traffic classification rule takes effect.

Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss+0800 format. The time must be in UTC+8.

EndTime String No 2022-09-14T16:41:33+0800

The time when the traffic classification rule expires.

Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss+0800 format. The time must be in UTC+8.

Name String No nametest

The name of the traffic classification rule.

The name must be 2 to 100 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.

DpiSignatureIds.N String No 1

The ID of the application.

You can enter at most 100 application IDs at a time.

You can call the ListDpiSignatures operation to query application IDs and information about the applications.

DpiGroupIds.N String No 20

The ID of the application group.

You can enter at most 100 application group IDs at a time.

You can call the ListDpiGroups operation to query application group IDs and information about the applications.

Response parameters

Parameter Type Example Description
Description String desctest

The description of the traffic classification rule.

EndTime String 2022-09-14T16:41:33+0800

The time when the traffic classification rule expires.

RequestId String 97862812-2C7E-4D25-B0D5-B26DAC7FA293

The ID of the request.

QosPolicyId String qospy-xhwhyuo43l********

The ID of the traffic classification rule.

SourcePortRange String 80/80

The source port range.

SourceCidr String 10.10.10.0/24

The source CIDR block.

Priority Integer 3

The priority of the traffic throttling policy to which the traffic classification rule belongs.

StartTime String 2022-07-14T16:41:33+0800

The time when the traffic classification rule takes effect.

DestPortRange String 80/80

The destination port range.

DpiGroupIds Array of String 20

The ID of the application group.

Name String nametest

The name of the traffic classification rule.

DestCidr String 10.10.10.0/24

The destination CIDR block.

DpiSignatureIds Array of String 1

The IDs of applications.

QosId String qos-xitd8690ucu8ro****

The ID of the QoS policy.

IpProtocol String TCP

The protocol that applies to the traffic classification rule.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateQosPolicy
&Description=desctest
&RegionId=cn-shanghai
&QosId=qos-xitd8690ucu8ro****
&Priority=3
&SourceCidr=10.10.10.0/24
&DestCidr=10.10.20.0/24
&IpProtocol=TCP
&SourcePortRange=80/80
&DestPortRange=80/80
&StartTime=2022-07-14T16:41:33+0800
&EndTime=2022-09-14T16:41:33+0800
&Name=nametest
&DpiSignatureIds=["1"]
&DpiGroupIds=["20"]
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateQosPolicyResponse>
    <Description>desctest</Description>
    <EndTime>2022-09-14T16:41:33+0800</EndTime>
    <RequestId>97862812-2C7E-4D25-B0D5-B26DAC7FA293</RequestId>
    <QosPolicyId>qospy-xhwhyuo43l********</QosPolicyId>
    <SourcePortRange>80/80</SourcePortRange>
    <SourceCidr>10.10.10.0/24</SourceCidr>
    <Priority>3</Priority>
    <StartTime>2022-07-14T16:41:33+0800</StartTime>
    <DestPortRange>80/80</DestPortRange>
    <DpiGroupIds>20</DpiGroupIds>
    <Name>nametest</Name>
    <DestCidr>10.10.10.0/24</DestCidr>
    <DpiSignatureIds>1</DpiSignatureIds>
    <QosId>qos-xitd8690ucu8ro****</QosId>
    <IpProtocol>TCP</IpProtocol>
</CreateQosPolicyResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Description" : "desctest",
  "EndTime" : "2022-09-14T16:41:33+0800",
  "RequestId" : "97862812-2C7E-4D25-B0D5-B26DAC7FA293",
  "QosPolicyId" : "qospy-xhwhyuo43l********",
  "SourcePortRange" : "80/80",
  "SourceCidr" : "10.10.10.0/24",
  "Priority" : 3,
  "StartTime" : "2022-07-14T16:41:33+0800",
  "DestPortRange" : "80/80",
  "DpiGroupIds" : [ "20" ],
  "Name" : "nametest",
  "DestCidr" : "10.10.10.0/24",
  "DpiSignatureIds" : [ "1" ],
  "QosId" : "qos-xitd8690ucu8ro****",
  "IpProtocol" : "TCP"
}

Error codes

HttpCode Error code Error message Description
400 NotSupportedProtocol The specified protocol of the QoS policy is not supported. The error message returned because the QoS policy does not support the specified protocol.
400 InvalidId.Qos The specified QosId is invalid. The error message returned because the QosId parameter is set to an invalid value.
400 QosPolicyPerQosAmountLimit The maximum number of policies in a QoS is exceeded. You can submit a ticket to increase the quota. The error message returned because the number of QoS rules that you have added to the QoS policy has reached the upper limit. You can submit a ticket to request a quota increase.
400 MissParameter.RegionId You must specify RegionId. The error message returned because the ID of the region (RegionId) is not specified.
400 MissParameter.QosId You must specify QosId. The error message returned because the ID of the QoS policy (QosId) is not specified.
400 MissParameter.QosPolicyId You must specify QosPolicyId. The error message returned because the ID of the QoS policy (QosPolicyId) is not specified.
400 InvalidParameter.Priority The specified Priority is invalid. The error message returned because the specified priority (Priority) is invalid.
400 MissParameter.SourceCidr You must specify SourceCidr. The error message returned because the source CIDR block (SourceCidr) is not specified.
400 MissParameter.SourcePortRange You must specify SourcePortRange. The error message returned because the source port range (SourceRange) is not specified.
400 MissParameter.DestCidr You must specify DestCidr. The error message returned because the destination CIDR block (DestCidr) is not specified.
400 MissParameter.DestPortRange You must specify DestPortRange. The error message returned because the destination port range (DestPortRange) is not specified.
400 MissParameter.IpProtocol You must specify IpProtocol. The error message returned because the transport layer protocol (IpProtocol) is not specified.
400 InvalidParameter.Description The specified Description is invalid. The error message returned because the specified description is invalid.
400 InvalidParameter.DestCidr The specified DestCidr is invalid. The error message returned because the specified destination CIDR block (DestCidr) is invalid.
400 InvalidParameter.DestPortRange The specified DestPortRange is invalid. The error message returned because the specified destination port range (DestPortRange) is invalid.
400 InvalidParameter.SourceCidr The specified SourceCidr is invalid. The error message returned because the specified source CIDR block (SourceCidr) is invalid.
400 InvalidParameter.SourcePortRange The specified SourcePortRange is invalid. The error message returned because the specified source port range (SourcePortRange) is invalid.
400 InvalidParameter.StartTime The specified StartTime is invalid. The error message returned because the specified start time (StartTime) is invalid.
400 InvalidParameter.EndTime The specified EndTime is invalid. The error message returned because the specified end time (EndTime) is invalid.
400 InvalidTimeRangeCompare The specified end time is earlier than the start time. Please check your input. The error message returned because the specified end time is earlier than the start time. Check whether the parameters are correctly set.
400 InvalidParameter.Name The specified Name is invalid. The error message returned because the specified name of the QoS policy is invalid.
403 InternalError An internal server error occurred. The error message returned because an internal server error occurred.
403 InvalidPortRange The specified port range is invalid. The error message returned because the specified port range is invalid.

For a list of error codes, see Service error codes.