ALIYUN::GA::Listener类型用于创建监听。
语法
{
"Type": "ALIYUN::GA::Listener",
"Properties": {
"Description": String,
"PortRanges": List,
"Protocol": String,
"AcceleratorId": String,
"Name": String,
"ClientAffinity": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Description | String | 否 | 是 | 监听的描述信息。 | 无 |
PortRanges | List | 是 | 是 | 监听端口。 | 最多支持10个监听端口。
详情请参见PortRanges属性。 |
Protocol | String | 是 | 是 | 监听的网络传输协议类型。 | 取值:
|
AcceleratorId | String | 是 | 否 | 全球加速实例ID。 | 无 |
Name | String | 否 | 是 | 监听的名称。 | 长度为2~128个字符。以英文字母或汉字开头,可包含英文字母、汉字、数字、下划线(_)和短划线(-)。 |
ClientAffinity | String | 否 | 是 | 客户端亲和性。 | 取值:
|
PortRanges语法
"PortRanges": [
{
"FromPort": Integer,
"ToPort": Integer
}
]
PortRanges属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
FromPort | Integer | 是 | 是 | 用来接收请求并向终端节点进行转发的起始监听端口。 | 无 |
ToPort | Integer | 是 | 是 | 用来接收请求并向终端节点进行转发的结束监听端口。 | 无 |
返回值
Fn::GetAtt
ListenerId:监听ID。
示例
JSON
格式
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Description": {
"Type": "String",
"Description": "The description of the listener."
},
"PortRanges": {
"Type": "Json",
"Description": "",
"MinLength": 1,
"MaxLength": 10
},
"Protocol": {
"Type": "String",
"Description": "The network transmission protocol of the listener. Valid values:\ntcp: TCP protocol\nudp: UDP protocol",
"AllowedValues": [
"tcp",
"udp"
]
},
"AcceleratorId": {
"Type": "String",
"Description": "The ID of the Global Accelerator instance to which the listener will be added."
},
"Name": {
"Type": "String",
"Description": "The name of the listener.\nThe name must be 2 to 128 characters in length and can contain letters, digits, underscores\n(_), and hyphens (-). It must start with a letter or Chinese character."
},
"ClientAffinity": {
"Type": "String",
"Description": "Specifies whether to enable client affinity for the listener.\nIf you do not specify the default value in the parameter, client affinity is disabled.\nWhen client affinity is disabled, the connections from a specific source (client)\nIP address are not always routed to the same endpoint.\nIf you set the value to SOURCE_IP, client affinity is enabled. When client affinity is enabled, the connections from\na specific source (client) IP address are always routed to the same endpoint.",
"AllowedValues": [
"NONE",
"SOURCE_IP"
]
}
},
"Resources": {
"Listener": {
"Type": "ALIYUN::GA::Listener",
"Properties": {
"Description": {
"Ref": "Description"
},
"PortRanges": {
"Ref": "PortRanges"
},
"Protocol": {
"Ref": "Protocol"
},
"AcceleratorId": {
"Ref": "AcceleratorId"
},
"Name": {
"Ref": "Name"
},
"ClientAffinity": {
"Ref": "ClientAffinity"
}
}
}
},
"Outputs": {
"ListenerId": {
"Description": "The ID of the listener.",
"Value": {
"Fn::GetAtt": [
"Listener",
"ListenerId"
]
}
}
}
}
YAML
格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Description:
Type: String
Description: The description of the listener.
PortRanges:
Type: Json
Description: ''
MinLength: 1
MaxLength: 10
Protocol:
Type: String
Description: |-
The network transmission protocol of the listener. Valid values:
tcp: TCP protocol
udp: UDP protocol
AllowedValues:
- tcp
- udp
AcceleratorId:
Type: String
Description: >-
The ID of the Global Accelerator instance to which the listener will be
added.
Name:
Type: String
Description: >-
The name of the listener.
The name must be 2 to 128 characters in length and can contain letters,
digits, underscores
(_), and hyphens (-). It must start with a letter or Chinese character.
ClientAffinity:
Type: String
Description: >-
Specifies whether to enable client affinity for the listener.
If you do not specify the default value in the parameter, client affinity
is disabled.
When client affinity is disabled, the connections from a specific source
(client)
IP address are not always routed to the same endpoint.
If you set the value to SOURCE_IP, client affinity is enabled. When client
affinity is enabled, the connections from
a specific source (client) IP address are always routed to the same
endpoint.
AllowedValues:
- NONE
- SOURCE_IP
Resources:
Listener:
Type: 'ALIYUN::GA::Listener'
Properties:
Description:
Ref: Description
PortRanges:
Ref: PortRanges
Protocol:
Ref: Protocol
AcceleratorId:
Ref: AcceleratorId
Name:
Ref: Name
ClientAffinity:
Ref: ClientAffinity
Outputs:
ListenerId:
Description: The ID of the listener.
Value:
'Fn::GetAtt':
- Listener
- ListenerId