Adds forwarding rules to a specified HTTP or HTTPS listener.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
slb:CreateRules |
create |
*loadbalancer
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the SLB instance. You can call the DescribeRegions operation to query region IDs. |
cn-hangzhou |
| LoadBalancerId |
string |
Yes |
The ID of the SLB instance. |
lb-bp1ca0zt07t934w****** |
| ListenerPort |
integer |
Yes |
The frontend listener port of the SLB instance. Valid values: 1 to 65535. |
443 |
| ListenerProtocol |
string |
No |
The frontend protocol of the SLB instance. Note
This parameter is required when listeners that use different protocols are configured on the same port. |
https |
| RuleList |
string |
Yes |
The forwarding rules to add. You can add up to 10 forwarding rules in a single request. Each forwarding rule contains the following parameters:
Note
You must specify at least one of |
[{"RuleName":"Rule2","Domain":"test.com","VServerGroupId":"rsp-bp114ni******"}] |
| DryRun |
boolean |
No |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
| Rules |
object |
||
| Rule |
array<object> |
The list of forwarding rules. |
|
|
object |
The list of forwarding rules. |
||
| RuleName |
string |
The name of the forwarding rule. |
Rule2 |
| RuleId |
string |
The ID of the forwarding rule. |
rule-bp12jzy0***** |
Examples
Success response
JSON format
{
"RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
"Rules": {
"Rule": [
{
"RuleName": "Rule2",
"RuleId": "rule-bp12jzy0*****"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified VServerGroupId does not belong to the LoadBalancerId of the rule. | The Vgw ip is empty. Specify the Vgw ip parameter. |
| 400 | InvalidParameterValue.RegionNotSupport | The region does not support the parameter value, %s. | The specified parameter value is not supported in the current region. |
| 400 | TooManyListeners | More than 1 listener is found, please be more specified. | More than one listener was found. Provide more specific query conditions. |
| 400 | DomainExist | rule with same domain and url already exists in specified vip | The specified domain name and URL already exists in another listener rule. |
| 400 | OperationFailed.ListenerStatusNotSupport | The status of the listener does not support this operation. Please try again later. | The operation failed because the current listener is being modified. Try again later. |
| 400 | OperationFailed.ActionNotSupport | The loadbalancer does not support such action. | The operation failed because IPv6 SLB instances do not support this operation. |
| 400 | MissingParameter.RuleName | The parameter RuleName is required. | The RuleName parameter is missing. |
| 400 | DryRunOperation | Request validation has been passed with DryRun flag set. | Request validation has been passed with DryRun flag set. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.