Docs
api
Load Balance(ULB)
CreateListener

Create Application Load Balancer Listener - CreateListener

Overview

Create a listener for an application load balancer

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is CreateListener.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
NamestringThe name of the listener. Character length limit: [1-255]; Special characters supported: "-", "_", "."; Default value: listener.No
RemarkstringDescription of the listener. Character limit: [0-255]No
ListenerPortintThe listening port of the listener. For application type, the value range is: [1-65535], the default value is 80.No
ListenerProtocolstringListening Protocol. Application-specific limited values: "HTTP"/"HTTPS", default value "HTTP".No
Certificates.Nstring(Application-specific) Default server certificate ID. Only supported by HTTPS listening and is required; currently only supports a maximum length of 1.No
SecurityPolicyIdstring(Application-specific) Security policy group ID. Only HTTPS listening supports binding; the default value "Default" means binding to the native policy.No
IdleTimeoutintConnection idle timeout period. Unit: seconds. Application type limit value: [1-86400]; default value is 60.No
SchedulerstringLoad balancing algorithm. Application-specific limited values: "Roundrobin"/"Source"/"WeightRoundrobin"/"Leastconn"/"Backup", default value "Roundrobin".No
StickinessConfig.EnabledbooleanWhether to enable the session persistence function. The application load balancing instance is implemented based on Cookie; the default value is: falseNo
StickinessConfig.Typestring(Application-specific) Cookie processing method. Limited enumeration values: "ServerInsert" / "UserDefined"; The default value is: "ServerInsert".No
StickinessConfig.CookieNamestring(Application-specific) Custom Cookie. Effective when StickinessType is set to "UserDefined"; character length limit: [0-255]No
HealthCheckConfig.EnabledbooleanWhether to enable the health check function. Temporarily does not support shutting down. The default value is: trueNo
HealthCheckConfig.TypestringHealth check method. Application type limited value: 'Port'/'HTTP', default value: 'Port'.No
HealthCheckConfig.Domainstring(Application-specific) HTTP Check DomainNo
HealthCheckConfig.Pathstring(Application-specific) HTTP check pathNo
CompressionEnabledboolean(Application-specific) Whether to enable the data compression feature. Currently, only gzip is supported for compressing specific file types. The default value is: falseNo
HTTP2Enabledboolean(Application-specific) Whether to enable the HTTP/2 feature. Only HTTPS listening supports enabling; the default value is: falseNo
RedirectEnabledboolean(Application-specific) Whether to enable HTTP redirection to HTTPS. Only HTTP listening supports enabling; the default value is: falseNo
RedirectPortint(Application-specific) Redirect port. Limited value range: [1-65535], default value 443No

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
ListenerIdstringListener's IDYes

Example

Request Example

https://api.ucloud-global.com/?Action=CreateListener
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=uvNplLqt
&LoadBalancerId=TrMQMxgz
&Name=kHEiMUtI
&Remark=VHkpyFlw
&ListenPort=3
&ListenProtocol=OjJEdAaO
&Certificates.n=WuscVHDW
&SecurityPolicyId=zwsYdamE
&IdleTimeout=3
&Scheduler=lHorTbNl
&StickinessConfig.Enabled=false
&StickinessConfig.Type=fuuciPzx
&StickinessConfig.CookieName=TnXwVeSq
&HealthCheckConfig.Enabled=true
&HealthCheckConfig.Type=pDlMtNon
&HealthCheckConfig.Domain=TWoxQhFA
&HealthCheckConfig.Path=KnPWkCVd
&CompressionEnabled=false
&HTTP2Enabled=false
&RedirectEnabled=false
&RedirectPort=1

Response Example

{
  "Action": "CreateListenerResponse",
  "ListenerId": "pCtZUlZc",
  "RetCode": 0
}