Skip to content

Commit 60ec921

Browse files
authored
feat(clients): automatic blob type conversions (#4836)
* 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
1 parent 549f35d commit 60ec921

File tree

861 files changed

+2179
-3761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

861 files changed

+2179
-3761
lines changed

clients/client-accessanalyzer/src/AccessAnalyzerClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
244244
runtime?: string;
245245

246246
/**
247-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
247+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
248248
* trait of an operation.
249249
*/
250250
disableHostPrefix?: boolean;

clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectBoolean as __expectBoolean,
67
expectNonNull as __expectNonNull,
@@ -3322,14 +3323,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
33223323
cfId: output.headers["x-amz-cf-id"],
33233324
});
33243325

3325-
// Collect low-level response body stream to Uint8Array.
3326-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
3327-
if (streamBody instanceof Uint8Array) {
3328-
return Promise.resolve(streamBody);
3329-
}
3330-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
3331-
};
3332-
33333326
// Encode Uint8Array data into string with utf-8.
33343327
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
33353328
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-account/src/AccountClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
178178
runtime?: string;
179179

180180
/**
181-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
181+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
182182
* trait of an operation.
183183
*/
184184
disableHostPrefix?: boolean;

clients/client-account/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectNonNull as __expectNonNull,
67
expectObject as __expectObject,
@@ -967,14 +968,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
967968
cfId: output.headers["x-amz-cf-id"],
968969
});
969970

970-
// Collect low-level response body stream to Uint8Array.
971-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
972-
if (streamBody instanceof Uint8Array) {
973-
return Promise.resolve(streamBody);
974-
}
975-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
976-
};
977-
978971
// Encode Uint8Array data into string with utf-8.
979972
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
980973
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-acm-pca/src/ACMPCAClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
244244
runtime?: string;
245245

246246
/**
247-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
247+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
248248
* trait of an operation.
249249
*/
250250
disableHostPrefix?: boolean;

clients/client-acm-pca/src/protocols/Aws_json1_1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectNonNull as __expectNonNull,
67
expectNumber as __expectNumber,
@@ -2376,14 +2377,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
23762377
cfId: output.headers["x-amz-cf-id"],
23772378
});
23782379

2379-
// Collect low-level response body stream to Uint8Array.
2380-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
2381-
if (streamBody instanceof Uint8Array) {
2382-
return Promise.resolve(streamBody);
2383-
}
2384-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2385-
};
2386-
23872380
// Encode Uint8Array data into string with utf-8.
23882381
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
23892382
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-acm/src/ACMClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
205205
runtime?: string;
206206

207207
/**
208-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
208+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
209209
* trait of an operation.
210210
*/
211211
disableHostPrefix?: boolean;

clients/client-acm/src/protocols/Aws_json1_1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectBoolean as __expectBoolean,
67
expectNonNull as __expectNonNull,
@@ -1598,14 +1599,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
15981599
cfId: output.headers["x-amz-cf-id"],
15991600
});
16001601

1601-
// Collect low-level response body stream to Uint8Array.
1602-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
1603-
if (streamBody instanceof Uint8Array) {
1604-
return Promise.resolve(streamBody);
1605-
}
1606-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1607-
};
1608-
16091602
// Encode Uint8Array data into string with utf-8.
16101603
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
16111604
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-alexa-for-business/src/AlexaForBusinessClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
532532
runtime?: string;
533533

534534
/**
535-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
535+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
536536
* trait of an operation.
537537
*/
538538
disableHostPrefix?: boolean;

clients/client-alexa-for-business/src/protocols/Aws_json1_1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectInt32 as __expectInt32,
67
expectNonNull as __expectNonNull,
@@ -7151,14 +7152,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
71517152
cfId: output.headers["x-amz-cf-id"],
71527153
});
71537154

7154-
// Collect low-level response body stream to Uint8Array.
7155-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
7156-
if (streamBody instanceof Uint8Array) {
7157-
return Promise.resolve(streamBody);
7158-
}
7159-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
7160-
};
7161-
71627155
// Encode Uint8Array data into string with utf-8.
71637156
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
71647157
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-amp/src/AmpClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
244244
runtime?: string;
245245

246246
/**
247-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
247+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
248248
* trait of an operation.
249249
*/
250250
disableHostPrefix?: boolean;

clients/client-amp/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectNonNull as __expectNonNull,
67
expectNumber as __expectNumber,
@@ -2263,14 +2264,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
22632264
cfId: output.headers["x-amz-cf-id"],
22642265
});
22652266

2266-
// Collect low-level response body stream to Uint8Array.
2267-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
2268-
if (streamBody instanceof Uint8Array) {
2269-
return Promise.resolve(streamBody);
2270-
}
2271-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2272-
};
2273-
22742267
// Encode Uint8Array data into string with utf-8.
22752268
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
22762269
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-amplify/src/AmplifyClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
277277
runtime?: string;
278278

279279
/**
280-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
280+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
281281
* trait of an operation.
282282
*/
283283
disableHostPrefix?: boolean;

clients/client-amplify/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectBoolean as __expectBoolean,
67
expectNonNull as __expectNonNull,
@@ -3777,14 +3778,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
37773778
cfId: output.headers["x-amz-cf-id"],
37783779
});
37793780

3780-
// Collect low-level response body stream to Uint8Array.
3781-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
3782-
if (streamBody instanceof Uint8Array) {
3783-
return Promise.resolve(streamBody);
3784-
}
3785-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
3786-
};
3787-
37883781
// Encode Uint8Array data into string with utf-8.
37893782
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
37903783
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-amplifybackend/src/AmplifyBackendClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
256256
runtime?: string;
257257

