Cria uma operação para uma API HTTP.
Sintaxe
{
"Type": "ALIYUN::APIG::Operation",
"Properties": {
"HttpApiId": String,
"Method": String,
"OperationName": String,
"Path": String,
"Description": String,
"Mock": Map
}
}
Propriedades
|
Propriedade |
Tipo |
Obrigatório |
Editável |
Descrição |
Restrição |
|
HttpApiId |
String |
Sim |
Não |
ID da API HTTP para a qual crie a operação. |
Nenhuma. |
|
Method |
String |
Sim |
Sim |
Método de solicitação HTTP. |
Valores válidos:
|
|
OperationName |
String |
Sim |
Sim |
Nome da operação. |
Nenhuma. |
|
Path |
String |
Sim |
Sim |
Caminho da operação. |
Nenhuma. |
|
Description |
String |
Não |
Sim |
Descrição da operação. |
Nenhuma. |
|
Mock |
Map |
Não |
Sim |
Configurações de Mock da operação. |
Válido apenas quando a API é publicada no cenário Mock. Para obter mais informações, consulte Propriedades de Mock. |
Sintaxe de Mock
"Mock": {
"ResponseContent": String,
"ResponseCode": Integer,
"Enable": Boolean
}
Propriedades de Mock
|
Propriedade |
Tipo |
Obrigatório |
Editável |
Descrição |
Restrição |
|
ResponseCode |
Integer |
Sim |
Sim |
Código de resposta. |
Nenhuma. |
|
Enable |
Boolean |
Não |
Sim |
Especifica se o recurso Mock deve ser ativado. |
Nenhuma. |
|
ResponseContent |
String |
Não |
Sim |
Conteúdo da resposta. |
Nenhuma. |
Valores de retorno
Fn::GetAtt
Path: caminho da operação.
Description: descrição da operação.
OperationName: nome da operação.
OperationId: ID da operação.
CreateTime: hora de criação da operação.
Method: método da operação.
Mock: configurações de Mock da operação.
Exemplos
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"
]
}
}
}
}