Skip to content

Commit 019c099

Browse files
authored
feat(clients): enable Endpoint Discovery (#2395)
1 parent 7f297dc commit 019c099

31 files changed

+281
-17
lines changed

clients/client-dynamodb/DynamoDBClient.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import {
1919
DescribeContributorInsightsCommandInput,
2020
DescribeContributorInsightsCommandOutput,
2121
} from "./commands/DescribeContributorInsightsCommand";
22-
import { DescribeEndpointsCommandInput, DescribeEndpointsCommandOutput } from "./commands/DescribeEndpointsCommand";
22+
import {
23+
DescribeEndpointsCommand,
24+
DescribeEndpointsCommandInput,
25+
DescribeEndpointsCommandOutput,
26+
} from "./commands/DescribeEndpointsCommand";
2327
import { DescribeExportCommandInput, DescribeExportCommandOutput } from "./commands/DescribeExportCommand";
2428
import {
2529
DescribeGlobalTableCommandInput,
@@ -109,6 +113,11 @@ import {
109113
resolveRegionConfig,
110114
} from "@aws-sdk/config-resolver";
111115
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
116+
import {
117+
EndpointDiscoveryInputConfig,
118+
EndpointDiscoveryResolvedConfig,
119+
resolveEndpointDiscoveryConfig,
120+
} from "@aws-sdk/middleware-endpoint-discovery";
112121
import {
113122
HostHeaderInputConfig,
114123
HostHeaderResolvedConfig,
@@ -359,6 +368,13 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
359368
* @internal
360369
*/
361370
defaultUserAgentProvider?: Provider<__UserAgent>;
371+
372+
/**
373+
* The provider which populates default for endpointDiscoveryEnabled configuration, if it's
374+
* not passed during client creation.
375+
* @internal
376+
*/
377+
endpointDiscoveryEnabledProvider?: __Provider<boolean | undefined>;
362378
}
363379

364380
type DynamoDBClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
@@ -368,7 +384,8 @@ type DynamoDBClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptio
368384
RetryInputConfig &
369385
HostHeaderInputConfig &
370386
AwsAuthInputConfig &
371-
UserAgentInputConfig;
387+
UserAgentInputConfig &
388+
EndpointDiscoveryInputConfig;
372389
/**
373390
* The configuration interface of DynamoDBClient class constructor that set the region, credentials and other options.
374391
*/
@@ -381,7 +398,8 @@ type DynamoDBClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHand
381398
RetryResolvedConfig &
382399
HostHeaderResolvedConfig &
383400
AwsAuthResolvedConfig &
384-
UserAgentResolvedConfig;
401+
UserAgentResolvedConfig &
402+
EndpointDiscoveryResolvedConfig;
385403
/**
386404
* The resolved configuration interface of DynamoDBClient class. This is resolved and normalized from the {@link DynamoDBClientConfig | constructor configuration interface}.
387405
*/
@@ -430,8 +448,9 @@ export class DynamoDBClient extends __Client<
430448
let _config_4 = resolveHostHeaderConfig(_config_3);
431449
let _config_5 = resolveAwsAuthConfig(_config_4);
432450
let _config_6 = resolveUserAgentConfig(_config_5);
433-
super(_config_6);
434-
this.config = _config_6;
451+
let _config_7 = resolveEndpointDiscoveryConfig(_config_6, DescribeEndpointsCommand);
452+
super(_config_7);
453+
this.config = _config_7;
435454
this.middlewareStack.use(getRetryPlugin(this.config));
436455
this.middlewareStack.use(getContentLengthPlugin(this.config));
437456
this.middlewareStack.use(getHostHeaderPlugin(this.config));

clients/client-dynamodb/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@aws-sdk/hash-node": "3.15.0",
3535
"@aws-sdk/invalid-dependency": "3.15.0",
3636
"@aws-sdk/middleware-content-length": "3.15.0",
37+
"@aws-sdk/middleware-endpoint-discovery": "3.0.0",
3738
"@aws-sdk/middleware-host-header": "3.15.0",
3839
"@aws-sdk/middleware-logger": "3.15.0",
3940
"@aws-sdk/middleware-retry": "3.15.0",

clients/client-dynamodb/runtimeConfig.browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
2525
serviceId: ClientSharedValues.serviceId,
2626
clientVersion: packageInfo.version,
2727
}),
28+
endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined),
2829
maxAttempts: DEFAULT_MAX_ATTEMPTS,
2930
region: invalidProvider("Region is missing"),
3031
requestHandler: new FetchHttpHandler(),

clients/client-dynamodb/runtimeConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
44
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
55
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
66
import { Hash } from "@aws-sdk/hash-node";
7+
import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endpoint-discovery";
78
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
89
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
910
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
@@ -28,6 +29,7 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
2829
serviceId: ClientSharedValues.serviceId,
2930
clientVersion: packageInfo.version,
3031
}),
32+
endpointDiscoveryEnabledProvider: loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS),
3133
maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
3234
region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
3335
requestHandler: new NodeHttpHandler(),

clients/client-timestream-query/TimestreamQueryClient.ts

