ALIYUN::APIG::ApiAttachment类型用于API挂载。
语法
{
"Type": "ALIYUN::APIG::ApiAttachment",
"Properties": {
"BackendScene": String,
"EnvironmentId": String,
"HttpApiId": String,
"ServiceConfigs": List,
"Description": String,
"DomainIds": List,
"RouteId": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
BackendScene | String | 是 | 否 | 发布场景。 | 取值:
|
EnvironmentId | String | 是 | 否 | 环境 ID。 | 无 |
HttpApiId | String | 是 | 否 | HTTP API ID。 | 无 |
ServiceConfigs | List | 是 | 否 | 服务配置列表。 | 更多信息,请参见ServiceConfigs属性。 |
Description | String | 否 | 否 | 描述。 | 无 |
DomainIds | List | 否 | 否 | 用户自定义域名 ID 列表。 | 最多支持输入10组域名 ID。 |
RouteId | String | 否 | 否 | 路由 ID。 | 无 |
ServiceConfigs语法
"ServiceConfigs": [
{
"Version": String,
"Port": Integer,
"Protocol": String,
"Weight": Integer,
"ServiceId": String,
"Match": Map
}
]
ServiceConfigs属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
ServiceId | String | 是 | 否 | 服务 ID。 | 无 |
Weight | Integer | 是 | 否 | 服务权重。 | 取值范围:1~100. |
Match | Map | 否 | 否 | API部署中的匹配条件配置。 | 更多信息,请参见Match属性。 |
Port | Integer | 否 | 否 | 服务端口。 | 无 |
Protocol | String | 否 | 否 | 域名支持的协议类型。 | 取值:
|
Version | String | 否 | 否 | 服务的版本。 | 无 |
Match语法
"Match": {
"DefaultMatch": Boolean,
"Conditions": List
}
Match属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Conditions | List | 否 | 否 | 匹配条件配置。 | 更多信息,请参见Conditions属性。 |
DefaultMatch | Boolean | 否 | 否 | 是否默认匹配条件。 | 无 |
Conditions语法
"Conditions": [
{
"Operator": String,
"Type": String,
"Value": String,
"Key": String
}
]
Conditions属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Key | String | 否 | 否 | 匹配 Key。 | 无 |
Operator | String | 否 | 否 | 操作符。 | ,支持精确匹配、前缀匹配、正则表达式三种方式。 枚举值:
|
Type | String | 否 | 否 | 匹配类型。 | 支持 Query 参数或 Header 参数匹配。 |
Value | String | 否 | 否 | 匹配值。 | 无 |
返回值
Fn::GetAtt
EnvironmentId:环境 id。
RouteId:路由 ID。
HttpApiId:路由所属的 HTTP API ID。
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
ExtensionResource:
Type: ALIYUN::APIG::ApiAttachment
Properties:
EnvironmentId: env-csqxxxxx
BackendScene: MultiServiceByRatio
HttpApiId: api-csqxxxxx
ServiceConfigs:
- ServiceId: svc-csqp3xxxxx
Weight: 100
RouteId: hr-csuxxxxxx
Outputs:
EnvironmentId:
Description: The ID of the environment to which the API is to deploy.
Value:
Fn::GetAtt:
- ExtensionResource
- EnvironmentId
RouteId:
Description: The route ID. When publishing an HTTP API route, it must be passed in.
Value:
Fn::GetAtt:
- ExtensionResource
- RouteId
HttpApiId:
Description: The ID of the HTTP API.
Value:
Fn::GetAtt:
- ExtensionResource
- HttpApiId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
},
"Resources": {
"ExtensionResource": {
"Type": "ALIYUN::APIG::ApiAttachment",
"Properties": {
"EnvironmentId": "env-csqxxxxx",
"BackendScene": "MultiServiceByRatio",
"HttpApiId": "api-csqxxxxx",
"ServiceConfigs": [
{
"ServiceId": "svc-csqp3xxxxx",
"Weight": 100
}
],
"RouteId": "hr-csuxxxxxx"
}
}
},
"Outputs": {
"EnvironmentId": {
"Description": "The ID of the environment to which the API is to deploy.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"EnvironmentId"
]
}
},
"RouteId": {
"Description": "The route ID. When publishing an HTTP API route, it must be passed in.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"RouteId"
]
}
},
"HttpApiId": {
"Description": "The ID of the HTTP API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"HttpApiId"
]
}
}
}
}
- 本页导读 (1)
- 语法
- 属性
- ServiceConfigs语法
- ServiceConfigs属性
- Match语法
- Match属性
- Conditions语法
- Conditions属性
- 返回值
- 示例