Skip to content

Commit a8d38d7

Browse files
committed
chore(aws-restjson-server): generate with [email protected]
1 parent bab2c4e commit a8d38d7

File tree

8 files changed

+1213
-75
lines changed

8 files changed

+1213
-75
lines changed

private/aws-restjson-server/src/models/models_0.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3355,6 +3355,38 @@ export namespace MalformedContentTypeWithGenericStringInput {
33553355
};
33563356
}
33573357

3358+
/**
3359+
* @public
3360+
*/
3361+
export interface MalformedContentTypeWithoutBodyEmptyInputInput {
3362+
header?: string | undefined;
3363+
}
3364+
3365+
export namespace MalformedContentTypeWithoutBodyEmptyInputInput {
3366+
const memberValidators: {
3367+
header?: __MultiConstraintValidator<string>;
3368+
} = {};
3369+
/**
3370+
* @internal
3371+
*/
3372+
export const validate = (obj: MalformedContentTypeWithoutBodyEmptyInputInput, path = ""): __ValidationFailure[] => {
3373+
function getMemberValidator<T extends keyof typeof memberValidators>(
3374+
member: T
3375+
): NonNullable<(typeof memberValidators)[T]> {
3376+
if (memberValidators[member] === undefined) {
3377+
switch (member) {
3378+
case "header": {
3379+
memberValidators["header"] = new __NoOpValidator();
3380+
break;
3381+
}
3382+
}
3383+
}
3384+
return memberValidators[member]!;
3385+
}
3386+
return [...getMemberValidator("header").validate(obj.header, `${path}/header`)];
3387+
};
3388+
}
3389+
33583390
/**
33593391
* @public
33603392
*/
@@ -5546,6 +5578,62 @@ export namespace QueryPrecedenceInput {
55465578
};
55475579
}
55485580

5581+
/**
5582+
* @public
5583+
*/
5584+
export interface ResponseCodeHttpFallbackInputOutput {}
5585+
5586+
export namespace ResponseCodeHttpFallbackInputOutput {
5587+
const memberValidators: {} = {};
5588+
/**
5589+
* @internal
5590+
*/
5591+
export const validate = (obj: ResponseCodeHttpFallbackInputOutput, path = ""): __ValidationFailure[] => {
5592+
function getMemberValidator<T extends keyof typeof memberValidators>(
5593+
member: T
5594+
): NonNullable<(typeof memberValidators)[T]> {
5595+
if (memberValidators[member] === undefined) {
5596+
switch (member) {
5597+
}
5598+
}
5599+
return memberValidators[member]!;
5600+
}
5601+
return [];
5602+
};
5603+
}
5604+
5605+
/**
5606+
* @public
5607+
*/
5608+
export interface ResponseCodeRequiredOutput {
5609+
responseCode: number | undefined;
5610+
}
5611+
5612+
export namespace ResponseCodeRequiredOutput {
5613+
const memberValidators: {
5614+
responseCode?: __MultiConstraintValidator<number>;
5615+
} = {};
5616+
/**
5617+
* @internal
5618+
*/
5619+
export const validate = (obj: ResponseCodeRequiredOutput, path = ""): __ValidationFailure[] => {
5620+
function getMemberValidator<T extends keyof typeof memberValidators>(
5621+
member: T
5622+
): NonNullable<(typeof memberValidators)[T]> {
5623+
if (memberValidators[member] === undefined) {
5624+
switch (member) {
5625+
case "responseCode": {
5626+
memberValidators["responseCode"] = new __CompositeValidator<number>([new __RequiredValidator()]);
5627+
break;
5628+
}
5629+
}
5630+
}
5631+
return memberValidators[member]!;
5632+
}
5633+
return [...getMemberValidator("responseCode").validate(obj.responseCode, `${path}/responseCode`)];
5634+
};
5635+
}
5636+
55495637
/**
55505638
* @public
55515639
*/

