我正试图建立一个自大的模板来调用我的全部在一个λ。
假设在processlambda下面有两个“函数”。这是一个正确的openapi 3.0模板,还是必须专门配置请求类型和响应类型?
{
"openapi": "3.0.0",
"info": {
"version": "2016-09-12T17:50:37Z",
"title": "ProxyIntegrationWithLambda"
},
"paths": {
"/GetItemById": {
"x-amazon-apigateway-any-method": {
"parameters": [
{
"name": "proxy",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:SimpleLambda4ProxyResource/invocations",
"passthroughBehavior": "when_no_match",
"httpMethod": "POST",
"cacheNamespace": "roq9wj",
"cacheKeyParameters": [
"method.request.path.proxy"
],
"type": "aws_proxy"
}
}
}
},
"/SaveItem": {
"x-amazon-apigateway-any-method": {
"parameters": [
{
"name": "proxy",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200"
}
},
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:SimpleLambda4ProxyResource/invocations",
"passthroughBehavior": "when_no_match",
"httpMethod": "POST",
"cacheNamespace": "roq9wj",
"cacheKeyParameters": [
"method.request.path.proxy"
],
"type": "aws_proxy"
}
}
}
},
"servers": [
{
"url": "https://gy415nuibc.execute-api.us-east-1.amazonaws.com/{basePath}",
"variables": {
"basePath": {
"default": "/Process"
}
}
}
]
}
尚未对此进行测试,但C#函数代码使用APIGateway响应/请求标准aws对象
发布于 2019-05-08 07:37:45
作为另一种选择,您可以使用的一个好路径是配置您的API (指向AWS ),然后从API配置中生成您的openapi规范,然后生成您的c#客户机。
配置了After之后,您可以运行以下步骤:
运行出口,例如:
aws apoigateway get-export
--rest-api-id 'idfromapigateway-grab-inside-awsdashboard'
--stage-namem 'stage-grab-inside-awsdashboard'
--export-type 'swagger' outputfile-with-openapispec-generated-step1.json
步骤2) 生成客户端,例如:
nswag swagger2csclient /input:outputfile-with-openapispec-generated-step1.json
/classname:SpecifyYourCSharpClassName
/namespace:SpecifyYourCSharpNamespace
/output:SpecifyYourCSharpFile
步骤2的结果生成可用于集成测试的c#类。
https://stackoverflow.com/questions/56040691
复制相似问题