ALIYUN::APIG::Operation is used to create an operation for an HTTP API.
Syntax
{
"Type": "ALIYUN::APIG::Operation",
"Properties": {
"HttpApiId": String,
"Method": String,
"OperationName": String,
"Path": String,
"Description": String,
"Mock": Map
}
}Properties
Property | Type | Required | Editable | Description | Constraint |
HttpApiId | String | Yes | No | The ID of the HTTP API for which you want to create the operation. | None. |
Method | String | Yes | Yes | The method. | Valid values:
|
OperationName | String | Yes | Yes | The operation name. | None. |
Path | String | Yes | Yes | The path of the operation. | None. |
Description | String | No | Yes | The description of the operation. | None. |
Mock | Map | No | Yes | The Mock configurations of the operation. | This property takes effect only when the API is published to the Mock scenario. For more information, see Mock properties. |
Mock syntax
"Mock": {
"ResponseContent": String,
"ResponseCode": Integer,
"Enable": Boolean
}Mock properties
Property | Type | Required | Editable | Description | Constraint |
ResponseCode | Integer | Yes | Yes | The response code. | None. |
Enable | Boolean | No | Yes | Specifies whether to enable the Mock feature. | None. |
ResponseContent | String | No | Yes | The response content. | None. |
Return values
Fn::GetAtt
Path: the path of the operation.
Description: the description of the operation.
OperationName: the operation name.
OperationId: the operation ID.
CreateTime: the time when the operation was created.
Method: the method of the operation.
Mock: the Mock configurations of the operation.
Examples
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"
]
}
}
}
}