Amazon S3 のプロキシとしてのサンプル API の OpenAPI 定義 - Amazon API Gateway

Amazon S3 のプロキシとしてのサンプル API の OpenAPI 定義

以下の OpenAPI 定義では、Amazon S3 のプロキシとして動作する API について説明しています。この API には、チュートリアルで作成した API よりも多くの Amazon S3 オペレーションが含まれています。OpenAPI 定義では以下のメソッドが公開されています。

OpenAPI 定義を使用して API をインポートする方法については、「OpenAPI を使用した REST API の設定」を参照してください。

同様の API を作成する方法の手順については、「チュートリアル: API Gateway で REST API を Amazon S3 のプロキシとして作成する」を参照してください。

この API を、AWS IAM 認証をサポートする Postman を使用して呼び出す方法については、「REST API クライアントを使用して API を呼び出す」を参照してください。

OpenAPI 2.0
{ "swagger": "2.0", "info": { "version": "2016-10-13T23:04:43Z", "title": "MyS3" }, "host": "9gn28ca086.execute-api.{region}.amazonaws.com", "basePath": "/S3", "schemes": [ "https" ], "paths": { "/": { "get": { "produces": [ "application/json" ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Timestamp": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Content-Length": "integration.response.header.Content-Length", "method.response.header.Timestamp": "integration.response.header.Date" } }, "5\\d{2}": { "statusCode": "500" } }, "uri": "arn:aws:apigateway:us-west-2:s3:path//", "passthroughBehavior": "when_no_match", "httpMethod": "GET", "type": "aws" } } }, "/{folder}": { "get": { "produces": [ "application/json" ], "parameters": [ { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Date": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Date": "integration.response.header.Date", "method.response.header.Content-Length": "integration.response.header.content-length" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.bucket": "method.request.path.folder" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "passthroughBehavior": "when_no_match", "httpMethod": "GET", "type": "aws" } }, "put": { "produces": [ "application/json" ], "parameters": [ { "name": "Content-Type", "in": "header", "required": false, "type": "string" }, { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Content-Length": "integration.response.header.Content-Length" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.bucket": "method.request.path.folder", "integration.request.header.Content-Type": "method.request.header.Content-Type" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "passthroughBehavior": "when_no_match", "httpMethod": "PUT", "type": "aws" } }, "delete": { "produces": [ "application/json" ], "parameters": [ { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Date": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Date": "integration.response.header.Date" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.bucket": "method.request.path.folder" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "passthroughBehavior": "when_no_match", "httpMethod": "DELETE", "type": "aws" } } }, "/{folder}/{item}": { "get": { "produces": [ "application/json" ], "parameters": [ { "name": "item", "in": "path", "required": true, "type": "string" }, { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "content-type": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.content-type": "integration.response.header.content-type", "method.response.header.Content-Type": "integration.response.header.Content-Type" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.object": "method.request.path.item", "integration.request.path.bucket": "method.request.path.folder" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "passthroughBehavior": "when_no_match", "httpMethod": "GET", "type": "aws" } }, "head": { "produces": [ "application/json" ], "parameters": [ { "name": "item", "in": "path", "required": true, "type": "string" }, { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Content-Length": "integration.response.header.Content-Length" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.object": "method.request.path.item", "integration.request.path.bucket": "method.request.path.folder" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "passthroughBehavior": "when_no_match", "httpMethod": "HEAD", "type": "aws" } }, "put": { "produces": [ "application/json" ], "parameters": [ { "name": "Content-Type", "in": "header", "required": false, "type": "string" }, { "name": "item", "in": "path", "required": true, "type": "string" }, { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-Type": "integration.response.header.Content-Type", "method.response.header.Content-Length": "integration.response.header.Content-Length" } }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.object": "method.request.path.item", "integration.request.path.bucket": "method.request.path.folder", "integration.request.header.Content-Type": "method.request.header.Content-Type" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "passthroughBehavior": "when_no_match", "httpMethod": "PUT", "type": "aws" } }, "delete": { "produces": [ "application/json" ], "parameters": [ { "name": "item", "in": "path", "required": true, "type": "string" }, { "name": "folder", "in": "path", "required": true, "type": "string" } ], "responses": { "200": { "description": "200 response", "schema": { "$ref": "#/definitions/Empty" }, "headers": { "Content-Length": { "type": "string" }, "Content-Type": { "type": "string" } } }, "400": { "description": "400 response" }, "500": { "description": "500 response" } }, "security": [ { "sigv4": [] } ], "x-amazon-apigateway-integration": { "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "responses": { "4\\d{2}": { "statusCode": "400" }, "default": { "statusCode": "200" }, "5\\d{2}": { "statusCode": "500" } }, "requestParameters": { "integration.request.path.object": "method.request.path.item", "integration.request.path.bucket": "method.request.path.folder" }, "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "passthroughBehavior": "when_no_match", "httpMethod": "DELETE", "type": "aws" } } } }, "securityDefinitions": { "sigv4": { "type": "apiKey", "name": "Authorization", "in": "header", "x-amazon-apigateway-authtype": "awsSigv4" } }, "definitions": { "Empty": { "type": "object", "title": "Empty Schema" } } }
OpenAPI 3.0
{ "openapi" : "3.0.1", "info" : { "title" : "MyS3", "version" : "2016-10-13T23:04:43Z" }, "servers" : [ { "url" : "https://9gn28ca086.execute-api.{region}.amazonaws.com/{basePath}", "variables" : { "basePath" : { "default" : "S3" } } } ], "paths" : { "/{folder}" : { "get" : { "parameters" : [ { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Date" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "GET", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Date" : "integration.response.header.Date", "method.response.header.Content-Length" : "integration.response.header.content-length" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.bucket" : "method.request.path.folder" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } }, "put" : { "parameters" : [ { "name" : "Content-Type", "in" : "header", "schema" : { "type" : "string" } }, { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "PUT", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Content-Length" : "integration.response.header.Content-Length" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.bucket" : "method.request.path.folder", "integration.request.header.Content-Type" : "method.request.header.Content-Type" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } }, "delete" : { "parameters" : [ { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Date" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "DELETE", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Date" : "integration.response.header.Date" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.bucket" : "method.request.path.folder" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } } }, "/{folder}/{item}" : { "get" : { "parameters" : [ { "name" : "item", "in" : "path", "required" : true, "schema" : { "type" : "string" } }, { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "content-type" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "GET", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.content-type" : "integration.response.header.content-type", "method.response.header.Content-Type" : "integration.response.header.Content-Type" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.object" : "method.request.path.item", "integration.request.path.bucket" : "method.request.path.folder" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } }, "put" : { "parameters" : [ { "name" : "Content-Type", "in" : "header", "schema" : { "type" : "string" } }, { "name" : "item", "in" : "path", "required" : true, "schema" : { "type" : "string" } }, { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "PUT", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Content-Length" : "integration.response.header.Content-Length" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.object" : "method.request.path.item", "integration.request.path.bucket" : "method.request.path.folder", "integration.request.header.Content-Type" : "method.request.header.Content-Type" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } }, "delete" : { "parameters" : [ { "name" : "item", "in" : "path", "required" : true, "schema" : { "type" : "string" } }, { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "DELETE", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200" }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.object" : "method.request.path.item", "integration.request.path.bucket" : "method.request.path.folder" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } }, "head" : { "parameters" : [ { "name" : "item", "in" : "path", "required" : true, "schema" : { "type" : "string" } }, { "name" : "folder", "in" : "path", "required" : true, "schema" : { "type" : "string" } } ], "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "HEAD", "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Content-Length" : "integration.response.header.Content-Length" } }, "5\\d{2}" : { "statusCode" : "500" } }, "requestParameters" : { "integration.request.path.object" : "method.request.path.item", "integration.request.path.bucket" : "method.request.path.folder" }, "passthroughBehavior" : "when_no_match", "type" : "aws" } } }, "/" : { "get" : { "responses" : { "400" : { "description" : "400 response", "content" : { } }, "500" : { "description" : "500 response", "content" : { } }, "200" : { "description" : "200 response", "headers" : { "Content-Length" : { "schema" : { "type" : "string" } }, "Timestamp" : { "schema" : { "type" : "string" } }, "Content-Type" : { "schema" : { "type" : "string" } } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Empty" } } } } }, "x-amazon-apigateway-integration" : { "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod" : "GET", "uri" : "arn:aws:apigateway:us-west-2:s3:path//", "responses" : { "4\\d{2}" : { "statusCode" : "400" }, "default" : { "statusCode" : "200", "responseParameters" : { "method.response.header.Content-Type" : "integration.response.header.Content-Type", "method.response.header.Content-Length" : "integration.response.header.Content-Length", "method.response.header.Timestamp" : "integration.response.header.Date" } }, "5\\d{2}" : { "statusCode" : "500" } }, "passthroughBehavior" : "when_no_match", "type" : "aws" } } } }, "components" : { "schemas" : { "Empty" : { "title" : "Empty Schema", "type" : "object" } } } }