ALIYUN::APIG::ApiAttachment is used to attach an API.
Syntax
{
"Type": "ALIYUN::APIG::ApiAttachment",
"Properties": {
"BackendScene": String,
"EnvironmentId": String,
"HttpApiId": String,
"ServiceConfigs": List,
"Description": String,
"DomainIds": List,
"RouteId": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
BackendScene | String | Yes | No | The scenario in which you want to publish the API. | Valid values:
|
EnvironmentId | String | Yes | No | The ID of the environment. | None. |
HttpApiId | String | Yes | No | The ID of the HTTP API. | None. |
ServiceConfigs | List | Yes | No | The service configurations. | For more information, see ServiceConfigs properties. |
Description | String | No | No | The description. | None. |
DomainIds | List | No | No | The IDs of the custom domain names. | You can specify up to 10 IDs. |
RouteId | String | No | No | The ID of the route. | None. |
ServiceConfigs syntax
"ServiceConfigs": [
{
"Version": String,
"Port": Integer,
"Protocol": String,
"Weight": Integer,
"ServiceId": String,
"Match": Map
}
]
ServiceConfigs properties
Property | Type | Required | Editable | Description | Constraint |
ServiceId | String | Yes | No | The ID of the service. | None. |
Weight | Integer | Yes | No | The weight of the service. | Valid values: 1 to 100. |
Match | Map | No | No | The configurations of the matching conditions during the API deployment. | For more information, see Match properties. |
Port | Integer | No | No | The port of the service. | None. |
Protocol | String | No | No | The protocol type supported by the domain name. | Valid values:
|
Version | String | No | No | The version of the service. | None. |
Match syntax
"Match": {
"DefaultMatch": Boolean,
"Conditions": List
}
Match properties
Property | Type | Required | Editable | Description | Constraint |
Conditions | List | No | No | The configurations of the matching conditions. | For more information, see Conditions properties. |
DefaultMatch | Boolean | No | No | Specifies whether the matching condition is the default one. | None. |
Conditions syntax
"Conditions": [
{
"Operator": String,
"Type": String,
"Value": String,
"Key": String
}
]
Conditions properties
Property | Type | Required | Editable | Description | Constraint |
Key | String | No | No | The key of the matching condition. | None. |
Operator | String | No | No | The operator. | Exact match, prefix match, and regular expressions are supported. Valid values:
|
Type | String | No | No | The matching type. | Query and Header parameters can be matched. |
Value | String | No | No | The value of the matching condition. | None. |
Return values
Fn::GetAtt
EnvironmentId: the ID of the environment.
RouteId: the ID of the route.
HttpApiId: the ID of the HTTP API.
Examples
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"
]
}
}
}
}