本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
x-amazon-apigateway-integrations 物件
定義整合的集合。您可以在 Open API 定義的元件區段中定義整合,並針對多個路由重複使用這些整合。僅支援 HTTPAPIs.
屬性名稱 | 類型 | 描述 |
---|---|---|
integration |
x-amazon-apigateway-integration 物件 | 整合物件的集合。 |
x-amazon-apigateway-integrations 例子
下列範例會建立HTTPAPI定義兩個整合,並使用來參考整合$ref": "#/components/x-amazon-apigateway-integrations/
。integration-name
{ "openapi": "3.0.1", "info": { "title": "Integrations", "description": "An API that reuses integrations", "version": "1.0" }, "servers": [ { "url": "https://example.com/{basePath}", "description": "The production API server", "variables": { "basePath": { "default": "example/path" } } }], "paths": { "/": { "get": { "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration1" } } }, "/pets": { "get": { "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration1" } } }, "/checkout": { "get": { "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration2" } } } }, "components": { "x-amazon-apigateway-integrations": { "integration1": { "type": "aws_proxy", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:123456789012:function:
my-function
/invocations", "passthroughBehavior": "when_no_templates", "payloadFormatVersion": "1.0" }, "integration2": { "type": "aws_proxy", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-2:123456789012:function:example-function
/invocations", "passthroughBehavior": "when_no_templates", "payloadFormatVersion" : "1.0" } } } }