Skip to content

Listener

This class encapsulates and extends the ROS resource type ALIYUN::SLB::Listener, which is used to create a Server Load Balancer (SLB) listener.

Initializers

import com.aliyun.ros.cdk.slb.Listener;
Listener.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
    .bandwidth(java.lang.Number)
    .bandwidth(IResolvable)
    .listenerPort(java.lang.Number)
    .listenerPort(IResolvable)
    .loadBalancerId(java.lang.String)
    .loadBalancerId(IResolvable)
    .protocol(java.lang.String)
    .protocol(IResolvable)
//  .aclId(java.lang.String)
//  .aclId(IResolvable)
//  .aclIds(IResolvable)
//  .aclIds(java.util.List<java.lang.String)
//  .aclIds(IResolvable>)
//  .aclStatus(java.lang.String)
//  .aclStatus(IResolvable)
//  .aclType(java.lang.String)
//  .aclType(IResolvable)
//  .backendServerPort(java.lang.Number)
//  .backendServerPort(IResolvable)
//  .caCertificateId(java.lang.String)
//  .caCertificateId(IResolvable)
//  .connectionDrain(java.lang.String)
//  .connectionDrain(IResolvable)
//  .connectionDrainTimeout(java.lang.Number)
//  .connectionDrainTimeout(IResolvable)
//  .description(java.lang.String)
//  .description(IResolvable)
//  .enableHttp2(java.lang.String)
//  .enableHttp2(IResolvable)
//  .gzip(java.lang.String)
//  .gzip(IResolvable)
//  .healthCheck(IResolvable)
//  .healthCheck(HealthCheckProperty)
//  .httpConfig(IResolvable)
//  .httpConfig(HttpConfigProperty)
//  .idleTimeout(java.lang.Number)
//  .idleTimeout(IResolvable)
//  .masterSlaveServerGroupId(java.lang.String)
//  .masterSlaveServerGroupId(IResolvable)
//  .persistence(IResolvable)
//  .persistence(PersistenceProperty)
//  .portRange(IResolvable)
//  .portRange(java.util.List<IResolvable)
//  .portRange(PortRangeProperty>)
//  .proxyProtocolV2Enabled(java.lang.Boolean)
//  .proxyProtocolV2Enabled(IResolvable)
//  .requestTimeout(java.lang.Number)
//  .requestTimeout(IResolvable)
//  .scheduler(java.lang.String)
//  .scheduler(IResolvable)
//  .serverCertificateId(java.lang.String)
//  .serverCertificateId(IResolvable)
//  .startListener(java.lang.Boolean)
//  .startListener(IResolvable)
//  .tags(java.util.List<TagsProperty>)
//  .tlsCipherPolicy(java.lang.String)
//  .tlsCipherPolicy(IResolvable)
//  .vServerGroupId(java.lang.String)
//  .vServerGroupId(IResolvable)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
bandwidth java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property bandwidth: The bandwidth of network, unit in Mbps(Million bits per second).
listenerPort java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property listenerPort: Port for front listener.
loadBalancerId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property loadBalancerId: The id of load balancer to create listener.
protocol java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property protocol: The load balancer transport protocol to use for routing: http, https, tcp, or udp.
aclId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property aclId: The ID of the access control associated with the listener to be created.
aclIds com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property aclIds: The ID list of the access controls associated with the listener to be created.
aclStatus java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property aclStatus: Indicates whether to enable access control.
aclType java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property aclType: The access control type: * white: Indicates a whitelist.
backendServerPort java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property backendServerPort: Backend server can listen on ports from 1 to 65535.
caCertificateId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property caCertificateId: CA server certificate id, for https listener only.
connectionDrain java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property connectionDrain: Whether to enable graceful connection interruption.
connectionDrainTimeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property connectionDrainTimeout: Set the connection graceful interruption timeout.
description java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property description: The description of the listener.It must be 1 to 80 characters in length and can contain letters, digits, hyphens (-), forward slashes (\/), periods (.), and underscores (_). Chinese characters are supported.
enableHttp2 java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property enableHttp2: Specifies whether to use HTTP\/2.
gzip java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property gzip: Specifies whether to enable Gzip compression to compress specific types of files.
healthCheck com.aliyun.ros.cdk.core.IResolvable OR HealthCheckProperty Property healthCheck: The properties of health checking setting.
httpConfig com.aliyun.ros.cdk.core.IResolvable OR HttpConfigProperty Property httpConfig: Config for http protocol.
idleTimeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property idleTimeout: Specify the idle connection timeout in seconds.
masterSlaveServerGroupId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property masterSlaveServerGroupId: The id of the MasterSlaveServerGroup which use in listener.
persistence com.aliyun.ros.cdk.core.IResolvable OR PersistenceProperty Property persistence: The properties of persistence.
portRange com.aliyun.ros.cdk.core.IResolvable OR java.util.ListPortRangeProperty> Property portRange: Port range, only supports TCP or UDP listener.
proxyProtocolV2Enabled java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property proxyProtocolV2Enabled: Whether to support carrying the client source address to the backend server through the Proxy Protocol.
requestTimeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property requestTimeout: Specify the request timeout in seconds.
scheduler java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property scheduler: The scheduling algorithm.
serverCertificateId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property serverCertificateId: Server certificate id, for https listener only, this properties is required.
startListener java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property startListener: Whether start listener after listener created.
tags java.util.List<TagsProperty> Property tags: Tags to attach to instance.
tlsCipherPolicy java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property tlsCipherPolicy: The Transport Layer Security (TLS) security policy.
vServerGroupId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property vServerGroupId: The id of the VServerGroup which use in listener.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

bandwidthRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property bandwidth: The bandwidth of network, unit in Mbps(Million bits per second).

