Skip to content

Commit

Permalink
feat: update clients
Browse files Browse the repository at this point in the history
* [aws#694](aws#694)
* [smithy-typescript#66](smithy-lang/smithy-typescript#66)
* [smithy-typescript#87](smithy-lang/smithy-typescript#87)
  • Loading branch information
AllanZhengYP committed Jan 10, 2020
1 parent 3e9599c commit d5220c8
Show file tree
Hide file tree
Showing 184 changed files with 26,235 additions and 33,799 deletions.
247 changes: 131 additions & 116 deletions clients/client-acm-pca/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

170 changes: 93 additions & 77 deletions clients/client-acm/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

623 changes: 313 additions & 310 deletions clients/client-alexa-for-business/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

548 changes: 190 additions & 358 deletions clients/client-amplify/protocols/Aws_restJson1_1.ts

Large diffs are not rendered by default.

1,679 changes: 548 additions & 1,131 deletions clients/client-api-gateway/protocols/Aws_restJson1_1.ts

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions clients/client-apigatewaymanagementapi/protocols/Aws_restJson1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ async function deserializeAws_restJson1_1DeleteConnectionCommandError(
output: __HttpResponse,
context: __SerdeContext
): Promise<DeleteConnectionCommandOutput> {
const data: any = await parseBody(output.body, context);
const parsedOutput: any = {
...output,
body: data
};
let response: __SmithyException & __MetadataBearer;
let errorCode: String = "UnknownError";
if (output.headers["x-amzn-errortype"]) {
Expand All @@ -149,21 +144,21 @@ async function deserializeAws_restJson1_1DeleteConnectionCommandError(
case "ForbiddenException":
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
response = await deserializeAws_restJson1_1ForbiddenExceptionResponse(
parsedOutput,
output,
context
);
break;
case "GoneException":
case "com.amazonaws.apigatewaymanagementapi#GoneException":
response = await deserializeAws_restJson1_1GoneExceptionResponse(
parsedOutput,
output,
context
);
break;
case "LimitExceededException":
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
response = await deserializeAws_restJson1_1LimitExceededExceptionResponse(
parsedOutput,
output,
context
);
break;
Expand Down Expand Up @@ -211,11 +206,6 @@ async function deserializeAws_restJson1_1GetConnectionCommandError(
output: __HttpResponse,
context: __SerdeContext
): Promise<GetConnectionCommandOutput> {
const data: any = await parseBody(output.body, context);
const parsedOutput: any = {
...output,
body: data
};
let response: __SmithyException & __MetadataBearer;
let errorCode: String = "UnknownError";
if (output.headers["x-amzn-errortype"]) {
Expand All @@ -225,21 +215,21 @@ async function deserializeAws_restJson1_1GetConnectionCommandError(
case "ForbiddenException":
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
response = await deserializeAws_restJson1_1ForbiddenExceptionResponse(
parsedOutput,
output,
context
);
break;
case "GoneException":
case "com.amazonaws.apigatewaymanagementapi#GoneException":
response = await deserializeAws_restJson1_1GoneExceptionResponse(
parsedOutput,
output,
context
);
break;
case "LimitExceededException":
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
response = await deserializeAws_restJson1_1LimitExceededExceptionResponse(
parsedOutput,
output,
context
);
break;
Expand Down Expand Up @@ -273,11 +263,6 @@ async function deserializeAws_restJson1_1PostToConnectionCommandError(
output: __HttpResponse,
context: __SerdeContext
): Promise<PostToConnectionCommandOutput> {
const data: any = await parseBody(output.body, context);
const parsedOutput: any = {
...output,
body: data
};
let response: __SmithyException & __MetadataBearer;
let errorCode: String = "UnknownError";
if (output.headers["x-amzn-errortype"]) {
Expand All @@ -287,28 +272,28 @@ async function deserializeAws_restJson1_1PostToConnectionCommandError(
case "ForbiddenException":
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
response = await deserializeAws_restJson1_1ForbiddenExceptionResponse(
parsedOutput,
output,
context
);
break;
case "GoneException":
case "com.amazonaws.apigatewaymanagementapi#GoneException":
response = await deserializeAws_restJson1_1GoneExceptionResponse(
parsedOutput,
output,
context
);
break;
case "LimitExceededException":
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
response = await deserializeAws_restJson1_1LimitExceededExceptionResponse(
parsedOutput,
output,
context
);
break;
case "PayloadTooLargeException":
case "com.amazonaws.apigatewaymanagementapi#PayloadTooLargeException":
response = await deserializeAws_restJson1_1PayloadTooLargeExceptionResponse(
parsedOutput,
output,
context
);
break;
Expand Down Expand Up @@ -368,7 +353,7 @@ const deserializeAws_restJson1_1PayloadTooLargeExceptionResponse = async (
$metadata: deserializeMetadata(output),
Message: undefined
};
const data: any = output.body;
const data: any = await parseBody(output.body, context);
if (data.message !== undefined) {
contents.Message = data.message;
}
Expand Down Expand Up @@ -399,9 +384,26 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
requestId: output.headers["x-amzn-requestid"]
});

// Collect low-level response body stream to Uint8Array.
const collectBody = (
streamBody: any,
context: __SerdeContext
): Promise<Uint8Array> => {
return context.streamCollector(streamBody) || new Uint8Array();
};

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (
streamBody: any,
context: __SerdeContext
): Promise<string> => {
return collectBody(streamBody, context).then(body =>
context.utf8Encoder(body)
);
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return context.streamCollector(streamBody).then((body: any) => {
const encoded = context.utf8Encoder(body);
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
return JSON.parse(encoded);
}
Expand Down
Loading

0 comments on commit d5220c8

Please sign in to comment.