Skip to content

Commit 488fda8

Browse files
committed
chore: move setting of discoveryCommandCtor to client config
1 parent 94478c6 commit 488fda8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

clients/client-timestream-query/TimestreamQueryClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { CancelQueryCommandInput, CancelQueryCommandOutput } from "./commands/CancelQueryCommand";
2-
import { DescribeEndpointsCommandInput, DescribeEndpointsCommandOutput } from "./commands/DescribeEndpointsCommand";
2+
import {
3+
DescribeEndpointsCommand,
4+
DescribeEndpointsCommandInput,
5+
DescribeEndpointsCommandOutput,
6+
} from "./commands/DescribeEndpointsCommand";
37
import { QueryCommandInput, QueryCommandOutput } from "./commands/QueryCommand";
48
import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig";
59
import {
@@ -215,6 +219,7 @@ export class TimestreamQueryClient extends __Client<
215219
let _config_7 = resolveEndpointDiscoveryClientConfig(_config_6);
216220
super(_config_7);
217221
_config_7.client = this;
222+
_config_7.discoveryEndpointCommandCtor = DescribeEndpointsCommand;
218223
this.config = _config_7;
219224
this.middlewareStack.use(getRetryPlugin(this.config));
220225
this.middlewareStack.use(getContentLengthPlugin(this.config));

clients/client-timestream-query/commands/QueryCommand.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export class QueryCommand extends $Command<QueryCommandInput, QueryCommandOutput
4848
isDiscoveredEndpointRequired: true,
4949
// @ts-ignore
5050
getEndpointDiscoveryId: undefined,
51-
discoveryEndpointCommandCtor: DescribeEndpointsCommand,
5251
})
5352
);
5453

packages/middleware-endpoint-discovery/src/getEndpointDiscoveryCommandPlugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const endpointDiscoveryMiddlewareOptions: FinalizeRequestHandlerOptions =
2424
export type EndpointDiscoveryMiddlewareConfig = {
2525
isDiscoveredEndpointRequired: boolean;
2626
getEndpointDiscoveryId: () => string | undefined;
27-
discoveryEndpointCommandCtor: new (comandConfig: any) => Command<any, any, any, any, any>;
2827
};
2928

3029
export const endpointDiscoveryMiddleware = (
@@ -36,7 +35,9 @@ export const endpointDiscoveryMiddleware = (
3635
): FinalizeHandler<any, Output> => async (
3736
args: FinalizeHandlerArguments<any>
3837
): Promise<FinalizeHandlerOutput<Output>> => {
39-
const { isDiscoveredEndpointRequired, discoveryEndpointCommandCtor, getEndpointDiscoveryId } = middlewareConfig;
38+
const { client } = config;
39+
const { discoveryEndpointCommandCtor } = client?.config;
40+
const { isDiscoveredEndpointRequired, getEndpointDiscoveryId } = middlewareConfig;
4041
const { commandName } = context;
4142

4243
if (isDiscoveredEndpointRequired === true) {
@@ -57,7 +58,6 @@ export const endpointDiscoveryMiddleware = (
5758
});
5859
}
5960

60-
const { client } = config;
6161
const { request } = args;
6262
const cacheKey = await getCacheKey(commandName, client?.config, getEndpointDiscoveryId);
6363
if (cacheKey && HttpRequest.isInstance(request)) {

packages/middleware-endpoint-discovery/src/resolveEndpointDiscoveryClientConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client } from "@aws-sdk/types";
1+
import { Client, Command } from "@aws-sdk/types";
22
import LRUCache from "lru-cache";
33

44
export interface EndpointDiscoveryClientInputConfig {}
@@ -7,6 +7,7 @@ interface PreviouslyResolved {}
77

88
export interface EndpointDiscoveryClientResolvedConfig {
99
client?: Client<any, any, any>;
10+
discoveryEndpointCommandCtor?: new (comandConfig: any) => Command<any, any, any, any, any>;
1011
endpointCache: LRUCache<string, string>;
1112
}
1213

0 commit comments

Comments
 (0)