ALIYUN::APIG::Operation类型用于为HTTP API创建接口。
语法
{
"Type": "ALIYUN::APIG::Operation",
"Properties": {
"HttpApiId": String,
"Method": String,
"OperationName": String,
"Path": String,
"Description": String,
"Mock": Map
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
HttpApiId | String | 是 | 否 | 创建接口所属的 HTTP API ID。 | 无 |
Method | String | 是 | 是 | 方法。 | 枚举值:
|
OperationName | String | 是 | 是 | 接口名称。 | 无 |
Path | String | 是 | 是 | 接口路径。 | 无 |
Description | String | 否 | 是 | 接口描述。 | 无 |
Mock | Map | 否 | 是 | 接口 Mock 配置。 | 仅当 API 发布场景为 Mock 时生效。更多信息,请参见Mock属性。 |
Mock语法
"Mock": {
"ResponseContent": String,
"ResponseCode": Integer,
"Enable": Boolean
}
Mock属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
ResponseCode | Integer | 是 | 是 | 响应码。 | 无 |
Enable | Boolean | 否 | 是 | 是否启用 Mock。 | 无 |
ResponseContent | String | 否 | 是 | 响应内容。 | 无 |
返回值
Fn::GetAtt
Path:接口路径。
Description:接口描述。
OperationName:接口名称。
OperationId:接口ID。
CreateTime:接口的创建时间。
Method:接口方法。
Mock:接口 Mock 参数配置。
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
ExtensionResource:
Type: ALIYUN::APIG::Operation
Properties:
HttpApiId: api-csxxxxxxxxx
OperationName: GetUserInfo2
Path: /user
Method: GET
Outputs:
Path:
Description: The interface path of the operation.
Value:
Fn::GetAtt:
- ExtensionResource
- Path
Description:
Description: The description of the operation.
Value:
Fn::GetAtt:
- ExtensionResource
- Description
OperationName:
Description: The name of the resource.
Value:
Fn::GetAtt:
- ExtensionResource
- OperationName
OperationId:
Description: The ID of the operation.
Value:
Fn::GetAtt:
- ExtensionResource
- OperationId
CreateTime:
Description: The creation timestamp of the operation.
Value:
Fn::GetAtt:
- ExtensionResource
- CreateTime
Method:
Description: The method of http protocol.
Value:
Fn::GetAtt:
- ExtensionResource
- Method
Mock:
Description: Mock configuration.
Value:
Fn::GetAtt:
- ExtensionResource
- Mock
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
},
"Resources": {
"ExtensionResource": {
"Type": "ALIYUN::APIG::Operation",
"Properties": {
"HttpApiId": "api-csxxxxxxxxx",
"OperationName": "GetUserInfo2",
"Path": "/user",
"Method": "GET"
}
}
},
"Outputs": {
"Path": {
"Description": "The interface path of the operation.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Path"
]
}
},
"Description": {
"Description": "The description of the operation.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Description"
]
}
},
"OperationName": {
"Description": "The name of the resource.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"OperationName"
]
}
},
"OperationId": {
"Description": "The ID of the operation.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"OperationId"
]
}
},
"CreateTime": {
"Description": "The creation timestamp of the operation.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"CreateTime"
]
}
},
"Method": {
"Description": "The method of http protocol.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Method"
]
}
},
"Mock": {
"Description": "Mock configuration.",
"Value": {
"Fn::GetAtt": [
"ExtensionResource",
"Mock"
]
}
}
}
}
文档内容是否对您有帮助?