docs
api
Load Balance(ULB)
CreateRule

Create forwarding rules for application load balancer - CreateRule

Overview

Create a forwarding rule for the application load balancer listener

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is CreateRule.Yes
PublicKeystringThe user's public key can be obtained from Console (opens in a new tab)Yes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RegionstringRegion. See List of Regions and Availability ZonesYes
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.Yes
LoadBalancerIdstringID of the Load Balancing InstanceYes
ListenerIdstringListener's IDYes
RuleConditions.N.TypestringMatching condition type. Limited enumeration values: "Host"/"Path".Yes
RuleConditions.N.HostConfig.MatchModestringMatching method. Limited enumeration values: 'Regular'/'Wildcard', default value: 'Regular'.No
Values.NstringValue. 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.NstringValue. Currently only supports an array length of 1; the value must meet relevant conditions; must be filled in when path matching.No
RuleActions.N.TypestringAction type. Limited enumeration value: "Forward"; RuleActions currently supports a length of 1.Yes
Targets.N.IdstringThe 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.WeightintThe weight of the backend service node being forwarded. Only valid when the load balancing algorithm of the listener is weighted round robin.No
PassbooleanWhether the rule is ignored when the service node to be forwarded is empty. The default value is true.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
RuleIdstringID of the forwarding ruleYes

Example

Request Example

https://api.surfercloud.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"
}
  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved
  • Contact our sales to help your business.
  • Contact our sales to help your business.