Skip to content

Commit 62e555c

Browse files
committed
chore(middleware-sdk-s3-control): use resolved useDualstackEndpoint
The configuration is resolved in endpointsConfig
1 parent a5cdb56 commit 62e555c

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

packages/middleware-sdk-s3-control/src/configurations.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-e
33

44
export interface S3ControlInputConfig {
55
/**
6-
* Enables IPv6/IPv4 dualstack endpoint. When a DNS lookup is performed on an endpoint of this type, it returns an “A” record with an IPv4 address and an “AAAA” record with an IPv6 address. In most cases the network stack in the client environment will automatically prefer the AAAA record and make a connection using the IPv6 address. Note, however, that currently on Windows, the IPv4 address will be preferred.
6+
* Enables IPv6/IPv4 dualstack endpoint. When a DNS lookup is performed on an endpoint of this type, it returns an “A”
7+
* record with an IPv4 address and an “AAAA” record with an IPv6 address. In most cases the network stack in the
8+
* client environment will automatically prefer the AAAA record and make a connection using the IPv6 address. Note,
9+
* however, that currently on Windows, the IPv4 address will be preferred.
710
*/
8-
useDualstackEndpoint?: boolean;
11+
useDualstackEndpoint: Provider<boolean>;
912
/**
1013
* Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
1114
*/
@@ -25,9 +28,9 @@ export interface S3ControlResolvedConfig {
2528
*/
2629
isCustomEndpoint: boolean;
2730
/**
28-
* Resolved value for input config {@link S3ControlInputConfig.useDualstackEndpoint}
31+
* Enables IPv6/IPv4 dualstack endpoint.
2932
*/
30-
useDualstackEndpoint: boolean;
33+
useDualstackEndpoint: Provider<boolean>;
3134
/**
3235
* Resolved value for input config {@link S3ControlInputConfig.useArnRegion}
3336
*/
@@ -46,10 +49,9 @@ export interface S3ControlResolvedConfig {
4649
export function resolveS3ControlConfig<T>(
4750
input: T & PreviouslyResolved & S3ControlInputConfig
4851
): T & S3ControlResolvedConfig {
49-
const { useDualstackEndpoint = false, useArnRegion = false } = input;
52+
const { useArnRegion = false } = input;
5053
return {
5154
...input,
52-
useDualstackEndpoint,
5355
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
5456
};
5557
}

packages/middleware-sdk-s3-control/src/process-arnables-plugin/parse-outpost-arnables.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ export const parseOutpostArnablesMiddleaware =
3838
const clientRegion = await options.region();
3939
const { regionInfoProvider } = options;
4040
const useArnRegion = await options.useArnRegion();
41+
const useDualstackEndpoint = await options.useDualstackEndpoint();
4142
const baseRegion = getPseudoRegion(clientRegion);
4243
const { partition: clientPartition, signingRegion = baseRegion } = (await regionInfoProvider(baseRegion))!;
4344
const validatorOptions: ValidateOutpostsArnOptions = {
44-
useDualstackEndpoint: options.useDualstackEndpoint,
45+
useDualstackEndpoint,
4546
clientRegion,
4647
clientPartition,
4748
signingRegion,

packages/middleware-sdk-s3-control/src/process-arnables-plugin/plugin.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ describe("getProcessArnablesMiddleware", () => {
1010
region: string;
1111
regionInfoProvider?: Provider<RegionInfo>;
1212
useAccelerateEndpoint?: boolean;
13-
useDualstackEndpoint?: boolean;
13+
useDualstackEndpoint?: Provider<boolean>;
1414
useArnRegion?: boolean;
1515
};
1616
const setupPluginOptions = (options: FakeOptions): S3ControlResolvedConfig => {
1717
return {
18-
useDualstackEndpoint: false,
18+
useDualstackEndpoint: () => Promise.resolve(false),
1919
...options,
2020
regionInfoProvider: options.regionInfoProvider ?? jest.fn().mockResolvedValue({ partition: "aws" }),
2121
region: jest.fn().mockResolvedValue(options.region),
@@ -239,7 +239,7 @@ describe("getProcessArnablesMiddleware", () => {
239239
const clientRegion = "us-west-2";
240240
const options = setupPluginOptions({
241241
region: clientRegion,
242-
useDualstackEndpoint: true,
242+
useDualstackEndpoint: () => Promise.resolve(true),
243243
});
244244
const stack = getStack(`s3-control.${clientRegion}.amazonaws.com`, options);
245245
const handler = stack.resolve((() => {}) as any, {});
@@ -483,7 +483,7 @@ describe("getProcessArnablesMiddleware", () => {
483483
const clientRegion = "us-west-2";
484484
const options = setupPluginOptions({
485485
region: clientRegion,
486-
useDualstackEndpoint: true,
486+
useDualstackEndpoint: () => Promise.resolve(true),
487487
});
488488
const stack = getStack(`s3-control.${clientRegion}.amazonaws.com`, options);
489489
const handler = stack.resolve((() => {}) as any, {});

0 commit comments

Comments
 (0)