x-amazon-apigateway-api-key-source 属性 - Amazon API Gateway
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

x-amazon-apigateway-api-key-source 属性

指定源来接收 API 密钥,用于限制获得密钥的 API 方法。此 API 级别属性是 String 类型。

为请求指定 API 密钥的源。有效值为:

  • HEADER 用于从请求的 X-API-Key 标头接收 API 密钥。

  • AUTHORIZER 用于从 Lambda 授权方(以前称为自定义授权方)接收 UsageIdentifierKey 的 API 密钥。

x-amazon-apigateway-api-密钥源示例

以下示例将 X-API-Key 标头设置为 API 密钥源。

OpenAPI 2.0
{ "swagger" : "2.0", "info" : { "title" : "Test1" }, "schemes" : [ "https" ], "basePath" : "/import", "x-amazon-apigateway-api-key-source" : "HEADER", . . . }
OpenAPI 3.0.1
{ "openapi" : "3.0.1", "info" : { "title" : "Test1" }, "servers" : [ { "url" : "/{basePath}", "variables" : { "basePath" : { "default" : "import" } } } ], "x-amazon-apigateway-api-key-source" : "HEADER", . . . }