private/aws-restjson-server/src/protocols/Aws_restJson1.ts

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ import {
213213
MalformedContentTypeWithoutBodyServerInput,
214214
MalformedContentTypeWithoutBodyServerOutput,
215215
} from "../server/operations/MalformedContentTypeWithoutBody";
216+
import {
217+
MalformedContentTypeWithoutBodyEmptyInputServerInput,
218+
MalformedContentTypeWithoutBodyEmptyInputServerOutput,
219+
} from "../server/operations/MalformedContentTypeWithoutBodyEmptyInput";
216220
import {
217221
MalformedContentTypeWithPayloadServerInput,
218222
MalformedContentTypeWithPayloadServerOutput,
@@ -324,6 +328,14 @@ import {
324328
} from "../server/operations/QueryParamsAsStringListMap";
325329
import { QueryPrecedenceServerInput, QueryPrecedenceServerOutput } from "../server/operations/QueryPrecedence";
326330
import { RecursiveShapesServerInput, RecursiveShapesServerOutput } from "../server/operations/RecursiveShapes";
331+
import {
332+
ResponseCodeHttpFallbackServerInput,
333+
ResponseCodeHttpFallbackServerOutput,
334+
} from "../server/operations/ResponseCodeHttpFallback";
335+
import {
336+
ResponseCodeRequiredServerInput,
337+
ResponseCodeRequiredServerOutput,
338+
} from "../server/operations/ResponseCodeRequired";
327339
import {
328340
SimpleScalarPropertiesServerInput,
329341
SimpleScalarPropertiesServerOutput,
@@ -2032,6 +2044,33 @@ export const deserializeMalformedContentTypeWithoutBodyRequest = async (
20322044
return contents;
20332045
};
20342046

2047+
export const deserializeMalformedContentTypeWithoutBodyEmptyInputRequest = async (
2048+
output: __HttpRequest,
2049+
context: __SerdeContext
2050+
): Promise<MalformedContentTypeWithoutBodyEmptyInputServerInput> => {
2051+
const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find(
2052+
(key) => key.toLowerCase() === "content-type"
2053+
);
2054+
if (contentTypeHeaderKey != null) {
2055+
const contentType = output.headers[contentTypeHeaderKey];
2056+
if (contentType !== undefined && contentType !== "application/json") {
2057+
throw new __UnsupportedMediaTypeException();
2058+
}
2059+
}
2060+
const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept");
2061+
if (acceptHeaderKey != null) {
2062+
const accept = output.headers[acceptHeaderKey];
2063+
if (!__acceptMatches(accept, "application/json")) {
2064+
throw new __NotAcceptableException();
2065+
}
2066+
}
2067+
const contents: any = map({
2068+
[_h]: [, output.headers[_h]],
2069+
});
2070+
await collectBody(output.body, context);
2071+
return contents;
2072+
};
2073+
20352074
export const deserializeMalformedContentTypeWithPayloadRequest = async (
20362075
output: __HttpRequest,
20372076
context: __SerdeContext
@@ -3438,6 +3477,56 @@ export const deserializeRecursiveShapesRequest = async (
34383477
return contents;
34393478
};
34403479

3480+
export const deserializeResponseCodeHttpFallbackRequest = async (
3481+
output: __HttpRequest,
3482+
context: __SerdeContext
3483+
): Promise<ResponseCodeHttpFallbackServerInput> => {
3484+
const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find(
3485+
(key) => key.toLowerCase() === "content-type"
3486+
);
3487+
if (contentTypeHeaderKey != null) {
3488+
const contentType = output.headers[contentTypeHeaderKey];
3489+
if (contentType !== undefined && contentType !== "application/json") {
3490+
throw new __UnsupportedMediaTypeException();
3491+
}
3492+
}
3493+
const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept");
3494+
if (acceptHeaderKey != null) {
3495+
const accept = output.headers[acceptHeaderKey];
3496+
if (!__acceptMatches(accept, "application/json")) {
3497+
throw new __NotAcceptableException();
3498+
}
3499+
}
3500+
const contents: any = map({});
3501+
await collectBody(output.body, context);
3502+
return contents;
3503+
};
3504+
3505+
export const deserializeResponseCodeRequiredRequest = async (
3506+
output: __HttpRequest,
3507+
context: __SerdeContext
3508+
): Promise<ResponseCodeRequiredServerInput> => {
3509+
const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find(
3510+
(key) => key.toLowerCase() === "content-type"
3511+
);
3512+
if (contentTypeHeaderKey != null) {
3513+
const contentType = output.headers[contentTypeHeaderKey];
3514+
if (contentType !== undefined) {
3515+
throw new __UnsupportedMediaTypeException();
3516+
}
3517+
}
3518+
const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept");
3519+
if (acceptHeaderKey != null) {
3520+
const accept = output.headers[acceptHeaderKey];
3521+
if (!__acceptMatches(accept, "application/json")) {
3522+
throw new __NotAcceptableException();
3523+
}
3524+
}
3525+
const contents: any = map({});
3526+
await collectBody(output.body, context);
3527+
return contents;
3528+
};
3529+
34413530
export const deserializeSimpleScalarPropertiesRequest = async (
34423531
output: __HttpRequest,
34433532
context: __SerdeContext
@@ -5701,6 +5790,40 @@ export const serializeMalformedContentTypeWithoutBodyResponse = async (
57015790
});
57025791
};
57035792

5793+
export const serializeMalformedContentTypeWithoutBodyEmptyInputResponse = async (
5794+
input: MalformedContentTypeWithoutBodyEmptyInputServerOutput,
5795+
ctx: ServerSerdeContext
5796+
): Promise<__HttpResponse> => {
5797+
const context: __SerdeContext = {
5798+
...ctx,
5799+
endpoint: () =>
5800+
Promise.resolve({
5801+
protocol: "",
5802+
hostname: "",
5803+
path: "",
5804+
}),
5805+
};
5806+
const statusCode = 200;
5807+
let headers: any = map({}, isSerializableHeaderValue, {});
5808+
let body: any;
5809+
if (
5810+
body &&
5811+
Object.keys(headers)
5812+
.map((str) => str.toLowerCase())
5813+
.indexOf("content-length") === -1
5814+
) {
5815+
const length = calculateBodyLength(body);
5816+
if (length !== undefined) {
5817+
headers = { ...headers, "content-length": String(length) };
5818+
}
5819+
}
5820+
return new __HttpResponse({
5821+
headers,
5822+
body,
5823+
statusCode,
5824+
});
5825+
};
5826+
57045827
export const serializeMalformedContentTypeWithPayloadResponse = async (
57055828
input: MalformedContentTypeWithPayloadServerOutput,
57065829
ctx: ServerSerdeContext
@@ -7113,6 +7236,83 @@ export const serializeRecursiveShapesResponse = async (
71137236
});
71147237
};
71157238

7239+
export const serializeResponseCodeHttpFallbackResponse = async (
7240+
input: ResponseCodeHttpFallbackServerOutput,
7241+
ctx: ServerSerdeContext
7242+
): Promise<__HttpResponse> => {
7243+
const context: __SerdeContext = {
7244+
...ctx,
7245+
endpoint: () =>
7246+
Promise.resolve({
7247+
protocol: "",
7248+
hostname: "",
7249+
path: "",
7250+
}),
7251+
};
7252+
const statusCode = 201;
7253+
let headers: any = map({}, isSerializableHeaderValue, {
7254+
"content-type": "application/json",
7255+
});
7256+
let body: any;
7257+
body = "{}";
7258+
if (
7259+
body &&
7260+
Object.keys(headers)
7261+
.map((str) => str.toLowerCase())
7262+
.indexOf("content-length") === -1
7263+
) {
7264+
const length = calculateBodyLength(body);
7265+
if (length !== undefined) {
7266+
headers = { ...headers, "content-length": String(length) };
7267+
}
7268+
}
7269+
return new __HttpResponse({
7270+
headers,
7271+
body,
7272+
statusCode,
7273+
});
7274+
};
7275+
7276+
export const serializeResponseCodeRequiredResponse = async (
7277+
input: ResponseCodeRequiredServerOutput,
7278+
ctx: ServerSerdeContext
7279+
): Promise<__HttpResponse> => {
7280+
const context: __SerdeContext = {
7281+
...ctx,
7282+
endpoint: () =>
7283+
Promise.resolve({
7284+
protocol: "",
7285+
hostname: "",
7286+
path: "",
7287+
}),
7288+
};
7289+
let statusCode = 200;
7290+
if (input.responseCode !== undefined) {
7291+
statusCode = input.responseCode;
7292+
}
7293+
let headers: any = map({}, isSerializableHeaderValue, {
7294+
"content-type": "application/json",
7295+
});
7296+
let body: any;
7297+
body = "{}";
7298+
if (
7299+
body &&
7300+
Object.keys(headers)
7301+
.map((str) => str.toLowerCase())
7302+
.indexOf("content-length") === -1
7303+
) {
7304+
const length = calculateBodyLength(body);
7305+
if (length !== undefined) {
7306+
headers = { ...headers, "content-length": String(length) };
7307+
}
7308+
}
7309+
return new __HttpResponse({
7310+
headers,
7311+
body,
7312+
statusCode,
7313+
});
7314+
};
7315+
71167316
export const serializeSimpleScalarPropertiesResponse = async (
71177317
input: SimpleScalarPropertiesServerOutput,
71187318
ctx: ServerSerdeContext
@@ -9169,6 +9369,7 @@ const _f = "foo";
91699369
const _fIH = "floatInHeader";
91709370
const _fl = "floatinheader";
91719371
const _g = "greeting";
9372+
const _h = "header";
91729373
const _hB = "headerByte";
91739374
const _hBL = "headerBooleanList";
91749375
const _hD = "headerDouble";

0 commit comments

Comments
 (0)