ALIYUN::APIG::HttpApi类型用于创建HTTP API。
语法
{
"Type": "ALIYUN::APIG::HttpApi",
"Properties": {
"HttpApiName": String,
"Protocols": List,
"BasePath": String,
"Description": String,
"Type": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
HttpApiName | String | 是 | 否 | API 名称。 | 无。 |
Protocols | List | 是 | 是 | API 访问协议列表。 | 取值:
|
BasePath | String | 否 | 是 | API 基础路径。 | 需要以/开头。 |
Description | String | 否 | 是 | API 描述。 | 无。 |
Type | String | 否 | 否 | HTTP API 的类型。 | 取值:
|
返回值
Fn::GetAtt
Environments:API 的发布环境信息。
HttpApiName:API 名称。
Type:HTTP API 的类型。
Protocols:API 访问协议列表。
Description:API 描述。
BasePath:API 基础路径。
HttpApiId:HTTP API ID。
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
HttpApiName:
Type: String
Description:
en: The name of the API.
Required: true
MinLength: 1
MaxLength: 64
Default: demo_api
Type:
Type: String
Description:
en: |-
The type of HTTP API, Valid values:
* Http
* Rest
* WebSocket
* HttpIngress
AllowedValues:
- Http
- Rest
- WebSocket
- HttpIngress
Default: Http
Required: false
Protocols:
AssociationPropertyMetadata:
Parameter:
Type: String
Description:
en: API protocol.
AllowedValues:
- HTTP
- HTTPS
Required: true
AssociationProperty: List[Parameter]
Type: Json
Description:
en: List of API Access Protocols.
Required: true
MaxLength: 2
Default:
- HTTP
BasePath:
Type: String
Description:
en: The base path of the API should start with a /.
Required: false
Default: /v1
Resources:
ExtensionResource:
Type: ALIYUN::APIG::HttpApi
Properties:
HttpApiName:
Ref: HttpApiName
Type:
Ref: Type
Protocols:
Ref: Protocols
BasePath:
Ref: BasePath
Outputs:
Environments:
Description: Published Environmental Information of the API.
Value:
Fn::GetAtt:
- ExtensionResource
- Environments
HttpApiName:
Description: The name of the API.
Value:
Fn::GetAtt:
- ExtensionResource
- HttpApiName
Type:
Description: The type of HTTP API
Value:
Fn::GetAtt:
- ExtensionResource
- Type
Protocols:
Description: List of API Access Protocols.
Value:
Fn::GetAtt:
- ExtensionResource
- Protocols
Description:
Description: Description of API.
Value:
Fn::GetAtt:
- ExtensionResource
- Description
BasePath:
Description: The base path of the API.
Value:
Fn::GetAtt:
- ExtensionResource
- BasePath
HttpApiId:
Description: The ID of the API.
Value:
Fn::GetAtt:
- ExtensionResource
- HttpApiId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"HttpApiName": {
"Type": "String",
"Description": {
"en": "The name of the API."
},
"Required": true,
"MinLength": 1,
"MaxLength": 64,
"Default": "demo_api"
},
"Type": {
"Type": "String",
"Description": {
"en": "The type of HTTP API, Valid values:\n* Http\n* Rest\n* WebSocket\n* HttpIngress"
},
"AllowedValues": [
"Http",
"Rest",
"WebSocket",
"HttpIngress"
],
"Default": "Http",
"Required": false
},
"Protocols": {
"AssociationPropertyMetadata": {
"Parameter": {
"Type": "String",
"Description": {
"en": "API protocol."
},
"AllowedValues": [
"HTTP",
"HTTPS"
],
"Required": true
}
},
"AssociationProperty": "List[Parameter]",
"Type": "Json",
"Description": {
"en": "List of API Access Protocols."
},
"Required": true,
"MaxLength": 2,
"Default": [
"HTTP"
]
},
"BasePath": {
"Type": "String",
"Description": {
"en": "The base path of the API should start with a /."
},
"Required": false,
"Default": "/v1"
}
},
"Resources": {
"ExtensionResource": {
"Type": "ALIYUN::APIG::HttpApi",
"Properties": {
"HttpApiName": {
"Ref": "HttpApiName"
},
"Type": {
"Ref": "Type"
},
"Protocols": {
"Ref": "Protocols"
},
"BasePath": {
"Ref": "BasePath"
}
}
}
},
"Outputs": {
"Environments": {
"Description": "Published Environmental Information of the API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Environments"
]
}
},
"HttpApiName": {
"Description": "The name of the API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"HttpApiName"
]
}
},
"Type": {
"Description": "The type of HTTP API",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Type"
]
}
},
"Protocols": {
"Description": "List of API Access Protocols.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Protocols"
]
}
},
"Description": {
"Description": "Description of API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Description"
]
}
},
"BasePath": {
"Description": "The base path of the API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"BasePath"
]
}
},
"HttpApiId": {
"Description": "The ID of the API.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"HttpApiId"
]
}
}
}
}
文档内容是否对您有帮助?