You can call this operation to add a rule that contains 5-tuples to a quality of service (QoS) policy.

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 parameters

Parameter Type Required Example Description
Action String No CreateQosPolicy

The operation that you want to perform.

Set the value to CreateQosPolicy.

DestCidr String Yes 10.XX.XX.0/24

The destination CIDR block.

DestPortRange String Yes 80/80

The range of destination ports.

IpProtocol String Yes TCP

The transport layer protocol.

Priority Integer Yes 6

The priority of the rule. A smaller value represents a higher priority. If rules are assigned the same priority, the one applied the earliest prevails.

Valid values: 1 to 7.

QosId String Yes qos-dhf***********

The ID of the QoS policy.

RegionId String Yes cn-hangzhou

The ID of the region where the QoS policy is deployed.

SourceCidr String Yes 10.XX.XX.0/24

The source CIDR block.

SourcePortRange String Yes 80/80

The range of source ports.

Description String No QoS rule

The description of the 5-tuple.

StartTime String No 2019-07-14T16:41:33+0800

The time when the QoS rule takes effect.

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

The time when the QoS rule expires.

Name String No nametest

The name of the QoS rule. The name must be 2 to 100 characters in length, and can contain digits, hyphens (-), and underscores (_). It must start with a letter or Chinese character.

Response parameters

Parameter Type Example Description
RequestId String 97862812-2C7E-4D25-B0D5-B26DAC7FA293

The ID of the request.

QosId String qos-xhwhyuo43l********

The ID of the QoS policy.

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

The ID of the QoS rule.

Description String bvt-test

The description of the QoS rule.

Priority Integer 3

The priority of the QoS rule. A smaller value represents a higher priority. If rules are assigned the same priority, the one applied the earliest prevails.

Valid values: 1 to 7.

SourceCidr String 10.XX.XX.0/24

The source CIDR block.

DestCidr String 10.XX.XX.0/24

The destination CIDR block.

IpProtocol String TCP

The transport layer protocol.

SourcePortRange String 80/80

The source ports.

DestPortRange String 80/80

The destination ports.

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

The time when the QoS rule takes effect.

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

The time when the QoS rule expires.

Name String nametest

The name of the QoS rule. The name must be 2 to 100 characters in length, and can contain digits, hyphens (-), and underscores (_). It must start with a letter or Chinese character.

Examples

Sample requests

http(s)://[Endpoint]/? Action=CreateQosPolicy
&DestCidr=10.XX.XX.0/24
&DestPortRange=80/80
&IpProtocol=TCP
&Priority=6
&QosId=qos-dhf***********
&RegionId=cn-hangzhou
&SourceCidr=10.XX.XX.9/24
&SourcePortRange=80/80
&<Common request parameters>

Sample success responses

XML format

<CreateQosPolicyResponse>
      <Description>bvt-test</Description>
      <DestCidr>10.XX.XX.0/24</DestCidr>
      <DestPortRange>-1/-1</DestPortRange>
      <EndTime>2019-09-14T16:41:33+0800</EndTime>
      <IpProtocol>ALL</IpProtocol>
      <Priority>1</Priority>
      <QosId>qos-awfxl1adxeqykl****</QosId>
      <QosPolicyId>qospy-427m9fo6wkhofs****</QosPolicyId>
      <RequestId>97862812-2C7E-4D25-B0D5-B26DAC7FA293</RequestId>
      <SourceCidr>192.168.0.0/24</SourceCidr>
      <SourcePortRange>-1/-1</SourcePortRange>
      <StartTime>2019-07-14T16:41:33+0800</StartTime>
    </CreateQosPolicyResponse>

JSON format

{
    "Description":"bvt-test",
    "DestCidr":"10.XX.XX.0/24",
    "DestPortRange":"-1/-1",
    "EndTime":"2019-09-14T16:41:33+0800",
    "IpProtocol":"ALL",
    "Priority":1,
    "QosId":"qos-awfxl1adxeqykl****",
    "QosPolicyId":"qospy-427m9fo6wkhofs1****",
    "RequestId":"97862812-2C7E-4D25-B0D5-B26DAC7FA293",
    "SourceCidr":"192.168.0.0/24",
    "SourcePortRange":"-1/-1",
    "StartTime":"2019-07-14T16:41:33+0800"
}

Error codes

HttpCode Error code Error message Description
403 InternalError An internal server error occurred. The error message returned because an internal error occurred.
400 NotSupportedProtocol The specified protocol of the QoS policy is not supported. The error message returned because the specified transport layer protocol is not supported by the QoS rule.
403 InvalidPortRange The specified port range is invalid. The error message returned because the specified port range is invalid.
400 InvalidId.Qos The specified QosId is invalid. The error message returned because the specified ID (QosId) of the QoS policy is invalid.
400 QosPyPerQosPyPerQosAmountLimitQosAmountLimit 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 (RegionId) of the region is not specified.
400 MissParameter.QosId You must specify QosId. The error message returned because the ID (QosId) of the QoS policy is not specified.
400 MissParameter.QosPolicyId You must specify QosPolicyId. The error message returned because the ID (QosPolicyId) of the QoS rule is not specified.
400 InvalidParameter.Priority The specified Priority is invalid. The error message returned because the specified priority (Priority) of the QoS rule 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 (Description) of the QoS rule 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 time (StartTime) when the QoS rule takes effect is invalid.
400 InvalidParameter.EndTime The specified EndTime is invalid. The error message returned because the time (EndTime) when the QoS rule expires is invalid.
400 InvalidTimeRangeCompare The specified end time is earlier than the start time. Please check your input. The error message returned because the 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 name (Name) of the QoS rule is invalid.

For a list of error codes, visit the API Error Center.