Skip to content

Commit

Permalink
feat(clients): automatic blob type conversions (#4836)
Browse files Browse the repository at this point in the history
* feat(clients): automatic blob type conversions

* feat(clients): full codegen for blobs

* feat(clients): blob helper tests

* feat(smithy-client): use collectBody from smithy-client

* feat(clients): codegen cleanup
  • Loading branch information
kuhe authored Jun 20, 2023
1 parent 549f35d commit 60ec921
Show file tree
Hide file tree
Showing 861 changed files with 2,179 additions and 3,761 deletions.
2 changes: 1 addition & 1 deletion clients/client-accessanalyzer/src/AccessAnalyzerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectBoolean as __expectBoolean,
expectNonNull as __expectNonNull,
Expand Down Expand Up @@ -3322,14 +3323,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-account/src/AccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-account/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectNonNull as __expectNonNull,
expectObject as __expectObject,
Expand Down Expand Up @@ -967,14 +968,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-acm-pca/src/ACMPCAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-acm-pca/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectNonNull as __expectNonNull,
expectNumber as __expectNumber,
Expand Down Expand Up @@ -2376,14 +2377,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-acm/src/ACMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-acm/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectBoolean as __expectBoolean,
expectNonNull as __expectNonNull,
Expand Down Expand Up @@ -1598,14 +1599,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectInt32 as __expectInt32,
expectNonNull as __expectNonNull,
Expand Down Expand Up @@ -7151,14 +7152,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-amp/src/AmpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-amp/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectNonNull as __expectNonNull,
expectNumber as __expectNumber,
Expand Down Expand Up @@ -2263,14 +2264,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-amplify/src/AmplifyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-amplify/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectBoolean as __expectBoolean,
expectNonNull as __expectNonNull,
Expand Down Expand Up @@ -3777,14 +3778,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
2 changes: 1 addition & 1 deletion clients/client-amplifybackend/src/AmplifyBackendClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
9 changes: 1 addition & 8 deletions clients/client-amplifybackend/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectBoolean as __expectBoolean,
expectNonNull as __expectNonNull,
Expand Down Expand Up @@ -3891,14 +3892,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// smithy-typescript generated code
import {
_json,
collectBody,
decorateServiceException as __decorateServiceException,
expectBoolean as __expectBoolean,
expectInt32 as __expectInt32,
Expand Down Expand Up @@ -3705,14 +3706,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
cfId: output.headers["x-amz-cf-id"],
});

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

// Encode Uint8Array data into string with utf-8.
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
Expand Down
1 change: 1 addition & 0 deletions clients/client-api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@aws-sdk/util-defaults-mode-node": "*",
"@aws-sdk/util-endpoints": "*",
"@aws-sdk/util-retry": "*",
"@aws-sdk/util-stream": "*",
"@aws-sdk/util-user-agent-browser": "*",
"@aws-sdk/util-user-agent-node": "*",
"@aws-sdk/util-utf8": "*",
Expand Down
2 changes: 1 addition & 1 deletion clients/client-api-gateway/src/APIGatewayClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
runtime?: string;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* Disable dynamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
Expand Down
10 changes: 9 additions & 1 deletion clients/client-api-gateway/src/commands/GetExportCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MetadataBearer as __MetadataBearer,
MiddlewareStack,
} from "@aws-sdk/types";
import { Uint8ArrayBlobAdapter } from "@aws-sdk/util-stream";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { SerdeContext as __SerdeContext } from "@smithy/types";

Expand All @@ -27,12 +28,19 @@ export { __MetadataBearer, $Command };
* The input for {@link GetExportCommand}.
*/
export interface GetExportCommandInput extends GetExportRequest {}
/**
* @public
*/
export type GetExportCommandOutputType = Omit<ExportResponse, "body"> & {
body?: Uint8ArrayBlobAdapter;
};

/**
* @public
*
* The output of {@link GetExportCommand}.
*/
export interface GetExportCommandOutput extends ExportResponse, __MetadataBearer {}
export interface GetExportCommandOutput extends GetExportCommandOutputType, __MetadataBearer {}

/**
* @public
Expand Down
10 changes: 9 additions & 1 deletion clients/client-api-gateway/src/commands/GetSdkCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MetadataBearer as __MetadataBearer,
MiddlewareStack,
} from "@aws-sdk/types";
import { Uint8ArrayBlobAdapter } from "@aws-sdk/util-stream";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { SerdeContext as __SerdeContext } from "@smithy/types";

Expand All @@ -27,12 +28,19 @@ export { __MetadataBearer, $Command };
* The input for {@link GetSdkCommand}.
*/
export interface GetSdkCommandInput extends GetSdkRequest {}
/**
* @public
*/
export type GetSdkCommandOutputType = Omit<SdkResponse, "body"> & {
body?: Uint8ArrayBlobAdapter;
};

/**
* @public
*
* The output of {@link GetSdkCommand}.
*/
export interface GetSdkCommandOutput extends SdkResponse, __MetadataBearer {}
export interface GetSdkCommandOutput extends GetSdkCommandOutputType, __MetadataBearer {}

/**
* @public
Expand Down
10 changes: 9 additions & 1 deletion clients/client-api-gateway/src/commands/ImportApiKeysCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middl
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
BlobTypes,
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
Expand All @@ -21,12 +22,19 @@ import { de_ImportApiKeysCommand, se_ImportApiKeysCommand } from "../protocols/A
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*/
export type ImportApiKeysCommandInputType = Omit<ImportApiKeysRequest, "body"> & {
body: BlobTypes;
};

/**
* @public
*
* The input for {@link ImportApiKeysCommand}.
*/
export interface ImportApiKeysCommandInput extends ImportApiKeysRequest {}
export interface ImportApiKeysCommandInput extends ImportApiKeysCommandInputType {}
/**
* @public
*
Expand Down
Loading

0 comments on commit 60ec921

Please sign in to comment.