c#-AWS Lambda代理Swagger模板集成
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c#-AWS Lambda代理Swagger模板集成,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2267字,纯文字阅读大概需要4分钟。
内容图文
我正在尝试设置swagger模板以一次调用全部.
可以说在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#函数代码使用API??Gateway响应/请求标准arts对象
解决方法:
或者,您可以使用的一个好方法是配置API网关(指向AWS Lambda),然后从API Gateway配置中配置07??000您的openapi规范,然后配置generate您的c#客户端.
配置API网关后,您可以运行以下步骤:
第2步中的第1步,运行get-export,例如:
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步,共2步)Generate客户端,例如:
nswag swagger2csclient /input:outputfile-with-openapispec-generated-step1.json
/classname:SpecifyYourCSharpClassName
/namespace:SpecifyYourCSharpNamespace
/output:SpecifyYourCSharpFile
步骤2的结果将生成可用于集成测试的c#类.
内容总结
以上是互联网集市为您收集整理的c#-AWS Lambda代理Swagger模板集成全部内容,希望文章能够帮你解决c#-AWS Lambda代理Swagger模板集成所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。