ALIYUN::APIG::HttpApi is used to create an HTTP API.
Syntax
{
"Type": "ALIYUN::APIG::HttpApi",
"Properties": {
"HttpApiName": String,
"Protocols": List,
"BasePath": String,
"Description": String,
"Type": String
}
}Properties
Property | Type | Required | Editable | Description | Constraint |
HttpApiName | String | Yes | No | The API name. | None. |
Protocols | List | Yes | Yes | The protocols that are used to access the API. | Valid values:
|
BasePath | String | No | Yes | The base path of the API. | The path must start with a forward slash (/). |
Description | String | No | Yes | The description of the API. | None. |
Type | String | No | No | The API type. | Valid values:
|
Return values
Fn::GetAtt
Environments: the environments to which the API is published.
HttpApiName: the API name.
Type: the API type.
Protocols: the protocols that are used to access the API.
Description: the description of the API.
BasePath: the base path of the API.
HttpApiId: the API ID.
Examples
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"
]
}
}
}
}