258258
/**
259-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
259+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
260260
* trait of an operation.
261261
*/
262262
disableHostPrefix?: boolean;

clients/client-amplifybackend/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectBoolean as __expectBoolean,
67
expectNonNull as __expectNonNull,
@@ -3891,14 +3892,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
38913892
cfId: output.headers["x-amz-cf-id"],
38923893
});
38933894

3894-
// Collect low-level response body stream to Uint8Array.
3895-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
3896-
if (streamBody instanceof Uint8Array) {
3897-
return Promise.resolve(streamBody);
3898-
}
3899-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
3900-
};
3901-
39023895
// Encode Uint8Array data into string with utf-8.
39033896
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
39043897
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-amplifyuibuilder/src/AmplifyUIBuilderClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
214214
runtime?: string;
215215

216216
/**
217-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
217+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
218218
* trait of an operation.
219219
*/
220220
disableHostPrefix?: boolean;

clients/client-amplifyuibuilder/src/protocols/Aws_restJson1.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
import {
33
_json,
4+
collectBody,
45
decorateServiceException as __decorateServiceException,
56
expectBoolean as __expectBoolean,
67
expectInt32 as __expectInt32,
@@ -3705,14 +3706,6 @@ const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
37053706
cfId: output.headers["x-amz-cf-id"],
37063707
});
37073708

3708-
// Collect low-level response body stream to Uint8Array.
3709-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
3710-
if (streamBody instanceof Uint8Array) {
3711-
return Promise.resolve(streamBody);
3712-
}
3713-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
3714-
};
3715-
37163709
// Encode Uint8Array data into string with utf-8.
37173710
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
37183711
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));

clients/client-api-gateway/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@aws-sdk/util-defaults-mode-node": "*",
5151
"@aws-sdk/util-endpoints": "*",
5252
"@aws-sdk/util-retry": "*",
53+
"@aws-sdk/util-stream": "*",
5354
"@aws-sdk/util-user-agent-browser": "*",
5455
"@aws-sdk/util-user-agent-node": "*",
5556
"@aws-sdk/util-utf8": "*",

clients/client-api-gateway/src/APIGatewayClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
605605
runtime?: string;
606606

607607
/**
608-
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
608+
* Disable dynamically changing the endpoint of the client based on the hostPrefix
609609
* trait of an operation.
610610
*/
611611
disableHostPrefix?: boolean;

clients/client-api-gateway/src/commands/GetExportCommand.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
MetadataBearer as __MetadataBearer,
1111
MiddlewareStack,
1212
} from "@aws-sdk/types";
13+
import { Uint8ArrayBlobAdapter } from "@aws-sdk/util-stream";
1314
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
1415
import { SerdeContext as __SerdeContext } from "@smithy/types";
1516

@@ -27,12 +28,19 @@ export { __MetadataBearer, $Command };
2728
* The input for {@link GetExportCommand}.
2829
*/
2930
export interface GetExportCommandInput extends GetExportRequest {}
31+
/**
32+
* @public
33+
*/
34+
export type GetExportCommandOutputType = Omit<ExportResponse, "body"> & {
35+
body?: Uint8ArrayBlobAdapter;
36+
};
37+
3038
/**
3139
* @public
3240
*
3341
* The output of {@link GetExportCommand}.
3442
*/
35-
export interface GetExportCommandOutput extends ExportResponse, __MetadataBearer {}
43+
export interface GetExportCommandOutput extends GetExportCommandOutputType, __MetadataBearer {}
3644

3745
/**
3846
* @public

clients/client-api-gateway/src/commands/GetSdkCommand.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
MetadataBearer as __MetadataBearer,
1111
MiddlewareStack,
1212
} from "@aws-sdk/types";
13+
import { Uint8ArrayBlobAdapter } from "@aws-sdk/util-stream";
1314
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
1415
import { SerdeContext as __SerdeContext } from "@smithy/types";
1516

@@ -27,12 +28,19 @@ export { __MetadataBearer, $Command };
2728
* The input for {@link GetSdkCommand}.
2829
*/
2930
export interface GetSdkCommandInput extends GetSdkRequest {}
31+
/**
32+
* @public
33+
*/
34+
export type GetSdkCommandOutputType = Omit<SdkResponse, "body"> & {
35+
body?: Uint8ArrayBlobAdapter;
36+
};
37+
3038
/**
3139
* @public
3240
*
3341
* The output of {@link GetSdkCommand}.
3442
*/
35-
export interface GetSdkCommandOutput extends SdkResponse, __MetadataBearer {}
43+
export interface GetSdkCommandOutput extends GetSdkCommandOutputType, __MetadataBearer {}
3644

3745
/**
3846
* @public

clients/client-api-gateway/src/commands/ImportApiKeysCommand.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middl
33
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
44
import { Command as $Command } from "@aws-sdk/smithy-client";
55
import {
6+
BlobTypes,
67
FinalizeHandlerArguments,
78
Handler,
89
HandlerExecutionContext,
@@ -21,12 +22,19 @@ import { de_ImportApiKeysCommand, se_ImportApiKeysCommand } from "../protocols/A
2122
* @public
2223
*/
2324
export { __MetadataBearer, $Command };
25+
/**
26+
* @public
27+
*/
28+
export type ImportApiKeysCommandInputType = Omit<ImportApiKeysRequest, "body"> & {
29+
body: BlobTypes;
30+
};
31+
2432
/**
2533
* @public
2634
*
2735
* The input for {@link ImportApiKeysCommand}.
2836
*/
29-
export interface ImportApiKeysCommandInput extends ImportApiKeysRequest {}
37+
export interface ImportApiKeysCommandInput extends ImportApiKeysCommandInputType {}
3038
/**
3139
* @public
3240
*

0 commit comments

Comments
 (0)