Create forwarding rules for application load balancer - CreateRule
Overview
Create a forwarding rule for the application load balancer listener
Definition
Public Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Action | string | Corresponding API command name, the current API is CreateRule . | Yes |
PublicKey | string | The user's public key can be obtained from Console (opens in a new tab) | Yes |
Signature | string | User signature generated based on public key and API command, see Signature Algorithm | Yes |
Request Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Region | string | Region. See List of Regions and Availability Zones | Yes |
ProjectId | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface. | Yes |
LoadBalancerId | string | ID of the Load Balancing Instance | Yes |
ListenerId | string | Listener's ID | Yes |
RuleConditions.N.Type | string | Matching condition type. Limited enumeration values: "Host"/"Path". | Yes |
RuleConditions.N.HostConfig.MatchMode | string | Matching method. Limited enumeration values: 'Regular'/'Wildcard', default value: 'Regular'. | No |
Values.N | string | Value. Currently, only arrays of length 1 are supported; the value must meet the conditions of the relevant matching method; it is mandatory to fill in when matching domain names. | No |
Values.N | string | Value. Currently only supports an array length of 1; the value must meet relevant conditions; must be filled in when path matching. | No |
RuleActions.N.Type | string | Action type. Limited enumeration value: "Forward"; RuleActions currently supports a length of 1. | Yes |
Targets.N.Id | string | The identifier ID of the backend service node being forwarded. It is limited to the service node pool of the listener; the array length can be 0; when the array length of the configured forwarding service node is not 0, the ID is required. | No |
Targets.N.Weight | int | The weight of the backend service node being forwarded. Only valid when the load balancing algorithm of the listener is weighted round robin. | No |
Pass | boolean | Whether the rule is ignored when the service node to be forwarded is empty. The default value is true. | No |
Response Field
Field Name | Type | Description Information | Required |
---|---|---|---|
RetCode | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. | Yes |
Action | string | Operation command name. | Yes |
Message | string | Returns an error message, providing detailed description when RetCode is non-zero. | No |
RuleId | string | ID of the forwarding rule | Yes |
Example
Request Example
https://api.ucloud-global.com/?Action=CreateRule
&Region=cn-zj
&ProjectId=KkLjsPqn
&LoadBalancerId=TpQFMTyp
&ListenerId=TBLRaFqM
&RuleConditions.n.Type=OwQlzYTk
&RuleActions.n.Type=CdXoaIEM
&RuleConditions.n.HostConfig.MatchMode=PVAsSDML
&RuleConditions.n.HostConfig.Values.n=leqEAWWl
&RuleConditions.n.PathConfig.Values.n=PwuAChmC
&RuleActions.n.ForwardConfig.Targets.n.Id=kJkvikIW
&RuleActions.n.ForwardConfig.Targets.n.Weight=2
&Pass=true
Response Example
{
"Action": "CreateRuleResponse",
"RetCode": 0,
"RuleId": "qZjWGzsa"
}