Skip to content

Commit

Permalink
Add docs/tests for API Gateway customizations
Browse files Browse the repository at this point in the history
This adds documentation and protocol tests for the customizations
required to generate an API Gateway client.
  • Loading branch information
kstich authored and JordonPhillips committed Feb 5, 2021
1 parent fafbe88 commit 4bbe4f4
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions docs/source/1.0/spec/aws/customizations/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==========================
AWS Service Customizations
==========================

.. rst-class:: large-toctree

.. toctree::
:maxdepth: 2

apigateway-customizations
glacier-customizations
4 changes: 2 additions & 2 deletions docs/source/1.0/spec/aws/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ AWS Service Customizations
.. rst-class:: large-toctree

.. toctree::
:maxdepth: 3
:maxdepth: 2

glacier-customizations
customizations/index
174 changes: 174 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/services/apigateway.smithy
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4bbe4f4

Please sign in to comment.