Skip to content

Commit 7ae6a95

Browse files
committed
chore(codegen): code generation of clients
1 parent 03fd56a commit 7ae6a95

File tree

43 files changed

+1870
-673
lines changed

Some content is hidden

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

43 files changed

+1870
-673
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -686,17 +686,17 @@ export const se_SendApiAssetCommand = async (
686686
): Promise<__HttpRequest> => {
687687
const b = rb(input, context);
688688
const headers: any = map({}, isSerializableHeaderValue, {
689+
...(input.RequestHeaders !== undefined &&
690+
Object.keys(input.RequestHeaders).reduce((acc: any, suffix: string) => {
691+
acc[`x-amzn-dataexchange-header-${suffix.toLowerCase()}`] = input.RequestHeaders![suffix];
692+
return acc;
693+
}, {})),
689694
"content-type": "text/plain",
690695
[_xadai]: input[_AI]!,
691696
[_xaddsi]: input[_DSI]!,
692697
[_xadhm]: input[_M]!,
693698
[_xadp]: input[_P]!,
694699
[_xadri]: input[_RI]!,
695-
...(input.RequestHeaders !== undefined &&
696-
Object.keys(input.RequestHeaders).reduce((acc: any, suffix: string) => {
697-
acc[`x-amzn-dataexchange-header-${suffix.toLowerCase()}`] = input.RequestHeaders![suffix];
698-
return acc;
699-
}, {})),
700700
});
701701
b.bp("/v1");
702702
const query: any = map({

clients/client-s3-control/src/models/models_1.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
StorageLensTag,
2020
Tag,
2121
} from "./models_0";
22+
2223
import { S3ControlServiceException as __BaseException } from "./S3ControlServiceException";
2324

2425
/**

clients/client-s3/src/protocols/Aws_restXml.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ export const se_CopyObjectCommand = async (
547547
): Promise<__HttpRequest> => {
548548
const b = rb(input, context);
549549
const headers: any = map({}, isSerializableHeaderValue, {
550+
...(input.Metadata !== undefined &&
551+
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
552+
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
553+
return acc;
554+
}, {})),
550555
[_xaa]: input[_ACL]!,
551556
[_cc]: input[_CC]!,
552557
[_xaca]: input[_CA]!,
@@ -585,11 +590,6 @@ export const se_CopyObjectCommand = async (
585590
[_xaollh]: input[_OLLHS]!,
586591
[_xaebo]: input[_EBO]!,
587592
[_xasebo]: input[_ESBO]!,
588-
...(input.Metadata !== undefined &&
589-
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
590-
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
591-
return acc;
592-
}, {})),
593593
});
594594
b.bp("/{Key+}");
595595
b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
@@ -675,6 +675,11 @@ export const se_CreateMultipartUploadCommand = async (
675675
): Promise<__HttpRequest> => {
676676
const b = rb(input, context);
677677
const headers: any = map({}, isSerializableHeaderValue, {
678+
...(input.Metadata !== undefined &&
679+
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
680+
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
681+
return acc;
682+
}, {})),
678683
[_xaa]: input[_ACL]!,
679684
[_cc]: input[_CC]!,
680685
[_cd]: input[_CD]!,
@@ -703,11 +708,6 @@ export const se_CreateMultipartUploadCommand = async (
703708
[_xaebo]: input[_EBO]!,
704709
[_xaca]: input[_CA]!,
705710
[_xact]: input[_CT]!,
706-
...(input.Metadata !== undefined &&
707-
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
708-
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
709-
return acc;
710-
}, {})),
711711
});
712712
b.bp("/{Key+}");
713713
b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
@@ -2722,6 +2722,11 @@ export const se_PutObjectCommand = async (
27222722
): Promise<__HttpRequest> => {
27232723
const b = rb(input, context);
27242724
const headers: any = map({}, isSerializableHeaderValue, {
2725+
...(input.Metadata !== undefined &&
2726+
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
2727+
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
2728+
return acc;
2729+
}, {})),
27252730
[_ct]: input[_CTo] || "application/octet-stream",
27262731
[_xaa]: input[_ACL]!,
27272732
[_cc]: input[_CC]!,
@@ -2759,11 +2764,6 @@ export const se_PutObjectCommand = async (
27592764
[_xaolrud]: [() => isSerializableHeaderValue(input[_OLRUD]), () => __serializeDateTime(input[_OLRUD]!).toString()],
27602765
[_xaollh]: input[_OLLHS]!,
27612766
[_xaebo]: input[_EBO]!,
2762-
...(input.Metadata !== undefined &&
2763-
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
2764-
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
2765-
return acc;
2766-
}, {})),
27672767
});
27682768
b.bp("/{Key+}");
27692769
b.p("Bucket", () => input.Bucket!, "{Bucket}", false);
@@ -3158,6 +3158,11 @@ export const se_WriteGetObjectResponseCommand = async (
31583158
const b = rb(input, context);
31593159
const headers: any = map({}, isSerializableHeaderValue, {
31603160
"x-amz-content-sha256": "UNSIGNED-PAYLOAD",
3161+
...(input.Metadata !== undefined &&
3162+
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
3163+
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
3164+
return acc;
3165+
}, {})),
31613166
"content-type": "application/octet-stream",
31623167
[_xarr]: input[_RR]!,
31633168
[_xart]: input[_RT]!,
@@ -3201,11 +3206,6 @@ export const se_WriteGetObjectResponseCommand = async (
32013206
[_xafhxatc]: [() => isSerializableHeaderValue(input[_TC]), () => input[_TC]!.toString()],
32023207
[_xafhxavi]: input[_VI]!,
32033208
[_xafhxassebke]: [() => isSerializableHeaderValue(input[_BKE]), () => input[_BKE]!.toString()],
3204-
...(input.Metadata !== undefined &&
3205-
Object.keys(input.Metadata).reduce((acc: any, suffix: string) => {
3206-
acc[`x-amz-meta-${suffix.toLowerCase()}`] = input.Metadata![suffix];
3207-
return acc;
3208-
}, {})),
32093209
});
32103210
b.bp("/WriteGetObjectResponse");
32113211
let body: any;

private/aws-protocoltests-ec2/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,14 @@ HttpChecksumRequired
10581058

10591059
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/HttpChecksumRequiredCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpChecksumRequiredCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpChecksumRequiredCommandOutput/)
10601060

1061+
</details>
1062+
<details>
1063+
<summary>
1064+
HttpEmptyPrefixHeaders
1065+
</summary>
1066+
1067+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/HttpEmptyPrefixHeadersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpEmptyPrefixHeadersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpEmptyPrefixHeadersCommandOutput/)
1068+
10611069
</details>
10621070
<details>
10631071
<summary>
@@ -1986,6 +1994,14 @@ GreetingWithErrors
19861994

19871995
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/GreetingWithErrorsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/GreetingWithErrorsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/GreetingWithErrorsCommandOutput/)
19881996

1997+
</details>
1998+
<details>
1999+
<summary>
2000+
HttpEmptyPrefixHeaders
2001+
</summary>
2002+
2003+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/HttpEmptyPrefixHeadersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpEmptyPrefixHeadersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/HttpEmptyPrefixHeadersCommandOutput/)
2004+
19892005
</details>
19902006
<details>
19912007
<summary>

private/aws-protocoltests-json-10/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,14 @@ HttpChecksumRequired
10561056

10571057
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/HttpChecksumRequiredCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpChecksumRequiredCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpChecksumRequiredCommandOutput/)
10581058

1059+
</details>
1060+
<details>
1061+
<summary>
1062+
HttpEmptyPrefixHeaders
1063+
</summary>
1064+
1065+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/HttpEmptyPrefixHeadersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpEmptyPrefixHeadersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpEmptyPrefixHeadersCommandOutput/)
1066+
10591067
</details>
10601068
<details>
10611069
<summary>
@@ -1984,6 +1992,14 @@ GreetingWithErrors
19841992

19851993
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/GreetingWithErrorsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/GreetingWithErrorsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/GreetingWithErrorsCommandOutput/)
19861994

1995+
</details>
1996+
<details>
1997+
<summary>
1998+
HttpEmptyPrefixHeaders
1999+
</summary>
2000+
2001+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/HttpEmptyPrefixHeadersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpEmptyPrefixHeadersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/HttpEmptyPrefixHeadersCommandOutput/)
2002+
19872003
</details>
19882004
<details>
19892005
<summary>

private/aws-protocoltests-json-10/src/commands/GreetingWithErrorsCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ export interface GreetingWithErrorsCommandOutput extends GreetingWithErrorsOutpu
6060
* @throws {@link InvalidGreeting} (client fault)
6161
* This error is thrown when an invalid greeting value is provided.
6262
*
63+
* @throws {@link ComplexError} (client fault)
64+
* This error is thrown when a request is invalid.
65+
*
6366
* @throws {@link FooError} (server fault)
6467
* This error has test cases that test some of the dark corners of Amazon service
6568
* framework history. It should only be implemented by clients.
6669
*
67-
* @throws {@link ComplexError} (client fault)
68-
* This error is thrown when a request is invalid.
69-
*
7070
* @throws {@link JSONRPC10ServiceException}
7171
* <p>Base exception class for all service exceptions from JSONRPC10 service.</p>
7272
*

private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,97 @@ it("AwsJson10InvalidGreetingError:Error:GreetingWithErrors", async () => {
401401
fail("Expected an exception to be thrown from response");
402402
});
403403

404+
/**
405+
* Parses a complex error with no message member
406+
*/
407+
it("AwsJson10ComplexError:Error:GreetingWithErrors", async () => {
408+
const client = new JSONRPC10Client({
409+
...clientParams,
410+
requestHandler: new ResponseDeserializationTestHandler(
411+
false,
412+
400,
413+
{
414+
"content-type": "application/x-amz-json-1.0",
415+
},
416+
`{
417+
"__type": "aws.protocoltests.json10#ComplexError",
418+
"TopLevel": "Top level",
419+
"Nested": {
420+
"Foo": "bar"
421+
}
422+
}`
423+
),
424+
});
425+
426+
const params: any = {};
427+
const command = new GreetingWithErrorsCommand(params);
428+
429+
try {
430+
await client.send(command);
431+
} catch (err) {
432+
if (err.name !== "ComplexError") {
433+
console.log(err);
434+
fail(`Expected a ComplexError to be thrown, got ${err.name} instead`);
435+
return;
436+
}
437+
const r: any = err;
438+
expect(r["$metadata"].httpStatusCode).toBe(400);
439+
const paramsToValidate: any = [
440+
{
441+
TopLevel: "Top level",
442+
Nested: {
443+
Foo: "bar",
444+
},
445+
},
446+
][0];
447+
Object.keys(paramsToValidate).forEach((param) => {
448+
expect(
449+
r[param],
450+
`The output field ${param} should have been defined in ${JSON.stringify(r, null, 2)}`
451+
).toBeDefined();
452+
expect(equivalentContents(paramsToValidate[param], r[param])).toBe(true);
453+
});
454+
return;
455+
}
456+
fail("Expected an exception to be thrown from response");
457+
});
458+
459+
/**
460+
* Parses a complex error with an empty body
461+
*/
462+
it("AwsJson10EmptyComplexError:Error:GreetingWithErrors", async () => {
463+
const client = new JSONRPC10Client({
464+
...clientParams,
465+
requestHandler: new ResponseDeserializationTestHandler(
466+
false,
467+
400,
468+
{
469+
"content-type": "application/x-amz-json-1.0",
470+
},
471+
`{
472+
"__type": "aws.protocoltests.json10#ComplexError"
473+
}`
474+
),
475+
});
476+
477+
const params: any = {};
478+
const command = new GreetingWithErrorsCommand(params);
479+
480+
try {
481+
await client.send(command);
482+
} catch (err) {
483+
if (err.name !== "ComplexError") {
484+
console.log(err);
485+
fail(`Expected a ComplexError to be thrown, got ${err.name} instead`);
486+
return;
487+
}
488+
const r: any = err;
489+
expect(r["$metadata"].httpStatusCode).toBe(400);
490+
return;
491+
}
492+
fail("Expected an exception to be thrown from response");
493+
});
494+
404495
/**
405496
* Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS.
406497
*/
@@ -710,97 +801,6 @@ it("AwsJson10FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as
710801
fail("Expected an exception to be thrown from response");
711802
});
712803

713-
/**
714-
* Parses a complex error with no message member
715-
*/
716-
it("AwsJson10ComplexError:Error:GreetingWithErrors", async () => {
717-
const client = new JSONRPC10Client({
718-
...clientParams,
719-
requestHandler: new ResponseDeserializationTestHandler(
720-
false,
721-
400,
722-
{
723-
"content-type": "application/x-amz-json-1.0",
724-
},
725-
`{
726-
"__type": "aws.protocoltests.json10#ComplexError",
727-
"TopLevel": "Top level",
728-
"Nested": {
729-
"Foo": "bar"
730-
}
731-
}`
732-
),
733-
});
734-
735-
const params: any = {};
736-
const command = new GreetingWithErrorsCommand(params);
737-
738-
try {
739-
await client.send(command);
740-
} catch (err) {
741-
if (err.name !== "ComplexError") {
742-
console.log(err);
743-
fail(`Expected a ComplexError to be thrown, got ${err.name} instead`);
744-
return;
745-
}
746-
const r: any = err;
747-
expect(r["$metadata"].httpStatusCode).toBe(400);
748-
const paramsToValidate: any = [
749-
{
750-
TopLevel: "Top level",
751-
Nested: {
752-
Foo: "bar",
753-
},
754-
},
755-
][0];
756-
Object.keys(paramsToValidate).forEach((param) => {
757-
expect(
758-
r[param],
759-
`The output field ${param} should have been defined in ${JSON.stringify(r, null, 2)}`
760-
).toBeDefined();
761-
expect(equivalentContents(paramsToValidate[param], r[param])).toBe(true);
762-
});
763-
return;
764-
}
765-
fail("Expected an exception to be thrown from response");
766-
});
767-
768-
/**
769-
* Parses a complex error with an empty body
770-
*/
771-
it("AwsJson10EmptyComplexError:Error:GreetingWithErrors", async () => {
772-
const client = new JSONRPC10Client({
773-
...clientParams,
774-
requestHandler: new ResponseDeserializationTestHandler(
775-
false,
776-
400,
777-
{
778-
"content-type": "application/x-amz-json-1.0",
779-
},
780-
`{
781-
"__type": "aws.protocoltests.json10#ComplexError"
782-
}`
783-
),
784-
});
785-
786-
const params: any = {};
787-
const command = new GreetingWithErrorsCommand(params);
788-
789-
try {
790-
await client.send(command);
791-
} catch (err) {
792-
if (err.name !== "ComplexError") {
793-
console.log(err);
794-
fail(`Expected a ComplexError to be thrown, got ${err.name} instead`);
795-
return;
796-
}
797-
const r: any = err;
798-
expect(r["$metadata"].httpStatusCode).toBe(400);
799-
return;
800-
}
801-
fail("Expected an exception to be thrown from response");
802-
});
803-
804804
/**
805805
* Custom endpoints supplied by users can have paths
806806
*/

0 commit comments

Comments
 (0)