Skip to content

Commit d4c302b

Browse files
authored
fix: stop adding command mw repeatedly in resolveMiddleware() (#1883)
When sending the same command multiple times, resolveMiddleware() will be called many times. So adding serde middleware will throw error because they are already added into stack. This change prevents adding the serde middleware repeatedly. Alternative is moving command middleware to the command constructor, just like in client(that's why client doesn't have the problem). But the command middleware also have depdency over client configs supplied from resolveMiddleware(). So serde middleware and customizations must live here. ref: #1864
1 parent b8542d8 commit d4c302b

File tree

8,945 files changed

+45024
-9244
lines changed

Some content is hidden

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

8,945 files changed

+45024
-9244
lines changed

Diff for: clients/client-accessanalyzer/commands/CreateAnalyzerCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class CreateAnalyzerCommand extends $Command<
2828
CreateAnalyzerCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class CreateAnalyzerCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<CreateAnalyzerCommandInput, CreateAnalyzerCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/CreateArchiveRuleCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class CreateArchiveRuleCommand extends $Command<
2929
CreateArchiveRuleCommandOutput,
3030
AccessAnalyzerClientResolvedConfig
3131
> {
32+
private resolved = false;
3233
// Start section: command_properties
3334
// End section: command_properties
3435

@@ -46,7 +47,10 @@ export class CreateArchiveRuleCommand extends $Command<
4647
configuration: AccessAnalyzerClientResolvedConfig,
4748
options?: __HttpHandlerOptions
4849
): Handler<CreateArchiveRuleCommandInput, CreateArchiveRuleCommandOutput> {
49-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
50+
if (!this.resolved) {
51+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
52+
this.resolved = true;
53+
}
5054

5155
const stack = clientStack.concat(this.middlewareStack);
5256

Diff for: clients/client-accessanalyzer/commands/DeleteAnalyzerCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class DeleteAnalyzerCommand extends $Command<
3030
DeleteAnalyzerCommandOutput,
3131
AccessAnalyzerClientResolvedConfig
3232
> {
33+
private resolved = false;
3334
// Start section: command_properties
3435
// End section: command_properties
3536

@@ -47,7 +48,10 @@ export class DeleteAnalyzerCommand extends $Command<
4748
configuration: AccessAnalyzerClientResolvedConfig,
4849
options?: __HttpHandlerOptions
4950
): Handler<DeleteAnalyzerCommandInput, DeleteAnalyzerCommandOutput> {
50-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
if (!this.resolved) {
52+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
53+
this.resolved = true;
54+
}
5155

5256
const stack = clientStack.concat(this.middlewareStack);
5357

Diff for: clients/client-accessanalyzer/commands/DeleteArchiveRuleCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class DeleteArchiveRuleCommand extends $Command<
2828
DeleteArchiveRuleCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class DeleteArchiveRuleCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<DeleteArchiveRuleCommandInput, DeleteArchiveRuleCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/GetAnalyzedResourceCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class GetAnalyzedResourceCommand extends $Command<
2828
GetAnalyzedResourceCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class GetAnalyzedResourceCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<GetAnalyzedResourceCommandInput, GetAnalyzedResourceCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/GetAnalyzerCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class GetAnalyzerCommand extends $Command<
2828
GetAnalyzerCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class GetAnalyzerCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<GetAnalyzerCommandInput, GetAnalyzerCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/GetArchiveRuleCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class GetArchiveRuleCommand extends $Command<
2828
GetArchiveRuleCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class GetArchiveRuleCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<GetArchiveRuleCommandInput, GetArchiveRuleCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/GetFindingCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class GetFindingCommand extends $Command<
2828
GetFindingCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class GetFindingCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<GetFindingCommandInput, GetFindingCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/ListAnalyzedResourcesCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class ListAnalyzedResourcesCommand extends $Command<
2929
ListAnalyzedResourcesCommandOutput,
3030
AccessAnalyzerClientResolvedConfig
3131
> {
32+
private resolved = false;
3233
// Start section: command_properties
3334
// End section: command_properties
3435

@@ -46,7 +47,10 @@ export class ListAnalyzedResourcesCommand extends $Command<
4647
configuration: AccessAnalyzerClientResolvedConfig,
4748
options?: __HttpHandlerOptions
4849
): Handler<ListAnalyzedResourcesCommandInput, ListAnalyzedResourcesCommandOutput> {
49-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
50+
if (!this.resolved) {
51+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
52+
this.resolved = true;
53+
}
5054

5155
const stack = clientStack.concat(this.middlewareStack);
5256

Diff for: clients/client-accessanalyzer/commands/ListAnalyzersCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ListAnalyzersCommand extends $Command<
2828
ListAnalyzersCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class ListAnalyzersCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<ListAnalyzersCommandInput, ListAnalyzersCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/ListArchiveRulesCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ListArchiveRulesCommand extends $Command<
2828
ListArchiveRulesCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class ListArchiveRulesCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<ListArchiveRulesCommandInput, ListArchiveRulesCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/ListFindingsCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ListFindingsCommand extends $Command<
2828
ListFindingsCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class ListFindingsCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<ListFindingsCommandInput, ListFindingsCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/ListTagsForResourceCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ListTagsForResourceCommand extends $Command<
2828
ListTagsForResourceCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class ListTagsForResourceCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<ListTagsForResourceCommandInput, ListTagsForResourceCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/StartResourceScanCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class StartResourceScanCommand extends $Command<
2828
StartResourceScanCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class StartResourceScanCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<StartResourceScanCommandInput, StartResourceScanCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/TagResourceCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class TagResourceCommand extends $Command<
2828
TagResourceCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class TagResourceCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<TagResourceCommandInput, TagResourceCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/UntagResourceCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class UntagResourceCommand extends $Command<
2828
UntagResourceCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class UntagResourceCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<UntagResourceCommandInput, UntagResourceCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/UpdateArchiveRuleCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class UpdateArchiveRuleCommand extends $Command<
2828
UpdateArchiveRuleCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class UpdateArchiveRuleCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<UpdateArchiveRuleCommandInput, UpdateArchiveRuleCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-accessanalyzer/commands/UpdateFindingsCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class UpdateFindingsCommand extends $Command<
2828
UpdateFindingsCommandOutput,
2929
AccessAnalyzerClientResolvedConfig
3030
> {
31+
private resolved = false;
3132
// Start section: command_properties
3233
// End section: command_properties
3334

@@ -45,7 +46,10 @@ export class UpdateFindingsCommand extends $Command<
4546
configuration: AccessAnalyzerClientResolvedConfig,
4647
options?: __HttpHandlerOptions
4748
): Handler<UpdateFindingsCommandInput, UpdateFindingsCommandOutput> {
48-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
49+
if (!this.resolved) {
50+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
51+
this.resolved = true;
52+
}
4953

5054
const stack = clientStack.concat(this.middlewareStack);
5155

Diff for: clients/client-acm-pca/commands/CreateCertificateAuthorityAuditReportCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class CreateCertificateAuthorityAuditReportCommand extends $Command<
4747
CreateCertificateAuthorityAuditReportCommandOutput,
4848
ACMPCAClientResolvedConfig
4949
> {
50+
private resolved = false;
5051
// Start section: command_properties
5152
// End section: command_properties
5253

@@ -64,7 +65,10 @@ export class CreateCertificateAuthorityAuditReportCommand extends $Command<
6465
configuration: ACMPCAClientResolvedConfig,
6566
options?: __HttpHandlerOptions
6667
): Handler<CreateCertificateAuthorityAuditReportCommandInput, CreateCertificateAuthorityAuditReportCommandOutput> {
67-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
68+
if (!this.resolved) {
69+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
70+
this.resolved = true;
71+
}
6872

6973
const stack = clientStack.concat(this.middlewareStack);
7074

Diff for: clients/client-acm-pca/commands/CreateCertificateAuthorityCommand.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class CreateCertificateAuthorityCommand extends $Command<
4646
CreateCertificateAuthorityCommandOutput,
4747
ACMPCAClientResolvedConfig
4848
> {
49+
private resolved = false;
4950
// Start section: command_properties
5051
// End section: command_properties
5152

@@ -63,7 +64,10 @@ export class CreateCertificateAuthorityCommand extends $Command<
6364
configuration: ACMPCAClientResolvedConfig,
6465
options?: __HttpHandlerOptions
6566
): Handler<CreateCertificateAuthorityCommandInput, CreateCertificateAuthorityCommandOutput> {
66-
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
67+
if (!this.resolved) {
68+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
69+
this.resolved = true;
70+
}
6771

6872
const stack = clientStack.concat(this.middlewareStack);
6973

0 commit comments

Comments
 (0)