ALIYUN::MSE::GatewayRoute类型用于添加网关路由。
语法
{
"Type": "ALIYUN::MSE::GatewayRoute",
"Properties": {
"DomainIdList": List,
"GatewayUniqueId": String,
"Name": String,
"Description": String,
"DestinationType": String,
"DomainId": Integer,
"DirectResponseJSON": Map,
"FallbackServices": List,
"Fallback": Boolean,
"GatewayId": Integer,
"Policies": String,
"Predicates": Map,
"RouteType": String,
"RouteOrder": Integer,
"RedirectJSON": Map,
"Services": List
}
}属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
DomainIdList | List | 是 | 是 | 域名列表。 | 无 |
GatewayUniqueId | String | 是 | 否 | 网关唯一标识 ID。 | 无 |
Name | String | 是 | 是 | 路由名称。 | 无 |
Description | String | 否 | 是 | 路由描述。 | 无 |
DestinationType | String | 否 | 是 | 目标服务类型。 | 取值:
|
DomainId | Integer | 否 | 是 | 域名 ID。 | 无 |
DirectResponseJSON | Map | 否 | 是 | Mock响应配置。 | 更多信息,请参考DirectResponseJSON属性。 |
FallbackServices | List | 否 | 是 | Fallback 服务。 | 更多信息,请参考FallbackServices属性。 |
Fallback | Boolean | 否 | 是 | 是否开启 Fallback 服务。 | 无 |
GatewayId | Integer | 否 | 是 | 网关 ID。 | 无 |
Policies | String | 否 | 是 | 路由策略 JSON 字符串。 | 无 |
Predicates | Map | 否 | 是 | 匹配规则。 | 更多信息,请参考Predicates属性。 |
RouteType | String | 否 | 是 | 路由类型。 | 取值:
|
RouteOrder | Integer | 否 | 是 | 路由顺序。 | 数值越小优先级越高。 |
RedirectJSON | Map | 否 | 是 | 重定向配置。 | 更多信息,请参考RedirectJSON属性。 |
Services | List | 否 | 是 | 服务列表。 | 路由指向为单服务、多服务、标签路由时填写。更多信息,请参考Services属性。 |
Services语法
"Services": [
{
"AgreementType": String,
"GroupName": String,
"ServicePort": Integer,
"Percent": Integer,
"Version": String,
"SourceType": String,
"HttpDubboTranscoder": Map,
"Namespace": String,
"Name": String,
"ServiceId": Integer
}
]Services属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
AgreementType | String | 否 | 否 | 协议类型。 | 无 |
GroupName | String | 否 | 否 | 服务分组名称。 | 无 |
HttpDubboTranscoder | Map | 否 | 否 | Dubbo 协议转换体。 | 更多信息,请参考HttpDubboTranscoder属性。 |
Namespace | String | 否 | 否 | 服务所在命名空间。 | 无 |
Name | String | 否 | 否 | 服务名称。 | 无 |
Percent | Integer | 否 | 否 | 当前服务/服务版本分流百分比。 | 只在使用多服务、标签路由时填写。 |
ServicePort | Integer | 否 | 是 | 服务端口。 | 无 |
SourceType | String | 否 | 否 | 来源类型。 | 无 |
ServiceId | Integer | 否 | 否 | 服务 ID。 | 无 |
Version | String | 否 | 否 | 服务版本。 | 只在使用标签路由时填写。 |
HttpDubboTranscoder语法
"HttpDubboTranscoder": {
"DubboServiceName": String,
"MothedMapList": List,
"DubboServiceGroup": String,
"DubboServiceVersion": String
}HttpDubboTranscoder属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
DubboServiceName | String | 否 | 否 | Dubbo 服务名称。 | 无 |
DubboServiceGroup | String | 否 | 否 | 服务组。 | 无 |
DubboServiceVersion | String | 否 | 否 | Dubbo服务版本。 | 无 |
MothedMapList | List | 否 | 否 | Dubbo 转发规则列表。 | 更多信息,请参考MothedMapList属性。 |
MothedMapList语法
"MothedMapList": [
{
"DubboMothedName": String,
"Mothedpath": String,
"PassThroughList": List,
"HttpMothed": String,
"ParamMapsList": List,
"PassThroughAllHeaders": String
}
]MothedMapList属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
DubboMothedName | String | 否 | 否 | Dubbo 方法名。 | 无 |
HttpMothed | String | 否 | 否 | HTTP 方法。 | 支持 HTTP 方法参数值。取值:
|
Mothedpath | String | 否 | 否 | 方法匹配路径。 | 无 |
PassThroughList | List | 否 | 否 | 指定透传 Header 列表。 | 无 |
ParamMapsList | List | 否 | 否 | 参数映射列表。 | 更多信息,请参考ParamMapsList属性。 |
PassThroughAllHeaders | String | 否 | 否 | Header 透传类型。 | 透传类型枚举值。
|
ParamMapsList语法
"ParamMapsList": [
{
"MappingType": String,
"ExtractKeySpec": String,
"ExtractKey": String
}
]ParamMapsList属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
ExtractKeySpec | String | 否 | 否 | 入参位置。 | 取值:
|
ExtractKey | String | 否 | 否 | 入参位提取 Key。 | 无 |
MappingType | String | 否 | 否 | 后端参数类型。 | 无 |
RedirectJSON语法
"RedirectJSON": {
"Path": String,
"Host": String,
"Code": Integer
}RedirectJSON属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Code | Integer | 否 | 否 | 返回码。 | 无 |
Host | String | 否 | 否 | 重定向主机名。 | 无 |
Path | String | 否 | 否 | 重定向路径。 | 无 |
DirectResponseJSON语法
"DirectResponseJSON": {
"Body": String,
"Code": Integer
}DirectResponseJSON属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Body | String | 否 | 否 | Mock 返回值。 | 无 |
Code | Integer | 否 | 否 | Mock 返回码。 | 无 |
FallbackServices语法
"FallbackServices": [
{
"AgreementType": String,
"GroupName": String,
"ServicePort": Integer,
"Percent": Integer,
"Version": String,
"SourceType": String,
"Namespace": String,
"Name": String,
"ServiceId": Integer
}
]FallbackServices属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
AgreementType | String | 否 | 否 | 协议类型。 | 无 |
GroupName | String | 否 | 否 | 服务分组名称。 | 无 |
Namespace | String | 否 | 否 | 服务所在的命名空间。 | 无 |
Name | String | 否 | 否 | 名称。 | 无 |
Percent | Integer | 否 | 否 | 当前服务/服务版本分流百分比。 | 只在使用多服务、标签路由时填写。 |
ServicePort | Integer | 否 | 否 | 服务端口。 | 无 |
SourceType | String | 否 | 否 | 来源类型。 | 无 |
ServiceId | Integer | 否 | 否 | 服务 ID。 | 无 |
Version | String | 否 | 否 | 服务版本。 | 无 |
Predicates语法
"Predicates": {
"HeaderPredicates": List,
"MethodPredicates": List,
"QueryPredicates": List,
"PathPredicates": Map
}Predicates属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
HeaderPredicates | List | 否 | 否 | 请求头匹配。 | 更多信息,请参考HeaderPredicates属性。 |
MethodPredicates | List | 否 | 否 | 方法匹配。 | {'Length': {'Max': 20}} |
PathPredicates | Map | 否 | 否 | 路由匹配。 | 更多信息,请参考PathPredicates属性。 |
QueryPredicates | List | 否 | 否 | URL 参数匹配。 | 更多信息,请参考QueryPredicates属性。 |
HeaderPredicates语法
"HeaderPredicates": [
{
"Type": String,
"Value": String,
"Key": String
}
]HeaderPredicates属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Key | String | 否 | 否 | 请求头 Key。 | 无 |
Type | String | 否 | 否 | 匹配类型。 | 无 |
Value | String | 否 | 否 | 对应的 Value。 | 无 |
QueryPredicates语法
"QueryPredicates": [
{
"Type": String,
"Value": String,
"Key": String
}
]QueryPredicates属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Key | String | 否 | 否 | 参数名。 | 无 |
Type | String | 否 | 否 | 匹配类型。 | 无 |
Value | String | 否 | 否 | 匹配值。 | 无 |
PathPredicates语法
"PathPredicates": {
"Path": String,
"Type": String,
"IgnoreCase": Boolean
}PathPredicates属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
IgnoreCase | Boolean | 否 | 否 | None Whether to ignore case when matching paths. | 无 |
Path | String | 否 | 否 | 路径。 | 无 |
Type | String | 否 | 否 | 路由匹配。 | 取值:
|
返回值
Fn::GetAtt
RouteId:路由ID。
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Name:
Required: true
Type: String
Description:
en: The name of the route.
DomainIdList:
AssociationProperty: List[Parameter]
AssociationPropertyMetadata:
Parameter:
Default: Null
Required: false
Type: String
Description:
en: The domain ID in JSON format.
Required: true
Type: Json
Description:
en: The list of domain IDs in JSON format.
GatewayUniqueId:
Required: true
Type: String
Description:
en: The unique ID of the gateway.
Resources:
GatewayRoute:
Type: ALIYUN::MSE::GatewayRoute
Properties:
Name:
Ref: Name
DomainIdList:
Ref: DomainIdList
GatewayUniqueId:
Ref: GatewayUniqueId
Outputs:
RouteId:
Description: The ID of the route.
Value:
Fn::GetAtt:
- GatewayRoute
- RouteId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Name": {
"Required": true,
"Type": "String",
"Description": {
"en": "The name of the route."
}
},
"DomainIdList": {
"AssociationProperty": "List[Parameter]",
"AssociationPropertyMetadata": {
"Parameter": {
"Default": null,
"Required": false,
"Type": "String",
"Description": {
"en": "The domain ID in JSON format."
}
}
},
"Required": true,
"Type": "Json",
"Description": {
"en": "The list of domain IDs in JSON format."
}
},
"GatewayUniqueId": {
"Required": true,
"Type": "String",
"Description": {
"en": "The unique ID of the gateway."
}
}
},
"Resources": {
"GatewayRoute": {
"Type": "ALIYUN::MSE::GatewayRoute",
"Properties": {
"Name": {
"Ref": "Name"
},
"DomainIdList": {
"Ref": "DomainIdList"
},
"GatewayUniqueId": {
"Ref": "GatewayUniqueId"
}
}
}
},
"Outputs": {
"RouteId": {
"Description": "The ID of the route.",
"Value": {
"Fn::GetAtt": [
"GatewayRoute",
"RouteId"
]
}
}
}
}