From fb8212f4838d4201a67f5ca11fcf26e231f52b00 Mon Sep 17 00:00:00 2001 From: kstich Date: Thu, 4 Feb 2021 16:34:34 -0800 Subject: [PATCH] Add docs/tests for API Gateway customizations This adds documentation and protocol tests for the customizations required to generate an API Gateway client. --- .../apigateway-customizations.rst | 16 ++ .../glacier-customizations.rst | 0 .../1.0/spec/aws/customizations/index.rst | 11 ++ docs/source/1.0/spec/aws/index.rst | 4 +- .../restJson1/services/apigateway.smithy | 174 ++++++++++++++++++ 5 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 docs/source/1.0/spec/aws/customizations/apigateway-customizations.rst rename docs/source/1.0/spec/aws/{ => customizations}/glacier-customizations.rst (100%) create mode 100644 docs/source/1.0/spec/aws/customizations/index.rst create mode 100644 smithy-aws-protocol-tests/model/restJson1/services/apigateway.smithy diff --git a/docs/source/1.0/spec/aws/customizations/apigateway-customizations.rst b/docs/source/1.0/spec/aws/customizations/apigateway-customizations.rst new file mode 100644 index 00000000000..4ad61fed8af --- /dev/null +++ b/docs/source/1.0/spec/aws/customizations/apigateway-customizations.rst @@ -0,0 +1,16 @@ +================================= +Amazon API Gateway Customizations +================================= + +.. contents:: Table of contents + :depth: 1 + :local: + :backlinks: none + + +-------------------------------- +``Accept`` header +-------------------------------- + +A client for Amazon API Gateway MUST set the ``Accept`` header to the string +literal value of "application/json" for all requests. diff --git a/docs/source/1.0/spec/aws/glacier-customizations.rst b/docs/source/1.0/spec/aws/customizations/glacier-customizations.rst similarity index 100% rename from docs/source/1.0/spec/aws/glacier-customizations.rst rename to docs/source/1.0/spec/aws/customizations/glacier-customizations.rst diff --git a/docs/source/1.0/spec/aws/customizations/index.rst b/docs/source/1.0/spec/aws/customizations/index.rst new file mode 100644 index 00000000000..47050c8b9a3 --- /dev/null +++ b/docs/source/1.0/spec/aws/customizations/index.rst @@ -0,0 +1,11 @@ +========================== +AWS Service Customizations +========================== + +.. rst-class:: large-toctree + +.. toctree:: + :maxdepth: 2 + + apigateway-customizations + glacier-customizations diff --git a/docs/source/1.0/spec/aws/index.rst b/docs/source/1.0/spec/aws/index.rst index 24ff030a119..3225fa6fbb8 100644 --- a/docs/source/1.0/spec/aws/index.rst +++ b/docs/source/1.0/spec/aws/index.rst @@ -35,6 +35,6 @@ AWS Service Customizations .. rst-class:: large-toctree .. toctree:: - :maxdepth: 3 + :maxdepth: 2 - glacier-customizations + customizations/index diff --git a/smithy-aws-protocol-tests/model/restJson1/services/apigateway.smithy b/smithy-aws-protocol-tests/model/restJson1/services/apigateway.smithy new file mode 100644 index 00000000000..db6f1e58e01 --- /dev/null +++ b/smithy-aws-protocol-tests/model/restJson1/services/apigateway.smithy @@ -0,0 +1,174 @@ +$version: "1.0" + +namespace com.amazonaws.apigateway + +use aws.api#service +use aws.auth#sigv4 +use aws.protocols#restJson1 +use smithy.test#httpRequestTests + +@service( + sdkId: "API Gateway", + arnNamespace: "apigateway", + cloudFormationName: "ApiGateway", + cloudTrailEventSource: "apigateway.amazonaws.com", + endpointPrefix: "apigateway" +) +@sigv4( + name: "apigateway", +) +@restJson1 +@title("Amazon API Gateway") +service BackplaneControlService { + version: "2015-07-09", + operations: [ + GetRestApis, + ], +} + + +@httpRequestTests([ + { + id: "ApiGatewayAccept", + documentation: "API Gateway requires that this Accept header is set on all requests.", + protocol: restJson1, + method: "GET", + uri: "/restapis", + headers: { + "Accept": "application/json", + }, + body: "", + params: {}, + } +]) +@http( + method: "GET", + uri: "/restapis", + code: 200, +) +@paginated( + inputToken: "position", + outputToken: "position", + items: "items", + pageSize: "limit", +) +@readonly +operation GetRestApis { + input: GetRestApisRequest, + output: RestApis, + errors: [ + BadRequestException, + TooManyRequestsException, + UnauthorizedException, + ], +} + +@error("client") +@httpError(400) +structure BadRequestException { + message: String, +} + +structure EndpointConfiguration { + types: ListOfEndpointType, + vpcEndpointIds: ListOfString, +} + +structure GetRestApisRequest { + @httpQuery("position") + position: String, + + @httpQuery("limit") + limit: NullableInteger, +} + +structure RestApi { + id: String, + name: String, + description: String, + createdDate: Timestamp, + version: String, + warnings: ListOfString, + binaryMediaTypes: ListOfString, + minimumCompressionSize: NullableInteger, + apiKeySource: ApiKeySourceType, + endpointConfiguration: EndpointConfiguration, + policy: String, + tags: MapOfStringToString, + disableExecuteApiEndpoint: Boolean, +} + +structure RestApis { + @jsonName("item") + items: ListOfRestApi, + + @httpQuery("position") + position: String, +} + +@error("client") +@httpError(429) +structure TooManyRequestsException { + @httpHeader("Retry-After") + retryAfterSeconds: String, + message: String, +} + +@error("client") +@httpError(401) +structure UnauthorizedException { + message: String, +} + +list ListOfEndpointType { + member: EndpointType, +} + +list ListOfString { + member: String, +} + +list ListOfRestApi { + member: RestApi, +} + +map MapOfStringToString { + key: String, + value: String, +} + +@enum([ + { + value: "HEADER", + name: "HEADER", + }, + { + value: "AUTHORIZER", + name: "AUTHORIZER", + }, +]) +string ApiKeySourceType + +boolean Boolean +@enum([ + { + value: "REGIONAL", + name: "REGIONAL", + }, + { + value: "EDGE", + name: "EDGE", + }, + { + value: "PRIVATE", + name: "PRIVATE", + }, +]) +string EndpointType + +@box +integer NullableInteger + +string String + +timestamp Timestamp