Lines changed: 24 additions & 5 deletions
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 {
@@ -11,6 +15,11 @@ import {
1115
resolveRegionConfig,
1216
} from "@aws-sdk/config-resolver";
1317
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
18+
import {
19+
EndpointDiscoveryInputConfig,
20+
EndpointDiscoveryResolvedConfig,
21+
resolveEndpointDiscoveryConfig,
22+
} from "@aws-sdk/middleware-endpoint-discovery";
1423
import {
1524
HostHeaderInputConfig,
1625
HostHeaderResolvedConfig,
@@ -161,6 +170,13 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
161170
* @internal
162171
*/
163172
defaultUserAgentProvider?: Provider<__UserAgent>;
173+
174+
/**
175+
* The provider which populates default for endpointDiscoveryEnabled configuration, if it's
176+
* not passed during client creation.
177+
* @internal
178+
*/
179+
endpointDiscoveryEnabledProvider?: __Provider<boolean | undefined>;
164180
}
165181

166182
type TimestreamQueryClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
@@ -170,7 +186,8 @@ type TimestreamQueryClientConfigType = Partial<__SmithyConfiguration<__HttpHandl
170186
RetryInputConfig &
171187
HostHeaderInputConfig &
172188
AwsAuthInputConfig &
173-
UserAgentInputConfig;
189+
UserAgentInputConfig &
190+
EndpointDiscoveryInputConfig;
174191
/**
175192
* The configuration interface of TimestreamQueryClient class constructor that set the region, credentials and other options.
176193
*/
@@ -183,7 +200,8 @@ type TimestreamQueryClientResolvedConfigType = __SmithyResolvedConfiguration<__H
183200
RetryResolvedConfig &
184201
HostHeaderResolvedConfig &
185202
AwsAuthResolvedConfig &
186-
UserAgentResolvedConfig;
203+
UserAgentResolvedConfig &
204+
EndpointDiscoveryResolvedConfig;
187205
/**
188206
* The resolved configuration interface of TimestreamQueryClient class. This is resolved and normalized from the {@link TimestreamQueryClientConfig | constructor configuration interface}.
189207
*/
@@ -216,8 +234,9 @@ export class TimestreamQueryClient extends __Client<
216234
let _config_4 = resolveHostHeaderConfig(_config_3);
217235
let _config_5 = resolveAwsAuthConfig(_config_4);
218236
let _config_6 = resolveUserAgentConfig(_config_5);
219-
super(_config_6);
220-
this.config = _config_6;
237+
let _config_7 = resolveEndpointDiscoveryConfig(_config_6, DescribeEndpointsCommand);
238+
super(_config_7);
239+
this.config = _config_7;
221240
this.middlewareStack.use(getRetryPlugin(this.config));
222241
this.middlewareStack.use(getContentLengthPlugin(this.config));
223242
this.middlewareStack.use(getHostHeaderPlugin(this.config));

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_json1_0CancelQueryCommand,
55
serializeAws_json1_0CancelQueryCommand,
66
} from "../protocols/Aws_json1_0";
7+
import { getEndpointDiscoveryRequiredPlugin } from "@aws-sdk/middleware-endpoint-discovery";
78
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
89
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
910
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -64,6 +65,7 @@ export class CancelQueryCommand extends $Command<
6465
options?: __HttpHandlerOptions
6566
): Handler<CancelQueryCommandInput, CancelQueryCommandOutput> {
6667
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
68+
this.middlewareStack.use(getEndpointDiscoveryRequiredPlugin(configuration, { clientStack, options }));
6769

6870
const stack = clientStack.concat(this.middlewareStack);
6971

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ServiceInputTypes, ServiceOutputTypes, TimestreamQueryClientResolvedConfig } from "../TimestreamQueryClient";
22
import { QueryRequest, QueryResponse } from "../models/models_0";
33
import { deserializeAws_json1_0QueryCommand, serializeAws_json1_0QueryCommand } from "../protocols/Aws_json1_0";
4+
import { getEndpointDiscoveryRequiredPlugin } from "@aws-sdk/middleware-endpoint-discovery";
45
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
56
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
67
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -55,6 +56,7 @@ export class QueryCommand extends $Command<QueryCommandInput, QueryCommandOutput
5556
options?: __HttpHandlerOptions
5657
): Handler<QueryCommandInput, QueryCommandOutput> {
5758
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
59+
this.middlewareStack.use(getEndpointDiscoveryRequiredPlugin(configuration, { clientStack, options }));
5860

5961
const stack = clientStack.concat(this.middlewareStack);
6062

clients/client-timestream-query/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@aws-sdk/hash-node": "3.15.0",
3535
"@aws-sdk/invalid-dependency": "3.15.0",
3636
"@aws-sdk/middleware-content-length": "3.15.0",
37+
"@aws-sdk/middleware-endpoint-discovery": "3.0.0",
3738
"@aws-sdk/middleware-host-header": "3.15.0",
3839
"@aws-sdk/middleware-logger": "3.15.0",
3940
"@aws-sdk/middleware-retry": "3.15.0",

clients/client-timestream-query/runtimeConfig.browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
2525
serviceId: ClientSharedValues.serviceId,
2626
clientVersion: packageInfo.version,
2727
}),
28+
endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined),
2829
maxAttempts: DEFAULT_MAX_ATTEMPTS,
2930
region: invalidProvider("Region is missing"),
3031
requestHandler: new FetchHttpHandler(),

clients/client-timestream-query/runtimeConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
44
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
55
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
66
import { Hash } from "@aws-sdk/hash-node";
7+
import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endpoint-discovery";
78
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
89
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
910
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
@@ -28,6 +29,7 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
2829
serviceId: ClientSharedValues.serviceId,
2930
clientVersion: packageInfo.version,
3031
}),
32+
endpointDiscoveryEnabledProvider: loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS),
3133
maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
3234
region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
3335
requestHandler: new NodeHttpHandler(),

0 commit comments

Comments
 (0)