If the specified load balancer with "LOAD_BALANCE_ID" is charged by "paybybandwidth" and is created in classic network, each Listener's bandwidth must be greater than 0 and the sum of all of its Listeners' bandwidth can't be greater than the bandwidth of the load balancer.


listenerPortRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property listenerPort: Port for front listener.

Range from 0 to 65535.


loadBalancerIdRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property loadBalancerId: The id of load balancer to create listener.


protocolRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property protocol: The load balancer transport protocol to use for routing: http, https, tcp, or udp.


aclIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property aclId: The ID of the access control associated with the listener to be created.

If the value of the AclStatus parameter is on, this parameter is required.


aclIdsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property aclIds: The ID list of the access controls associated with the listener to be created.

If the value of the AclStatus parameter is on, this parameter is required.AclIds have higher priority than AclId.


aclStatusOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property aclStatus: Indicates whether to enable access control.

Valid values: on | off. Default value: off


aclTypeOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property aclType: The access control type: * white: Indicates a whitelist.

Only requests from IP addresses or CIDR blocks in the selected access control lists are forwarded. This applies to scenarios in which an application only allows access from specific IP addresses. Enabling a whitelist poses some risks to your services. After a whitelist is enabled, only the IP addresses in the list can access the listener. If you enable a whitelist without adding any IP addresses in the list, no requests are forwarded.

  • black: Indicates a blacklist. Requests from IP addresses or CIDR blocks in the selected access control lists are not forwarded (that is, they are blocked). This applies to scenarios in which an application only denies access from specific IP addresses. If you enable a blacklist without adding any IP addresses in the list, all requests are forwarded.

If the value of the AclStatus parameter is on, this parameter is required.


backendServerPortOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property backendServerPort: Backend server can listen on ports from 1 to 65535.


caCertificateIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property caCertificateId: CA server certificate id, for https listener only.


connectionDrainOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property connectionDrain: Whether to enable graceful connection interruption.

Value:on: turn on off: Not turned on Note: Only effective TCP listener.


connectionDrainTimeoutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property connectionDrainTimeout: Set the connection graceful interruption timeout.

Unit: seconds. Value range: 10-900. Note: Only effective for TCP listener. When ConnectionDrain is on, this option is required.


descriptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property description: The description of the listener.It must be 1 to 80 characters in length and can contain letters, digits, hyphens (-), forward slashes (\/), periods (.), and underscores (_). Chinese characters are supported.


enableHttp2Optional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property enableHttp2: Specifies whether to use HTTP\/2.

It takes effect when Protocol=https. Valid values: on: yes off: no


gzipOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property gzip: Specifies whether to enable Gzip compression to compress specific types of files.

Valid values: on (default): yes off: no


healthCheckOptional

Property healthCheck: The properties of health checking setting.


httpConfigOptional

Property httpConfig: Config for http protocol.


idleTimeoutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property idleTimeout: Specify the idle connection timeout in seconds.

Valid value: 1-60 If no request is received during the specified timeout period, Server Load Balancer will temporarily terminate the connection and restart the connection when the next request comes.


masterSlaveServerGroupIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property masterSlaveServerGroupId: The id of the MasterSlaveServerGroup which use in listener.


persistenceOptional

Property persistence: The properties of persistence.


portRangeOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListPortRangeProperty>

Property portRange: Port range, only supports TCP or UDP listener.

ListenerPort should be 0 when PortRange is specified.


proxyProtocolV2EnabledOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property proxyProtocolV2Enabled: Whether to support carrying the client source address to the backend server through the Proxy Protocol.

Value: true: Yes false (default): No Note: Only effective TCP or UDP listener.


requestTimeoutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property requestTimeout: Specify the request timeout in seconds.

Valid value: 1-180 If no response is received from the backend server during the specified timeout period, Server Load Balancer will stop waiting and send an HTTP 504 error to the client.


schedulerOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property scheduler: The scheduling algorithm.

Valid values: wrr: Backend servers that have higher weights receive more requests than those that have lower weights. wlc: Requests are distributed based on the combination of the weights and connections to backend servers. If two backend servers have the same weight, the backend server that has fewer connections receives more requests. rr: Requests are distributed to backend servers in sequence. sch: specifies consistent hashing that is based on source IP addresses. Requests from the same source IP address are distributed to the same backend server. tch: specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port number, and destination port number. Requests that contain the same preceding information are distributed to the same backend server. Default: wrr


serverCertificateIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property serverCertificateId: Server certificate id, for https listener only, this properties is required.


startListenerOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property startListener: Whether start listener after listener created.

Default True.


tagsOptional

Property tags: Tags to attach to instance.

Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.


tlsCipherPolicyOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property tlsCipherPolicy: The Transport Layer Security (TLS) security policy.

Each security policy contains TLS protocol versions and cipher suites available for HTTPS. It takes effect when Protocol=https.


vServerGroupIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property vServerGroupId: The id of the VServerGroup which use in listener.


Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
getAtt No description.
setMetadata No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

Static Functions

Name Description
isConstruct Return whether the given object is a Construct.

isConstruct

import com.aliyun.ros.cdk.slb.Listener;
Listener.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrListenerPortsAndProtocol com.aliyun.ros.cdk.core.IResolvable Attribute ListenerPortsAndProtocol: The collection of listener.
attrLoadBalancerId com.aliyun.ros.cdk.core.IResolvable Attribute LoadBalancerId: The id of load balancer.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrListenerPortsAndProtocolRequired

public IResolvable getAttrListenerPortsAndProtocol();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ListenerPortsAndProtocol: The collection of listener.


attrLoadBalancerIdRequired

public IResolvable getAttrLoadBalancerId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute LoadBalancerId: The id of load balancer.