@aws-sdk/middleware-bucket-endpoint 3.37.0 → 3.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.40.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.40.0...v3.40.1) (2021-11-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **middleware-bucket-endpoint:** remove dualstack from hostname before processing ([#3003](https://github.com/aws/aws-sdk-js-v3/issues/3003)) ([d7aa2c3](https://github.com/aws/aws-sdk-js-v3/commit/d7aa2c329c62a9c2957631502bfe8da7fda86a4f))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.40.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.39.0...v3.40.0) (2021-11-05)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **node-config-provider:** move booleanSelector util to platform agnostic package ([#2992](https://github.com/aws/aws-sdk-js-v3/issues/2992)) ([2909c7b](https://github.com/aws/aws-sdk-js-v3/commit/2909c7bf636d78f82aa980588fb44bd17f78e001))
23
+
24
+
25
+
26
+
27
+
28
+ # [3.39.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.38.0...v3.39.0) (2021-10-29)
29
+
30
+ **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
31
+
32
+
33
+
34
+
35
+
36
+ # [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22)
37
+
38
+ **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
39
+
40
+
41
+
42
+
43
+
6
44
  # [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15)
7
45
 
8
46
  **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = void 0;
4
+ const util_config_provider_1 = require("@aws-sdk/util-config-provider");
5
+ exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
6
+ exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
7
+ exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = {
8
+ environmentVariableSelector: (env) => util_config_provider_1.booleanSelector(env, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, util_config_provider_1.SelectorType.ENV),
9
+ configFileSelector: (profile) => util_config_provider_1.booleanSelector(profile, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, util_config_provider_1.SelectorType.CONFIG),
10
+ default: false,
11
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = exports.NODE_USE_ARN_REGION_INI_NAME = exports.NODE_USE_ARN_REGION_ENV_NAME = void 0;
4
+ const util_config_provider_1 = require("@aws-sdk/util-config-provider");
5
+ exports.NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
6
+ exports.NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
7
+ exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
8
+ environmentVariableSelector: (env) => util_config_provider_1.booleanSelector(env, exports.NODE_USE_ARN_REGION_ENV_NAME, util_config_provider_1.SelectorType.ENV),
9
+ configFileSelector: (profile) => util_config_provider_1.booleanSelector(profile, exports.NODE_USE_ARN_REGION_INI_NAME, util_config_provider_1.SelectorType.CONFIG),
10
+ default: false,
11
+ };
@@ -4,7 +4,6 @@ exports.getBucketEndpointPlugin = exports.bucketEndpointMiddlewareOptions = expo
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const util_arn_parser_1 = require("@aws-sdk/util-arn-parser");
6
6
  const bucketHostname_1 = require("./bucketHostname");
7
- const bucketHostnameUtils_1 = require("./bucketHostnameUtils");
8
7
  const bucketEndpointMiddleware = (options) => (next, context) => async (args) => {
9
8
  const { Bucket: bucketName } = args.input;
10
9
  let replaceBucketInPath = options.bucketEndpoint;
@@ -15,14 +14,17 @@ const bucketEndpointMiddleware = (options) => (next, context) => async (args) =>
15
14
  }
16
15
  else if (util_arn_parser_1.validate(bucketName)) {
17
16
  const bucketArn = util_arn_parser_1.parse(bucketName);
18
- const clientRegion = bucketHostnameUtils_1.getPseudoRegion(await options.region());
19
- const { partition, signingRegion = clientRegion } = (await options.regionInfoProvider(clientRegion)) || {};
17
+ const clientRegion = await options.region();
18
+ const useDualstackEndpoint = await options.useDualstackEndpoint();
19
+ const useFipsEndpoint = await options.useFipsEndpoint();
20
+ const { partition, signingRegion = clientRegion } = (await options.regionInfoProvider(clientRegion, { useDualstackEndpoint, useFipsEndpoint })) || {};
20
21
  const useArnRegion = await options.useArnRegion();
21
- const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService } = bucketHostname_1.bucketHostname({
22
+ const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService, } = bucketHostname_1.bucketHostname({
22
23
  bucketName: bucketArn,
23
24
  baseHostname: request.hostname,
24
25
  accelerateEndpoint: options.useAccelerateEndpoint,
25
- dualstackEndpoint: options.useDualstackEndpoint,
26
+ dualstackEndpoint: useDualstackEndpoint,
27
+ fipsEndpoint: useFipsEndpoint,
26
28
  pathStyleEndpoint: options.forcePathStyle,
27
29
  tlsCompatible: request.protocol === "https:",
28
30
  useArnRegion,
@@ -42,13 +44,16 @@ const bucketEndpointMiddleware = (options) => (next, context) => async (args) =>
42
44
  replaceBucketInPath = bucketEndpoint;
43
45
  }
44
46
  else {
45
- const clientRegion = bucketHostnameUtils_1.getPseudoRegion(await options.region());
47
+ const clientRegion = await options.region();
48
+ const dualstackEndpoint = await options.useDualstackEndpoint();
49
+ const fipsEndpoint = await options.useFipsEndpoint();
46
50
  const { hostname, bucketEndpoint } = bucketHostname_1.bucketHostname({
47
51
  bucketName,
48
52
  clientRegion,
49
53
  baseHostname: request.hostname,
50
54
  accelerateEndpoint: options.useAccelerateEndpoint,
51
- dualstackEndpoint: options.useDualstackEndpoint,
55
+ dualstackEndpoint,
56
+ fipsEndpoint,
52
57
  pathStyleEndpoint: options.forcePathStyle,
53
58
  tlsCompatible: request.protocol === "https:",
54
59
  isCustomEndpoint: options.isCustomEndpoint,
@@ -4,14 +4,16 @@ exports.bucketHostname = void 0;
4
4
  const bucketHostnameUtils_1 = require("./bucketHostnameUtils");
5
5
  const bucketHostname = (options) => {
6
6
  bucketHostnameUtils_1.validateCustomEndpoint(options);
7
+ const { dualstackEndpoint, baseHostname } = options;
8
+ const updatedBaseHostname = dualstackEndpoint ? baseHostname.replace(".dualstack", "") : baseHostname;
7
9
  return bucketHostnameUtils_1.isBucketNameOptions(options)
8
10
  ?
9
- getEndpointFromBucketName(options)
11
+ getEndpointFromBucketName({ ...options, baseHostname: updatedBaseHostname })
10
12
  :
11
- getEndpointFromArn(options);
13
+ getEndpointFromArn({ ...options, baseHostname: updatedBaseHostname });
12
14
  };
13
15
  exports.bucketHostname = bucketHostname;
14
- const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
16
+ const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, fipsEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
15
17
  const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : bucketHostnameUtils_1.getSuffix(baseHostname);
16
18
  if (pathStyleEndpoint || !bucketHostnameUtils_1.isDnsCompatibleBucketName(bucketName) || (tlsCompatible && bucketHostnameUtils_1.DOT_PATTERN.test(bucketName))) {
17
19
  return {
@@ -33,7 +35,7 @@ const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: r
33
35
  const getEndpointFromArn = (options) => {
34
36
  const { isCustomEndpoint, baseHostname, clientRegion } = options;
35
37
  const hostnameSuffix = isCustomEndpoint ? baseHostname : bucketHostnameUtils_1.getSuffixForArnEndpoint(baseHostname)[1];
36
- const { pathStyleEndpoint, accelerateEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
38
+ const { pathStyleEndpoint, accelerateEndpoint = false, fipsEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
37
39
  bucketHostnameUtils_1.validateArnEndpointOptions({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
38
40
  const { service, partition, accountId, region, resource } = bucketName;
39
41
  bucketHostnameUtils_1.validateService(service);
@@ -51,10 +53,16 @@ const getEndpointFromArn = (options) => {
51
53
  }
52
54
  return getEndpointFromAccessPointArn({ ...options, clientRegion, accesspointName, hostnameSuffix });
53
55
  };
54
- const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
56
+ const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
55
57
  const { accountId, region, service } = bucketName;
56
58
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
57
- bucketHostnameUtils_1.validateRegion(region, { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion: true });
59
+ bucketHostnameUtils_1.validateRegion(region, {
60
+ useArnRegion,
61
+ clientRegion,
62
+ clientSigningRegion,
63
+ allowFipsRegion: true,
64
+ useFipsEndpoint: fipsEndpoint,
65
+ });
58
66
  bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
59
67
  const DNSHostLabel = `${accesspointName}-${accountId}`;
60
68
  bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
@@ -62,7 +70,7 @@ const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, tlsCompatib
62
70
  const signingRegion = useArnRegion ? region : clientSigningRegion;
63
71
  return {
64
72
  bucketEndpoint: true,
65
- hostname: `${DNSHostLabel}.${service}${bucketHostnameUtils_1.isFipsRegion(clientRegion) ? "-fips" : ""}.${bucketHostnameUtils_1.getPseudoRegion(endpointRegion)}.${hostnameSuffix}`,
73
+ hostname: `${DNSHostLabel}.${service}${fipsEndpoint ? "-fips" : ""}.${endpointRegion}.${hostnameSuffix}`,
66
74
  signingRegion,
67
75
  signingService: service,
68
76
  };
@@ -79,9 +87,9 @@ const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpo
79
87
  signingRegion: "*",
80
88
  };
81
89
  };
82
- const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
90
+ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
83
91
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
84
- bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion });
92
+ bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, useFipsEndpoint: fipsEndpoint });
85
93
  const DNSHostLabel = `${accesspointName}-${bucketName.accountId}`;
86
94
  bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
87
95
  const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -89,7 +97,7 @@ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRe
89
97
  bucketHostnameUtils_1.validateOutpostService(bucketName.service);
90
98
  bucketHostnameUtils_1.validateDNSHostLabel(outpostId, { tlsCompatible });
91
99
  bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
92
- bucketHostnameUtils_1.validateNoFIPS(endpointRegion);
100
+ bucketHostnameUtils_1.validateNoFIPS(fipsEndpoint);
93
101
  const hostnamePrefix = `${DNSHostLabel}.${outpostId}`;
94
102
  return {
95
103
  bucketEndpoint: true,
@@ -98,9 +106,15 @@ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRe
98
106
  signingService: "s3-outposts",
99
107
  };
100
108
  };
101
- const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
109
+ const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
102
110
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
103
- bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion: true });
111
+ bucketHostnameUtils_1.validateRegion(bucketName.region, {
112
+ useArnRegion,
113
+ clientRegion,
114
+ clientSigningRegion,
115
+ allowFipsRegion: true,
116
+ useFipsEndpoint: fipsEndpoint,
117
+ });
104
118
  const hostnamePrefix = `${accesspointName}-${bucketName.accountId}`;
105
119
  bucketHostnameUtils_1.validateDNSHostLabel(hostnamePrefix, { tlsCompatible });
106
120
  const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -110,7 +124,7 @@ const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigni
110
124
  bucketEndpoint: true,
111
125
  hostname: `${hostnamePrefix}${isCustomEndpoint
112
126
  ? ""
113
- : `.s3-accesspoint${bucketHostnameUtils_1.isFipsRegion(clientRegion) ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${bucketHostnameUtils_1.getPseudoRegion(endpointRegion)}`}.${hostnameSuffix}`,
127
+ : `.s3-accesspoint${fipsEndpoint ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${endpointRegion}`}.${hostnameSuffix}`,
114
128
  signingRegion,
115
129
  };
116
130
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateMrapAlias = exports.validateNoFIPS = exports.validateNoDualstack = exports.getArnResources = exports.validateCustomEndpoint = exports.validateDNSHostLabel = exports.validateAccountId = exports.isFipsRegion = exports.validateRegionalClient = exports.validateRegion = exports.validatePartition = exports.validateOutpostService = exports.validateS3Service = exports.validateService = exports.validateArnEndpointOptions = exports.getSuffixForArnEndpoint = exports.getSuffix = exports.isDnsCompatibleBucketName = exports.getPseudoRegion = exports.isBucketNameOptions = exports.S3_HOSTNAME_PATTERN = exports.DOT_PATTERN = void 0;
3
+ exports.validateMrapAlias = exports.validateNoFIPS = exports.validateNoDualstack = exports.getArnResources = exports.validateCustomEndpoint = exports.validateDNSHostLabel = exports.validateAccountId = exports.validateRegionalClient = exports.validateRegion = exports.validatePartition = exports.validateOutpostService = exports.validateS3Service = exports.validateService = exports.validateArnEndpointOptions = exports.getSuffixForArnEndpoint = exports.getSuffix = exports.isDnsCompatibleBucketName = exports.isBucketNameOptions = exports.S3_HOSTNAME_PATTERN = exports.DOT_PATTERN = void 0;
4
4
  const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
5
5
  const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
6
6
  const DOTS_PATTERN = /\.\./;
@@ -10,8 +10,6 @@ const S3_US_EAST_1_ALTNAME_PATTERN = /^s3(-external-1)?\.amazonaws\.com$/;
10
10
  const AWS_PARTITION_SUFFIX = "amazonaws.com";
11
11
  const isBucketNameOptions = (options) => typeof options.bucketName === "string";
12
12
  exports.isBucketNameOptions = isBucketNameOptions;
13
- const getPseudoRegion = (region) => (exports.isFipsRegion(region) ? region.replace(/fips-|-fips/, "") : region);
14
- exports.getPseudoRegion = getPseudoRegion;
15
13
  const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
16
14
  exports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;
17
15
  const getRegionalSuffix = (hostname) => {
@@ -64,7 +62,7 @@ const validateRegion = (region, options) => {
64
62
  if (region === "") {
65
63
  throw new Error("ARN region is empty");
66
64
  }
67
- if (exports.isFipsRegion(options.clientRegion)) {
65
+ if (options.useFipsEndpoint) {
68
66
  if (!options.allowFipsRegion) {
69
67
  throw new Error("FIPS region is not supported");
70
68
  }
@@ -80,14 +78,12 @@ const validateRegion = (region, options) => {
80
78
  };
81
79
  exports.validateRegion = validateRegion;
82
80
  const validateRegionalClient = (region) => {
83
- if (["s3-external-1", "aws-global"].includes(exports.getPseudoRegion(region))) {
81
+ if (["s3-external-1", "aws-global"].includes(region)) {
84
82
  throw new Error(`Client region ${region} is not regional`);
85
83
  }
86
84
  };
87
85
  exports.validateRegionalClient = validateRegionalClient;
88
- const isFipsRegion = (region) => region.startsWith("fips-") || region.endsWith("-fips");
89
- exports.isFipsRegion = isFipsRegion;
90
- const isEqualRegions = (regionA, regionB) => regionA === regionB || exports.getPseudoRegion(regionA) === regionB || regionA === exports.getPseudoRegion(regionB);
86
+ const isEqualRegions = (regionA, regionB) => regionA === regionB;
91
87
  const validateAccountId = (accountId) => {
92
88
  if (!/[0-9]{12}/.exec(accountId)) {
93
89
  throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'");
@@ -139,9 +135,9 @@ const validateNoDualstack = (dualstackEndpoint) => {
139
135
  throw new Error("Dualstack endpoint is not supported with Outpost or Multi-region Access Point ARN.");
140
136
  };
141
137
  exports.validateNoDualstack = validateNoDualstack;
142
- const validateNoFIPS = (region) => {
143
- if (exports.isFipsRegion(region !== null && region !== void 0 ? region : ""))
144
- throw new Error(`FIPS region is not supported with Outpost, got ${region}`);
138
+ const validateNoFIPS = (useFipsEndpoint) => {
139
+ if (useFipsEndpoint)
140
+ throw new Error(`FIPS region is not supported with Outpost.`);
145
141
  };
146
142
  exports.validateNoFIPS = validateNoFIPS;
147
143
  const validateMrapAlias = (name) => {
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = exports.NODE_USE_ARN_REGION_INI_NAME = exports.NODE_USE_ARN_REGION_ENV_NAME = exports.resolveBucketEndpointConfig = void 0;
3
+ exports.resolveBucketEndpointConfig = void 0;
4
4
  function resolveBucketEndpointConfig(input) {
5
- const { bucketEndpoint = false, forcePathStyle = false, useAccelerateEndpoint = false, useDualstackEndpoint = false, useArnRegion = false, disableMultiregionAccessPoints = false, } = input;
5
+ const { bucketEndpoint = false, forcePathStyle = false, useAccelerateEndpoint = false, useArnRegion = false, disableMultiregionAccessPoints = false, } = input;
6
6
  return {
7
7
  ...input,
8
8
  bucketEndpoint,
9
9
  forcePathStyle,
10
10
  useAccelerateEndpoint,
11
- useDualstackEndpoint,
12
11
  useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
13
12
  disableMultiregionAccessPoints: typeof disableMultiregionAccessPoints === "function"
14
13
  ? disableMultiregionAccessPoints
@@ -16,49 +15,3 @@ function resolveBucketEndpointConfig(input) {
16
15
  };
17
16
  }
18
17
  exports.resolveBucketEndpointConfig = resolveBucketEndpointConfig;
19
- exports.NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
20
- exports.NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
21
- exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
22
- exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
23
- exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
24
- environmentVariableSelector: (env) => {
25
- if (!Object.prototype.hasOwnProperty.call(env, exports.NODE_USE_ARN_REGION_ENV_NAME))
26
- return undefined;
27
- if (env[exports.NODE_USE_ARN_REGION_ENV_NAME] === "true")
28
- return true;
29
- if (env[exports.NODE_USE_ARN_REGION_ENV_NAME] === "false")
30
- return false;
31
- throw new Error(`Cannot load env ${exports.NODE_USE_ARN_REGION_ENV_NAME}. Expected "true" or "false", got ${env[exports.NODE_USE_ARN_REGION_ENV_NAME]}.`);
32
- },
33
- configFileSelector: (profile) => {
34
- if (!Object.prototype.hasOwnProperty.call(profile, exports.NODE_USE_ARN_REGION_INI_NAME))
35
- return undefined;
36
- if (profile[exports.NODE_USE_ARN_REGION_INI_NAME] === "true")
37
- return true;
38
- if (profile[exports.NODE_USE_ARN_REGION_INI_NAME] === "false")
39
- return false;
40
- throw new Error(`Cannot load shared config entry ${exports.NODE_USE_ARN_REGION_INI_NAME}. Expected "true" or "false", got ${profile[exports.NODE_USE_ARN_REGION_INI_NAME]}.`);
41
- },
42
- default: false,
43
- };
44
- exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = {
45
- environmentVariableSelector: (env) => {
46
- if (!Object.prototype.hasOwnProperty.call(env, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME))
47
- return undefined;
48
- if (env[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME] === "true")
49
- return true;
50
- if (env[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME] === "false")
51
- return false;
52
- throw new Error(`Cannot load env ${exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME}. Expected "true" or "false", got ${env[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME]}.`);
53
- },
54
- configFileSelector: (profile) => {
55
- if (!Object.prototype.hasOwnProperty.call(profile, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME))
56
- return undefined;
57
- if (profile[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME] === "true")
58
- return true;
59
- if (profile[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME] === "false")
60
- return false;
61
- throw new Error(`Cannot load shared config entry ${exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME}. Expected "true" or "false", got ${profile[exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME]}.`);
62
- },
63
- default: false,
64
- };
package/dist-cjs/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateNoFIPS = exports.validateNoDualstack = exports.validateDNSHostLabel = exports.validateRegion = exports.validateAccountId = exports.validatePartition = exports.validateOutpostService = exports.getSuffixForArnEndpoint = exports.getPseudoRegion = exports.getArnResources = void 0;
3
+ exports.validateNoFIPS = exports.validateNoDualstack = exports.validateDNSHostLabel = exports.validateRegion = exports.validateAccountId = exports.validatePartition = exports.validateOutpostService = exports.getSuffixForArnEndpoint = exports.getArnResources = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./NodeDisableMultiregionAccessPointConfigOptions"), exports);
6
+ tslib_1.__exportStar(require("./NodeUseArnRegionConfigOptions"), exports);
5
7
  tslib_1.__exportStar(require("./bucketEndpointMiddleware"), exports);
6
8
  tslib_1.__exportStar(require("./bucketHostname"), exports);
7
9
  tslib_1.__exportStar(require("./configurations"), exports);
8
10
  var bucketHostnameUtils_1 = require("./bucketHostnameUtils");
9
11
  Object.defineProperty(exports, "getArnResources", { enumerable: true, get: function () { return bucketHostnameUtils_1.getArnResources; } });
10
- Object.defineProperty(exports, "getPseudoRegion", { enumerable: true, get: function () { return bucketHostnameUtils_1.getPseudoRegion; } });
11
12
  Object.defineProperty(exports, "getSuffixForArnEndpoint", { enumerable: true, get: function () { return bucketHostnameUtils_1.getSuffixForArnEndpoint; } });
12
13
  Object.defineProperty(exports, "validateOutpostService", { enumerable: true, get: function () { return bucketHostnameUtils_1.validateOutpostService; } });
13
14
  Object.defineProperty(exports, "validatePartition", { enumerable: true, get: function () { return bucketHostnameUtils_1.validatePartition; } });
@@ -0,0 +1,12 @@
1
+ import { booleanSelector, SelectorType } from "@aws-sdk/util-config-provider";
2
+ export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
3
+ export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
4
+ export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = {
5
+ environmentVariableSelector: function (env) {
6
+ return booleanSelector(env, NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, SelectorType.ENV);
7
+ },
8
+ configFileSelector: function (profile) {
9
+ return booleanSelector(profile, NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, SelectorType.CONFIG);
10
+ },
11
+ default: false,
12
+ };
@@ -0,0 +1,10 @@
1
+ import { booleanSelector, SelectorType } from "@aws-sdk/util-config-provider";
2
+ export var NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
3
+ export var NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
4
+ export var NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
5
+ environmentVariableSelector: function (env) {
6
+ return booleanSelector(env, NODE_USE_ARN_REGION_ENV_NAME, SelectorType.ENV);
7
+ },
8
+ configFileSelector: function (profile) { return booleanSelector(profile, NODE_USE_ARN_REGION_INI_NAME, SelectorType.CONFIG); },
9
+ default: false,
10
+ };
@@ -2,90 +2,104 @@ import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { HttpRequest } from "@aws-sdk/protocol-http";
3
3
  import { parse as parseArn, validate as validateArn } from "@aws-sdk/util-arn-parser";
4
4
  import { bucketHostname } from "./bucketHostname";
5
- import { getPseudoRegion } from "./bucketHostnameUtils";
6
- export var bucketEndpointMiddleware = function (options) { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {
7
- var bucketName, replaceBucketInPath, request, bucketArn, clientRegion, _a, _b, partition, _c, signingRegion, useArnRegion, _d, hostname, bucketEndpoint, modifiedSigningRegion, signingService, _e, clientRegion, _f, _g, hostname, bucketEndpoint;
8
- var _h;
9
- return __generator(this, function (_j) {
10
- switch (_j.label) {
11
- case 0:
12
- bucketName = args.input.Bucket;
13
- replaceBucketInPath = options.bucketEndpoint;
14
- request = args.request;
15
- if (!HttpRequest.isInstance(request)) return [3, 9];
16
- if (!options.bucketEndpoint) return [3, 1];
17
- request.hostname = bucketName;
18
- return [3, 8];
19
- case 1:
20
- if (!validateArn(bucketName)) return [3, 6];
21
- bucketArn = parseArn(bucketName);
22
- _a = getPseudoRegion;
23
- return [4, options.region()];
24
- case 2:
25
- clientRegion = _a.apply(void 0, [_j.sent()]);
26
- return [4, options.regionInfoProvider(clientRegion)];
27
- case 3:
28
- _b = (_j.sent()) || {}, partition = _b.partition, _c = _b.signingRegion, signingRegion = _c === void 0 ? clientRegion : _c;
29
- return [4, options.useArnRegion()];
30
- case 4:
31
- useArnRegion = _j.sent();
32
- _e = bucketHostname;
33
- _h = {
34
- bucketName: bucketArn,
35
- baseHostname: request.hostname,
36
- accelerateEndpoint: options.useAccelerateEndpoint,
37
- dualstackEndpoint: options.useDualstackEndpoint,
38
- pathStyleEndpoint: options.forcePathStyle,
39
- tlsCompatible: request.protocol === "https:",
40
- useArnRegion: useArnRegion,
41
- clientPartition: partition,
42
- clientSigningRegion: signingRegion,
43
- clientRegion: clientRegion,
44
- isCustomEndpoint: options.isCustomEndpoint
45
- };
46
- return [4, options.disableMultiregionAccessPoints()];
47
- case 5:
48
- _d = _e.apply(void 0, [(_h.disableMultiregionAccessPoints = _j.sent(),
49
- _h)]), hostname = _d.hostname, bucketEndpoint = _d.bucketEndpoint, modifiedSigningRegion = _d.signingRegion, signingService = _d.signingService;
50
- if (modifiedSigningRegion && modifiedSigningRegion !== signingRegion) {
51
- context["signing_region"] = modifiedSigningRegion;
5
+ export var bucketEndpointMiddleware = function (options) {
6
+ return function (next, context) {
7
+ return function (args) { return __awaiter(void 0, void 0, void 0, function () {
8
+ var bucketName, replaceBucketInPath, request, bucketArn, clientRegion, useDualstackEndpoint, useFipsEndpoint, _a, partition, _b, signingRegion, useArnRegion, _c, hostname, bucketEndpoint, modifiedSigningRegion, signingService, _d, clientRegion, dualstackEndpoint, fipsEndpoint, _e, hostname, bucketEndpoint;
9
+ var _f;
10
+ return __generator(this, function (_g) {
11
+ switch (_g.label) {
12
+ case 0:
13
+ bucketName = args.input.Bucket;
14
+ replaceBucketInPath = options.bucketEndpoint;
15
+ request = args.request;
16
+ if (!HttpRequest.isInstance(request)) return [3, 13];
17
+ if (!options.bucketEndpoint) return [3, 1];
18
+ request.hostname = bucketName;
19
+ return [3, 12];
20
+ case 1:
21
+ if (!validateArn(bucketName)) return [3, 8];
22
+ bucketArn = parseArn(bucketName);
23
+ return [4, options.region()];
24
+ case 2:
25
+ clientRegion = _g.sent();
26
+ return [4, options.useDualstackEndpoint()];
27
+ case 3:
28
+ useDualstackEndpoint = _g.sent();
29
+ return [4, options.useFipsEndpoint()];
30
+ case 4:
31
+ useFipsEndpoint = _g.sent();
32
+ return [4, options.regionInfoProvider(clientRegion, { useDualstackEndpoint: useDualstackEndpoint, useFipsEndpoint: useFipsEndpoint })];
33
+ case 5:
34
+ _a = (_g.sent()) || {}, partition = _a.partition, _b = _a.signingRegion, signingRegion = _b === void 0 ? clientRegion : _b;
35
+ return [4, options.useArnRegion()];
36
+ case 6:
37
+ useArnRegion = _g.sent();
38
+ _d = bucketHostname;
39
+ _f = {
40
+ bucketName: bucketArn,
41
+ baseHostname: request.hostname,
42
+ accelerateEndpoint: options.useAccelerateEndpoint,
43
+ dualstackEndpoint: useDualstackEndpoint,
44
+ fipsEndpoint: useFipsEndpoint,
45
+ pathStyleEndpoint: options.forcePathStyle,
46
+ tlsCompatible: request.protocol === "https:",
47
+ useArnRegion: useArnRegion,
48
+ clientPartition: partition,
49
+ clientSigningRegion: signingRegion,
50
+ clientRegion: clientRegion,
51
+ isCustomEndpoint: options.isCustomEndpoint
52
+ };
53
+ return [4, options.disableMultiregionAccessPoints()];
54
+ case 7:
55
+ _c = _d.apply(void 0, [(_f.disableMultiregionAccessPoints = _g.sent(),
56
+ _f)]), hostname = _c.hostname, bucketEndpoint = _c.bucketEndpoint, modifiedSigningRegion = _c.signingRegion, signingService = _c.signingService;
57
+ if (modifiedSigningRegion && modifiedSigningRegion !== signingRegion) {
58
+ context["signing_region"] = modifiedSigningRegion;
59
+ }
60
+ if (signingService && signingService !== "s3") {
61
+ context["signing_service"] = signingService;
62
+ }
63
+ request.hostname = hostname;
64
+ replaceBucketInPath = bucketEndpoint;
65
+ return [3, 12];
66
+ case 8: return [4, options.region()];
67
+ case 9:
68
+ clientRegion = _g.sent();
69
+ return [4, options.useDualstackEndpoint()];
70
+ case 10:
71
+ dualstackEndpoint = _g.sent();
72
+ return [4, options.useFipsEndpoint()];
73
+ case 11:
74
+ fipsEndpoint = _g.sent();
75
+ _e = bucketHostname({
76
+ bucketName: bucketName,
77
+ clientRegion: clientRegion,
78
+ baseHostname: request.hostname,
79
+ accelerateEndpoint: options.useAccelerateEndpoint,
80
+ dualstackEndpoint: dualstackEndpoint,
81
+ fipsEndpoint: fipsEndpoint,
82
+ pathStyleEndpoint: options.forcePathStyle,
83
+ tlsCompatible: request.protocol === "https:",
84
+ isCustomEndpoint: options.isCustomEndpoint,
85
+ }), hostname = _e.hostname, bucketEndpoint = _e.bucketEndpoint;
86
+ request.hostname = hostname;
87
+ replaceBucketInPath = bucketEndpoint;
88
+ _g.label = 12;
89
+ case 12:
90
+ if (replaceBucketInPath) {
91
+ request.path = request.path.replace(/^(\/)?[^\/]+/, "");
92
+ if (request.path === "") {
93
+ request.path = "/";
94
+ }
95
+ }
96
+ _g.label = 13;
97
+ case 13: return [2, next(__assign(__assign({}, args), { request: request }))];
52
98
  }
53
- if (signingService && signingService !== "s3") {
54
- context["signing_service"] = signingService;
55
- }
56
- request.hostname = hostname;
57
- replaceBucketInPath = bucketEndpoint;
58
- return [3, 8];
59
- case 6:
60
- _f = getPseudoRegion;
61
- return [4, options.region()];
62
- case 7:
63
- clientRegion = _f.apply(void 0, [_j.sent()]);
64
- _g = bucketHostname({
65
- bucketName: bucketName,
66
- clientRegion: clientRegion,
67
- baseHostname: request.hostname,
68
- accelerateEndpoint: options.useAccelerateEndpoint,
69
- dualstackEndpoint: options.useDualstackEndpoint,
70
- pathStyleEndpoint: options.forcePathStyle,
71
- tlsCompatible: request.protocol === "https:",
72
- isCustomEndpoint: options.isCustomEndpoint,
73
- }), hostname = _g.hostname, bucketEndpoint = _g.bucketEndpoint;
74
- request.hostname = hostname;
75
- replaceBucketInPath = bucketEndpoint;
76
- _j.label = 8;
77
- case 8:
78
- if (replaceBucketInPath) {
79
- request.path = request.path.replace(/^(\/)?[^\/]+/, "");
80
- if (request.path === "") {
81
- request.path = "/";
82
- }
83
- }
84
- _j.label = 9;
85
- case 9: return [2, next(__assign(__assign({}, args), { request: request }))];
86
- }
87
- });
88
- }); }; }; };
99
+ });
100
+ }); };
101
+ };
102
+ };
89
103
  export var bucketEndpointMiddlewareOptions = {
90
104
  tags: ["BUCKET_ENDPOINT"],
91
105
  name: "bucketEndpointMiddleware",
@@ -1,16 +1,18 @@
1
1
  import { __assign, __read } from "tslib";
2
- import { DOT_PATTERN, getArnResources, getPseudoRegion, getSuffix, getSuffixForArnEndpoint, isBucketNameOptions, isDnsCompatibleBucketName, isFipsRegion, validateAccountId, validateArnEndpointOptions, validateCustomEndpoint, validateDNSHostLabel, validateMrapAlias, validateNoDualstack, validateNoFIPS, validateOutpostService, validatePartition, validateRegion, validateRegionalClient, validateS3Service, validateService, } from "./bucketHostnameUtils";
2
+ import { DOT_PATTERN, getArnResources, getSuffix, getSuffixForArnEndpoint, isBucketNameOptions, isDnsCompatibleBucketName, validateAccountId, validateArnEndpointOptions, validateCustomEndpoint, validateDNSHostLabel, validateMrapAlias, validateNoDualstack, validateNoFIPS, validateOutpostService, validatePartition, validateRegion, validateRegionalClient, validateS3Service, validateService, } from "./bucketHostnameUtils";
3
3
  export var bucketHostname = function (options) {
4
4
  validateCustomEndpoint(options);
5
+ var dualstackEndpoint = options.dualstackEndpoint, baseHostname = options.baseHostname;
6
+ var updatedBaseHostname = dualstackEndpoint ? baseHostname.replace(".dualstack", "") : baseHostname;
5
7
  return isBucketNameOptions(options)
6
8
  ?
7
- getEndpointFromBucketName(options)
9
+ getEndpointFromBucketName(__assign(__assign({}, options), { baseHostname: updatedBaseHostname }))
8
10
  :
9
- getEndpointFromArn(options);
11
+ getEndpointFromArn(__assign(__assign({}, options), { baseHostname: updatedBaseHostname }));
10
12
  };
11
13
  var getEndpointFromBucketName = function (_a) {
12
- var _b = _a.accelerateEndpoint, accelerateEndpoint = _b === void 0 ? false : _b, region = _a.clientRegion, baseHostname = _a.baseHostname, bucketName = _a.bucketName, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.pathStyleEndpoint, pathStyleEndpoint = _d === void 0 ? false : _d, _e = _a.tlsCompatible, tlsCompatible = _e === void 0 ? true : _e, _f = _a.isCustomEndpoint, isCustomEndpoint = _f === void 0 ? false : _f;
13
- var _g = __read(isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname), 2), clientRegion = _g[0], hostnameSuffix = _g[1];
14
+ var _b = _a.accelerateEndpoint, accelerateEndpoint = _b === void 0 ? false : _b, region = _a.clientRegion, baseHostname = _a.baseHostname, bucketName = _a.bucketName, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.fipsEndpoint, fipsEndpoint = _d === void 0 ? false : _d, _e = _a.pathStyleEndpoint, pathStyleEndpoint = _e === void 0 ? false : _e, _f = _a.tlsCompatible, tlsCompatible = _f === void 0 ? true : _f, _g = _a.isCustomEndpoint, isCustomEndpoint = _g === void 0 ? false : _g;
15
+ var _h = __read(isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname), 2), clientRegion = _h[0], hostnameSuffix = _h[1];
14
16
  if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) {
15
17
  return {
16
18
  bucketEndpoint: false,
@@ -31,13 +33,13 @@ var getEndpointFromBucketName = function (_a) {
31
33
  var getEndpointFromArn = function (options) {
32
34
  var isCustomEndpoint = options.isCustomEndpoint, baseHostname = options.baseHostname, clientRegion = options.clientRegion;
33
35
  var hostnameSuffix = isCustomEndpoint ? baseHostname : getSuffixForArnEndpoint(baseHostname)[1];
34
- var pathStyleEndpoint = options.pathStyleEndpoint, _a = options.accelerateEndpoint, accelerateEndpoint = _a === void 0 ? false : _a, _b = options.tlsCompatible, tlsCompatible = _b === void 0 ? true : _b, bucketName = options.bucketName, _c = options.clientPartition, clientPartition = _c === void 0 ? "aws" : _c;
36
+ var pathStyleEndpoint = options.pathStyleEndpoint, _a = options.accelerateEndpoint, accelerateEndpoint = _a === void 0 ? false : _a, _b = options.fipsEndpoint, fipsEndpoint = _b === void 0 ? false : _b, _c = options.tlsCompatible, tlsCompatible = _c === void 0 ? true : _c, bucketName = options.bucketName, _d = options.clientPartition, clientPartition = _d === void 0 ? "aws" : _d;
35
37
  validateArnEndpointOptions({ pathStyleEndpoint: pathStyleEndpoint, accelerateEndpoint: accelerateEndpoint, tlsCompatible: tlsCompatible });
36
38
  var service = bucketName.service, partition = bucketName.partition, accountId = bucketName.accountId, region = bucketName.region, resource = bucketName.resource;
37
39
  validateService(service);
38
40
  validatePartition(partition, { clientPartition: clientPartition });
39
41
  validateAccountId(accountId);
40
- var _d = getArnResources(resource), accesspointName = _d.accesspointName, outpostId = _d.outpostId;
42
+ var _e = getArnResources(resource), accesspointName = _e.accesspointName, outpostId = _e.outpostId;
41
43
  if (service === "s3-object-lambda") {
42
44
  return getEndpointFromObjectLambdaArn(__assign(__assign({}, options), { tlsCompatible: tlsCompatible, bucketName: bucketName, accesspointName: accesspointName, hostnameSuffix: hostnameSuffix }));
43
45
  }
@@ -50,10 +52,16 @@ var getEndpointFromArn = function (options) {
50
52
  return getEndpointFromAccessPointArn(__assign(__assign({}, options), { clientRegion: clientRegion, accesspointName: accesspointName, hostnameSuffix: hostnameSuffix }));
51
53
  };
52
54
  var getEndpointFromObjectLambdaArn = function (_a) {
53
- var _b = _a.dualstackEndpoint, dualstackEndpoint = _b === void 0 ? false : _b, _c = _a.tlsCompatible, tlsCompatible = _c === void 0 ? true : _c, useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _d = _a.clientSigningRegion, clientSigningRegion = _d === void 0 ? clientRegion : _d, accesspointName = _a.accesspointName, bucketName = _a.bucketName, hostnameSuffix = _a.hostnameSuffix;
55
+ var _b = _a.dualstackEndpoint, dualstackEndpoint = _b === void 0 ? false : _b, _c = _a.fipsEndpoint, fipsEndpoint = _c === void 0 ? false : _c, _d = _a.tlsCompatible, tlsCompatible = _d === void 0 ? true : _d, useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _e = _a.clientSigningRegion, clientSigningRegion = _e === void 0 ? clientRegion : _e, accesspointName = _a.accesspointName, bucketName = _a.bucketName, hostnameSuffix = _a.hostnameSuffix;
54
56
  var accountId = bucketName.accountId, region = bucketName.region, service = bucketName.service;
55
57
  validateRegionalClient(clientRegion);
56
- validateRegion(region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true });
58
+ validateRegion(region, {
59
+ useArnRegion: useArnRegion,
60
+ clientRegion: clientRegion,
61
+ clientSigningRegion: clientSigningRegion,
62
+ allowFipsRegion: true,
63
+ useFipsEndpoint: fipsEndpoint,
64
+ });
57
65
  validateNoDualstack(dualstackEndpoint);
58
66
  var DNSHostLabel = accesspointName + "-" + accountId;
59
67
  validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
@@ -61,7 +69,7 @@ var getEndpointFromObjectLambdaArn = function (_a) {
61
69
  var signingRegion = useArnRegion ? region : clientSigningRegion;
62
70
  return {
63
71
  bucketEndpoint: true,
64
- hostname: DNSHostLabel + "." + service + (isFipsRegion(clientRegion) ? "-fips" : "") + "." + getPseudoRegion(endpointRegion) + "." + hostnameSuffix,
72
+ hostname: DNSHostLabel + "." + service + (fipsEndpoint ? "-fips" : "") + "." + endpointRegion + "." + hostnameSuffix,
65
73
  signingRegion: signingRegion,
66
74
  signingService: service,
67
75
  };
@@ -80,9 +88,9 @@ var getEndpointFromMRAPArn = function (_a) {
80
88
  };
81
89
  };
82
90
  var getEndpointFromOutpostArn = function (_a) {
83
- var useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _b = _a.clientSigningRegion, clientSigningRegion = _b === void 0 ? clientRegion : _b, bucketName = _a.bucketName, outpostId = _a.outpostId, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.tlsCompatible, tlsCompatible = _d === void 0 ? true : _d, accesspointName = _a.accesspointName, isCustomEndpoint = _a.isCustomEndpoint, hostnameSuffix = _a.hostnameSuffix;
91
+ var useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _b = _a.clientSigningRegion, clientSigningRegion = _b === void 0 ? clientRegion : _b, bucketName = _a.bucketName, outpostId = _a.outpostId, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.fipsEndpoint, fipsEndpoint = _d === void 0 ? false : _d, _e = _a.tlsCompatible, tlsCompatible = _e === void 0 ? true : _e, accesspointName = _a.accesspointName, isCustomEndpoint = _a.isCustomEndpoint, hostnameSuffix = _a.hostnameSuffix;
84
92
  validateRegionalClient(clientRegion);
85
- validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion });
93
+ validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, useFipsEndpoint: fipsEndpoint });
86
94
  var DNSHostLabel = accesspointName + "-" + bucketName.accountId;
87
95
  validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
88
96
  var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -90,7 +98,7 @@ var getEndpointFromOutpostArn = function (_a) {
90
98
  validateOutpostService(bucketName.service);
91
99
  validateDNSHostLabel(outpostId, { tlsCompatible: tlsCompatible });
92
100
  validateNoDualstack(dualstackEndpoint);
93
- validateNoFIPS(endpointRegion);
101
+ validateNoFIPS(fipsEndpoint);
94
102
  var hostnamePrefix = DNSHostLabel + "." + outpostId;
95
103
  return {
96
104
  bucketEndpoint: true,
@@ -100,9 +108,15 @@ var getEndpointFromOutpostArn = function (_a) {
100
108
  };
101
109
  };
102
110
  var getEndpointFromAccessPointArn = function (_a) {
103
- var useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _b = _a.clientSigningRegion, clientSigningRegion = _b === void 0 ? clientRegion : _b, bucketName = _a.bucketName, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.tlsCompatible, tlsCompatible = _d === void 0 ? true : _d, accesspointName = _a.accesspointName, isCustomEndpoint = _a.isCustomEndpoint, hostnameSuffix = _a.hostnameSuffix;
111
+ var useArnRegion = _a.useArnRegion, clientRegion = _a.clientRegion, _b = _a.clientSigningRegion, clientSigningRegion = _b === void 0 ? clientRegion : _b, bucketName = _a.bucketName, _c = _a.dualstackEndpoint, dualstackEndpoint = _c === void 0 ? false : _c, _d = _a.fipsEndpoint, fipsEndpoint = _d === void 0 ? false : _d, _e = _a.tlsCompatible, tlsCompatible = _e === void 0 ? true : _e, accesspointName = _a.accesspointName, isCustomEndpoint = _a.isCustomEndpoint, hostnameSuffix = _a.hostnameSuffix;
104
112
  validateRegionalClient(clientRegion);
105
- validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true });
113
+ validateRegion(bucketName.region, {
114
+ useArnRegion: useArnRegion,
115
+ clientRegion: clientRegion,
116
+ clientSigningRegion: clientSigningRegion,
117
+ allowFipsRegion: true,
118
+ useFipsEndpoint: fipsEndpoint,
119
+ });
106
120
  var hostnamePrefix = accesspointName + "-" + bucketName.accountId;
107
121
  validateDNSHostLabel(hostnamePrefix, { tlsCompatible: tlsCompatible });
108
122
  var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -112,7 +126,7 @@ var getEndpointFromAccessPointArn = function (_a) {
112
126
  bucketEndpoint: true,
113
127
  hostname: "" + hostnamePrefix + (isCustomEndpoint
114
128
  ? ""
115
- : ".s3-accesspoint" + (isFipsRegion(clientRegion) ? "-fips" : "") + (dualstackEndpoint ? ".dualstack" : "") + "." + getPseudoRegion(endpointRegion)) + "." + hostnameSuffix,
129
+ : ".s3-accesspoint" + (fipsEndpoint ? "-fips" : "") + (dualstackEndpoint ? ".dualstack" : "") + "." + endpointRegion) + "." + hostnameSuffix,
116
130
  signingRegion: signingRegion,
117
131
  };
118
132
  };
@@ -7,7 +7,6 @@ export var S3_HOSTNAME_PATTERN = /^(.+\.)?s3[.-]([a-z0-9-]+)\./;
7
7
  var S3_US_EAST_1_ALTNAME_PATTERN = /^s3(-external-1)?\.amazonaws\.com$/;
8
8
  var AWS_PARTITION_SUFFIX = "amazonaws.com";
9
9
  export var isBucketNameOptions = function (options) { return typeof options.bucketName === "string"; };
10
- export var getPseudoRegion = function (region) { return (isFipsRegion(region) ? region.replace(/fips-|-fips/, "") : region); };
11
10
  export var isDnsCompatibleBucketName = function (bucketName) {
12
11
  return DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
13
12
  };
@@ -58,7 +57,7 @@ export var validateRegion = function (region, options) {
58
57
  if (region === "") {
59
58
  throw new Error("ARN region is empty");
60
59
  }
61
- if (isFipsRegion(options.clientRegion)) {
60
+ if (options.useFipsEndpoint) {
62
61
  if (!options.allowFipsRegion) {
63
62
  throw new Error("FIPS region is not supported");
64
63
  }
@@ -73,14 +72,11 @@ export var validateRegion = function (region, options) {
73
72
  }
74
73
  };
75
74
  export var validateRegionalClient = function (region) {
76
- if (["s3-external-1", "aws-global"].includes(getPseudoRegion(region))) {
75
+ if (["s3-external-1", "aws-global"].includes(region)) {
77
76
  throw new Error("Client region " + region + " is not regional");
78
77
  }
79
78
  };
80
- export var isFipsRegion = function (region) { return region.startsWith("fips-") || region.endsWith("-fips"); };
81
- var isEqualRegions = function (regionA, regionB) {
82
- return regionA === regionB || getPseudoRegion(regionA) === regionB || regionA === getPseudoRegion(regionB);
83
- };
79
+ var isEqualRegions = function (regionA, regionB) { return regionA === regionB; };
84
80
  export var validateAccountId = function (accountId) {
85
81
  if (!/[0-9]{12}/.exec(accountId)) {
86
82
  throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'");
@@ -128,9 +124,9 @@ export var validateNoDualstack = function (dualstackEndpoint) {
128
124
  if (dualstackEndpoint)
129
125
  throw new Error("Dualstack endpoint is not supported with Outpost or Multi-region Access Point ARN.");
130
126
  };
131
- export var validateNoFIPS = function (region) {
132
- if (isFipsRegion(region !== null && region !== void 0 ? region : ""))
133
- throw new Error("FIPS region is not supported with Outpost, got " + region);
127
+ export var validateNoFIPS = function (useFipsEndpoint) {
128
+ if (useFipsEndpoint)
129
+ throw new Error("FIPS region is not supported with Outpost.");
134
130
  };
135
131
  export var validateMrapAlias = function (name) {
136
132
  try {
@@ -1,53 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  export function resolveBucketEndpointConfig(input) {
3
- var _a = input.bucketEndpoint, bucketEndpoint = _a === void 0 ? false : _a, _b = input.forcePathStyle, forcePathStyle = _b === void 0 ? false : _b, _c = input.useAccelerateEndpoint, useAccelerateEndpoint = _c === void 0 ? false : _c, _d = input.useDualstackEndpoint, useDualstackEndpoint = _d === void 0 ? false : _d, _e = input.useArnRegion, useArnRegion = _e === void 0 ? false : _e, _f = input.disableMultiregionAccessPoints, disableMultiregionAccessPoints = _f === void 0 ? false : _f;
4
- return __assign(__assign({}, input), { bucketEndpoint: bucketEndpoint, forcePathStyle: forcePathStyle, useAccelerateEndpoint: useAccelerateEndpoint, useDualstackEndpoint: useDualstackEndpoint, useArnRegion: typeof useArnRegion === "function" ? useArnRegion : function () { return Promise.resolve(useArnRegion); }, disableMultiregionAccessPoints: typeof disableMultiregionAccessPoints === "function"
3
+ var _a = input.bucketEndpoint, bucketEndpoint = _a === void 0 ? false : _a, _b = input.forcePathStyle, forcePathStyle = _b === void 0 ? false : _b, _c = input.useAccelerateEndpoint, useAccelerateEndpoint = _c === void 0 ? false : _c, _d = input.useArnRegion, useArnRegion = _d === void 0 ? false : _d, _e = input.disableMultiregionAccessPoints, disableMultiregionAccessPoints = _e === void 0 ? false : _e;
4
+ return __assign(__assign({}, input), { bucketEndpoint: bucketEndpoint, forcePathStyle: forcePathStyle, useAccelerateEndpoint: useAccelerateEndpoint, useArnRegion: typeof useArnRegion === "function" ? useArnRegion : function () { return Promise.resolve(useArnRegion); }, disableMultiregionAccessPoints: typeof disableMultiregionAccessPoints === "function"
5
5
  ? disableMultiregionAccessPoints
6
6
  : function () { return Promise.resolve(disableMultiregionAccessPoints); } });
7
7
  }
8
- export var NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
9
- export var NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
10
- export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
11
- export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
12
- export var NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
13
- environmentVariableSelector: function (env) {
14
- if (!Object.prototype.hasOwnProperty.call(env, NODE_USE_ARN_REGION_ENV_NAME))
15
- return undefined;
16
- if (env[NODE_USE_ARN_REGION_ENV_NAME] === "true")
17
- return true;
18
- if (env[NODE_USE_ARN_REGION_ENV_NAME] === "false")
19
- return false;
20
- throw new Error("Cannot load env " + NODE_USE_ARN_REGION_ENV_NAME + ". Expected \"true\" or \"false\", got " + env[NODE_USE_ARN_REGION_ENV_NAME] + ".");
21
- },
22
- configFileSelector: function (profile) {
23
- if (!Object.prototype.hasOwnProperty.call(profile, NODE_USE_ARN_REGION_INI_NAME))
24
- return undefined;
25
- if (profile[NODE_USE_ARN_REGION_INI_NAME] === "true")
26
- return true;
27
- if (profile[NODE_USE_ARN_REGION_INI_NAME] === "false")
28
- return false;
29
- throw new Error("Cannot load shared config entry " + NODE_USE_ARN_REGION_INI_NAME + ". Expected \"true\" or \"false\", got " + profile[NODE_USE_ARN_REGION_INI_NAME] + ".");
30
- },
31
- default: false,
32
- };
33
- export var NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = {
34
- environmentVariableSelector: function (env) {
35
- if (!Object.prototype.hasOwnProperty.call(env, NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME))
36
- return undefined;
37
- if (env[NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME] === "true")
38
- return true;
39
- if (env[NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME] === "false")
40
- return false;
41
- throw new Error("Cannot load env " + NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME + ". Expected \"true\" or \"false\", got " + env[NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME] + ".");
42
- },
43
- configFileSelector: function (profile) {
44
- if (!Object.prototype.hasOwnProperty.call(profile, NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME))
45
- return undefined;
46
- if (profile[NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME] === "true")
47
- return true;
48
- if (profile[NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME] === "false")
49
- return false;
50
- throw new Error("Cannot load shared config entry " + NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME + ". Expected \"true\" or \"false\", got " + profile[NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME] + ".");
51
- },
52
- default: false,
53
- };
package/dist-es/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./NodeDisableMultiregionAccessPointConfigOptions";
2
+ export * from "./NodeUseArnRegionConfigOptions";
1
3
  export * from "./bucketEndpointMiddleware";
2
4
  export * from "./bucketHostname";
3
5
  export * from "./configurations";
4
- export { getArnResources, getPseudoRegion, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
6
+ export { getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
@@ -0,0 +1,4 @@
1
+ import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
3
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
4
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -0,0 +1,9 @@
1
+ import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
+ export declare const NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
3
+ export declare const NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
4
+ /**
5
+ * Config to load useArnRegion from environment variables and shared INI files
6
+ *
7
+ * @api private
8
+ */
9
+ export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -11,6 +11,7 @@ export interface BucketHostnameParams {
11
11
  clientRegion: string;
12
12
  accelerateEndpoint?: boolean;
13
13
  dualstackEndpoint?: boolean;
14
+ fipsEndpoint?: boolean;
14
15
  pathStyleEndpoint?: boolean;
15
16
  tlsCompatible?: boolean;
16
17
  }
@@ -22,11 +23,6 @@ export interface ArnHostnameParams extends Omit<BucketHostnameParams, "bucketNam
22
23
  disableMultiregionAccessPoints?: boolean;
23
24
  }
24
25
  export declare const isBucketNameOptions: (options: BucketHostnameParams | ArnHostnameParams) => options is BucketHostnameParams;
25
- /**
26
- * Get pseudo region from supplied region. For example, if supplied with `fips-us-west-2`, it returns `us-west-2`.
27
- * @internal
28
- */
29
- export declare const getPseudoRegion: (region: string) => string;
30
26
  /**
31
27
  * Determines whether a given string is DNS compliant per the rules outlined by
32
28
  * S3. Length, capitaization, and leading dot restrictions are enforced by the
@@ -70,16 +66,13 @@ export declare const validateRegion: (region: string, options: {
70
66
  allowFipsRegion?: boolean;
71
67
  clientRegion: string;
72
68
  clientSigningRegion: string;
69
+ useFipsEndpoint: boolean;
73
70
  }) => void;
74
71
  /**
75
72
  *
76
73
  * @param region
77
74
  */
78
75
  export declare const validateRegionalClient: (region: string) => void;
79
- /**
80
- * @internal
81
- */
82
- export declare const isFipsRegion: (region: string) => boolean;
83
76
  /**
84
77
  * Validate an account ID
85
78
  * @internal
@@ -114,10 +107,10 @@ export declare const getArnResources: (resource: string) => {
114
107
  */
115
108
  export declare const validateNoDualstack: (dualstackEndpoint?: boolean | undefined) => void;
116
109
  /**
117
- * Validate region is not appended or prepended with a `fips-`
110
+ * Validate fips endpoint is not set up.
118
111
  * @internal
119
112
  */
120
- export declare const validateNoFIPS: (region?: string | undefined) => void;
113
+ export declare const validateNoFIPS: (useFipsEndpoint?: boolean | undefined) => void;
121
114
  /**
122
115
  * Validate the multi-region access point alias.
123
116
  * @private
@@ -1,4 +1,3 @@
1
- import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
1
  import { Provider, RegionInfoProvider } from "@aws-sdk/types";
3
2
  export interface BucketEndpointInputConfig {
4
3
  /**
@@ -13,13 +12,6 @@ export interface BucketEndpointInputConfig {
13
12
  * Whether to use the S3 Transfer Acceleration endpoint by default
14
13
  */
15
14
  useAccelerateEndpoint?: boolean;
16
- /**
17
- * Enables IPv6/IPv4 dualstack endpoint. When a DNS lookup is performed on an endpoint of this type, it returns an “A”
18
- * record with an IPv4 address and an “AAAA” record with an IPv6 address. In most cases the network stack in the
19
- * client environment will automatically prefer the AAAA record and make a connection using the IPv6 address. Note,
20
- * however, that currently on Windows, the IPv4 address will be preferred.
21
- */
22
- useDualstackEndpoint?: boolean;
23
15
  /**
24
16
  * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
25
17
  */
@@ -34,6 +26,8 @@ interface PreviouslyResolved {
34
26
  isCustomEndpoint: boolean;
35
27
  region: Provider<string>;
36
28
  regionInfoProvider: RegionInfoProvider;
29
+ useFipsEndpoint: Provider<boolean>;
30
+ useDualstackEndpoint: Provider<boolean>;
37
31
  }
38
32
  export interface BucketEndpointResolvedConfig {
39
33
  /**
@@ -54,9 +48,13 @@ export interface BucketEndpointResolvedConfig {
54
48
  */
55
49
  useAccelerateEndpoint: boolean;
56
50
  /**
57
- * Resolved value for input config {@link BucketEndpointInputConfig.useDualstackEndpoint}
51
+ * Enables FIPS compatible endpoints.
52
+ */
53
+ useFipsEndpoint: Provider<boolean>;
54
+ /**
55
+ * Enables IPv6/IPv4 dualstack endpoint.
58
56
  */
59
- useDualstackEndpoint: boolean;
57
+ useDualstackEndpoint: Provider<boolean>;
60
58
  /**
61
59
  * Resolved value for input config {@link BucketEndpointInputConfig.useArnRegion}
62
60
  */
@@ -73,15 +71,4 @@ export interface BucketEndpointResolvedConfig {
73
71
  disableMultiregionAccessPoints: Provider<boolean>;
74
72
  }
75
73
  export declare function resolveBucketEndpointConfig<T>(input: T & PreviouslyResolved & BucketEndpointInputConfig): T & BucketEndpointResolvedConfig;
76
- export declare const NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
77
- export declare const NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
78
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
79
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
80
- /**
81
- * Config to load useArnRegion from environment variables and shared INI files
82
- *
83
- * @api private
84
- */
85
- export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
86
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
87
74
  export {};
@@ -1,4 +1,6 @@
1
+ export * from "./NodeDisableMultiregionAccessPointConfigOptions";
2
+ export * from "./NodeUseArnRegionConfigOptions";
1
3
  export * from "./bucketEndpointMiddleware";
2
4
  export * from "./bucketHostname";
3
5
  export * from "./configurations";
4
- export { getArnResources, getPseudoRegion, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
6
+ export { getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
@@ -0,0 +1,4 @@
1
+ import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
3
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
4
+ export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -0,0 +1,5 @@
1
+ import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
+ export declare const NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
3
+ export declare const NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
4
+
5
+ export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -11,6 +11,7 @@ export interface BucketHostnameParams {
11
11
  clientRegion: string;
12
12
  accelerateEndpoint?: boolean;
13
13
  dualstackEndpoint?: boolean;
14
+ fipsEndpoint?: boolean;
14
15
  pathStyleEndpoint?: boolean;
15
16
  tlsCompatible?: boolean;
16
17
  }
@@ -23,8 +24,6 @@ export interface ArnHostnameParams extends Pick<BucketHostnameParams, Exclude<ke
23
24
  }
24
25
  export declare const isBucketNameOptions: (options: BucketHostnameParams | ArnHostnameParams) => options is BucketHostnameParams;
25
26
 
26
- export declare const getPseudoRegion: (region: string) => string;
27
-
28
27
  export declare const isDnsCompatibleBucketName: (bucketName: string) => boolean;
29
28
  export declare const getSuffix: (hostname: string) => [
30
29
  string,
@@ -53,12 +52,11 @@ export declare const validateRegion: (region: string, options: {
53
52
  allowFipsRegion?: boolean;
54
53
  clientRegion: string;
55
54
  clientSigningRegion: string;
55
+ useFipsEndpoint: boolean;
56
56
  }) => void;
57
57
 
58
58
  export declare const validateRegionalClient: (region: string) => void;
59
59
 
60
- export declare const isFipsRegion: (region: string) => boolean;
61
-
62
60
  export declare const validateAccountId: (accountId: string) => void;
63
61
 
64
62
  export declare const validateDNSHostLabel: (label: string, options?: {
@@ -77,6 +75,6 @@ export declare const getArnResources: (resource: string) => {
77
75
 
78
76
  export declare const validateNoDualstack: (dualstackEndpoint?: boolean | undefined) => void;
79
77
 
80
- export declare const validateNoFIPS: (region?: string | undefined) => void;
78
+ export declare const validateNoFIPS: (useFipsEndpoint?: boolean | undefined) => void;
81
79
 
82
80
  export declare const validateMrapAlias: (name: string) => void;
@@ -1,4 +1,3 @@
1
- import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
1
  import { Provider, RegionInfoProvider } from "@aws-sdk/types";
3
2
  export interface BucketEndpointInputConfig {
4
3
 
@@ -8,8 +7,6 @@ export interface BucketEndpointInputConfig {
8
7
 
9
8
  useAccelerateEndpoint?: boolean;
10
9
 
11
- useDualstackEndpoint?: boolean;
12
-
13
10
  useArnRegion?: boolean | Provider<boolean>;
14
11
 
15
12
  disableMultiregionAccessPoints?: boolean | Provider<boolean>;
@@ -18,6 +15,8 @@ interface PreviouslyResolved {
18
15
  isCustomEndpoint: boolean;
19
16
  region: Provider<string>;
20
17
  regionInfoProvider: RegionInfoProvider;
18
+ useFipsEndpoint: Provider<boolean>;
19
+ useDualstackEndpoint: Provider<boolean>;
21
20
  }
22
21
  export interface BucketEndpointResolvedConfig {
23
22
 
@@ -29,7 +28,9 @@ export interface BucketEndpointResolvedConfig {
29
28
 
30
29
  useAccelerateEndpoint: boolean;
31
30
 
32
- useDualstackEndpoint: boolean;
31
+ useFipsEndpoint: Provider<boolean>;
32
+
33
+ useDualstackEndpoint: Provider<boolean>;
33
34
 
34
35
  useArnRegion: Provider<boolean>;
35
36
 
@@ -39,11 +40,4 @@ export interface BucketEndpointResolvedConfig {
39
40
  disableMultiregionAccessPoints: Provider<boolean>;
40
41
  }
41
42
  export declare function resolveBucketEndpointConfig<T>(input: T & PreviouslyResolved & BucketEndpointInputConfig): T & BucketEndpointResolvedConfig;
42
- export declare const NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
43
- export declare const NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
44
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
45
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
46
-
47
- export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
48
- export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
49
43
  export {};
@@ -1,4 +1,6 @@
1
+ export * from "./NodeDisableMultiregionAccessPointConfigOptions";
2
+ export * from "./NodeUseArnRegionConfigOptions";
1
3
  export * from "./bucketEndpointMiddleware";
2
4
  export * from "./bucketHostname";
3
5
  export * from "./configurations";
4
- export { getArnResources, getPseudoRegion, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
6
+ export { getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-bucket-endpoint",
3
- "version": "3.37.0",
3
+ "version": "3.40.1",
4
4
  "scripts": {
5
5
  "build": "yarn build:cjs && yarn build:es && yarn build:types",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -18,14 +18,15 @@
18
18
  },
19
19
  "license": "Apache-2.0",
20
20
  "dependencies": {
21
- "@aws-sdk/protocol-http": "3.37.0",
22
- "@aws-sdk/types": "3.37.0",
21
+ "@aws-sdk/protocol-http": "3.40.0",
22
+ "@aws-sdk/types": "3.40.0",
23
23
  "@aws-sdk/util-arn-parser": "3.37.0",
24
+ "@aws-sdk/util-config-provider": "3.40.0",
24
25
  "tslib": "^2.3.0"
25
26
  },
26
27
  "devDependencies": {
27
- "@aws-sdk/middleware-stack": "3.37.0",
28
- "@aws-sdk/node-config-provider": "3.37.0",
28
+ "@aws-sdk/middleware-stack": "3.40.0",
29
+ "@aws-sdk/node-config-provider": "3.40.0",
29
30
  "@types/jest": "^26.0.4",
30
31
  "jest": "^26.1.0",
31
32
  "typescript": "~4.3.5"