@aws-sdk/middleware-bucket-endpoint 3.36.0 → 3.40.0

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,41 @@
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.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.39.0...v3.40.0) (2021-11-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **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))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.39.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.38.0...v3.39.0) (2021-10-29)
18
+
19
+ **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
20
+
21
+
22
+
23
+
24
+
25
+ # [3.38.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.37.0...v3.38.0) (2021-10-22)
26
+
27
+ **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
28
+
29
+
30
+
31
+
32
+
33
+ # [3.37.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.36.1...v3.37.0) (2021-10-15)
34
+
35
+ **Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
36
+
37
+
38
+
39
+
40
+
6
41
  # [3.36.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.35.0...v3.36.0) (2021-10-08)
7
42
 
8
43
 
@@ -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,
@@ -11,7 +11,7 @@ const bucketHostname = (options) => {
11
11
  getEndpointFromArn(options);
12
12
  };
13
13
  exports.bucketHostname = bucketHostname;
14
- const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
14
+ const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, fipsEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
15
15
  const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : bucketHostnameUtils_1.getSuffix(baseHostname);
16
16
  if (pathStyleEndpoint || !bucketHostnameUtils_1.isDnsCompatibleBucketName(bucketName) || (tlsCompatible && bucketHostnameUtils_1.DOT_PATTERN.test(bucketName))) {
17
17
  return {
@@ -33,7 +33,7 @@ const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: r
33
33
  const getEndpointFromArn = (options) => {
34
34
  const { isCustomEndpoint, baseHostname, clientRegion } = options;
35
35
  const hostnameSuffix = isCustomEndpoint ? baseHostname : bucketHostnameUtils_1.getSuffixForArnEndpoint(baseHostname)[1];
36
- const { pathStyleEndpoint, accelerateEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
36
+ const { pathStyleEndpoint, accelerateEndpoint = false, fipsEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
37
37
  bucketHostnameUtils_1.validateArnEndpointOptions({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
38
38
  const { service, partition, accountId, region, resource } = bucketName;
39
39
  bucketHostnameUtils_1.validateService(service);
@@ -51,10 +51,16 @@ const getEndpointFromArn = (options) => {
51
51
  }
52
52
  return getEndpointFromAccessPointArn({ ...options, clientRegion, accesspointName, hostnameSuffix });
53
53
  };
54
- const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
54
+ const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
55
55
  const { accountId, region, service } = bucketName;
56
56
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
57
- bucketHostnameUtils_1.validateRegion(region, { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion: true });
57
+ bucketHostnameUtils_1.validateRegion(region, {
58
+ useArnRegion,
59
+ clientRegion,
60
+ clientSigningRegion,
61
+ allowFipsRegion: true,
62
+ useFipsEndpoint: fipsEndpoint,
63
+ });
58
64
  bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
59
65
  const DNSHostLabel = `${accesspointName}-${accountId}`;
60
66
  bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
@@ -62,7 +68,7 @@ const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, tlsCompatib
62
68
  const signingRegion = useArnRegion ? region : clientSigningRegion;
63
69
  return {
64
70
  bucketEndpoint: true,
65
- hostname: `${DNSHostLabel}.${service}${bucketHostnameUtils_1.isFipsRegion(clientRegion) ? "-fips" : ""}.${bucketHostnameUtils_1.getPseudoRegion(endpointRegion)}.${hostnameSuffix}`,
71
+ hostname: `${DNSHostLabel}.${service}${fipsEndpoint ? "-fips" : ""}.${endpointRegion}.${hostnameSuffix}`,
66
72
  signingRegion,
67
73
  signingService: service,
68
74
  };
@@ -79,9 +85,9 @@ const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpo
79
85
  signingRegion: "*",
80
86
  };
81
87
  };
82
- const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
88
+ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
83
89
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
84
- bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion });
90
+ bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, useFipsEndpoint: fipsEndpoint });
85
91
  const DNSHostLabel = `${accesspointName}-${bucketName.accountId}`;
86
92
  bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
87
93
  const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -89,7 +95,7 @@ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRe
89
95
  bucketHostnameUtils_1.validateOutpostService(bucketName.service);
90
96
  bucketHostnameUtils_1.validateDNSHostLabel(outpostId, { tlsCompatible });
91
97
  bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
92
- bucketHostnameUtils_1.validateNoFIPS(endpointRegion);
98
+ bucketHostnameUtils_1.validateNoFIPS(fipsEndpoint);
93
99
  const hostnamePrefix = `${DNSHostLabel}.${outpostId}`;
94
100
  return {
95
101
  bucketEndpoint: true,
@@ -98,9 +104,15 @@ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRe
98
104
  signingService: "s3-outposts",
99
105
  };
100
106
  };
101
- const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
107
+ const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
102
108
  bucketHostnameUtils_1.validateRegionalClient(clientRegion);
103
- bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, allowFipsRegion: true });
109
+ bucketHostnameUtils_1.validateRegion(bucketName.region, {
110
+ useArnRegion,
111
+ clientRegion,
112
+ clientSigningRegion,
113
+ allowFipsRegion: true,
114
+ useFipsEndpoint: fipsEndpoint,
115
+ });
104
116
  const hostnamePrefix = `${accesspointName}-${bucketName.accountId}`;
105
117
  bucketHostnameUtils_1.validateDNSHostLabel(hostnamePrefix, { tlsCompatible });
106
118
  const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -110,7 +122,7 @@ const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigni
110
122
  bucketEndpoint: true,
111
123
  hostname: `${hostnamePrefix}${isCustomEndpoint
112
124
  ? ""
113
- : `.s3-accesspoint${bucketHostnameUtils_1.isFipsRegion(clientRegion) ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${bucketHostnameUtils_1.getPseudoRegion(endpointRegion)}`}.${hostnameSuffix}`,
125
+ : `.s3-accesspoint${fipsEndpoint ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${endpointRegion}`}.${hostnameSuffix}`,
114
126
  signingRegion,
115
127
  };
116
128
  };
@@ -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,5 +1,5 @@
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
5
  return isBucketNameOptions(options)
@@ -9,8 +9,8 @@ export var bucketHostname = function (options) {
9
9
  getEndpointFromArn(options);
10
10
  };
11
11
  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];
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.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;
13
+ var _h = __read(isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname), 2), clientRegion = _h[0], hostnameSuffix = _h[1];
14
14
  if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) {
15
15
  return {
16
16
  bucketEndpoint: false,
@@ -31,13 +31,13 @@ var getEndpointFromBucketName = function (_a) {
31
31
  var getEndpointFromArn = function (options) {
32
32
  var isCustomEndpoint = options.isCustomEndpoint, baseHostname = options.baseHostname, clientRegion = options.clientRegion;
33
33
  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;
34
+ 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
35
  validateArnEndpointOptions({ pathStyleEndpoint: pathStyleEndpoint, accelerateEndpoint: accelerateEndpoint, tlsCompatible: tlsCompatible });
36
36
  var service = bucketName.service, partition = bucketName.partition, accountId = bucketName.accountId, region = bucketName.region, resource = bucketName.resource;
37
37
  validateService(service);
38
38
  validatePartition(partition, { clientPartition: clientPartition });
39
39
  validateAccountId(accountId);
40
- var _d = getArnResources(resource), accesspointName = _d.accesspointName, outpostId = _d.outpostId;
40
+ var _e = getArnResources(resource), accesspointName = _e.accesspointName, outpostId = _e.outpostId;
41
41
  if (service === "s3-object-lambda") {
42
42
  return getEndpointFromObjectLambdaArn(__assign(__assign({}, options), { tlsCompatible: tlsCompatible, bucketName: bucketName, accesspointName: accesspointName, hostnameSuffix: hostnameSuffix }));
43
43
  }
@@ -50,10 +50,16 @@ var getEndpointFromArn = function (options) {
50
50
  return getEndpointFromAccessPointArn(__assign(__assign({}, options), { clientRegion: clientRegion, accesspointName: accesspointName, hostnameSuffix: hostnameSuffix }));
51
51
  };
52
52
  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;
53
+ 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
54
  var accountId = bucketName.accountId, region = bucketName.region, service = bucketName.service;
55
55
  validateRegionalClient(clientRegion);
56
- validateRegion(region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true });
56
+ validateRegion(region, {
57
+ useArnRegion: useArnRegion,
58
+ clientRegion: clientRegion,
59
+ clientSigningRegion: clientSigningRegion,
60
+ allowFipsRegion: true,
61
+ useFipsEndpoint: fipsEndpoint,
62
+ });
57
63
  validateNoDualstack(dualstackEndpoint);
58
64
  var DNSHostLabel = accesspointName + "-" + accountId;
59
65
  validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
@@ -61,7 +67,7 @@ var getEndpointFromObjectLambdaArn = function (_a) {
61
67
  var signingRegion = useArnRegion ? region : clientSigningRegion;
62
68
  return {
63
69
  bucketEndpoint: true,
64
- hostname: DNSHostLabel + "." + service + (isFipsRegion(clientRegion) ? "-fips" : "") + "." + getPseudoRegion(endpointRegion) + "." + hostnameSuffix,
70
+ hostname: DNSHostLabel + "." + service + (fipsEndpoint ? "-fips" : "") + "." + endpointRegion + "." + hostnameSuffix,
65
71
  signingRegion: signingRegion,
66
72
  signingService: service,
67
73
  };
@@ -80,9 +86,9 @@ var getEndpointFromMRAPArn = function (_a) {
80
86
  };
81
87
  };
82
88
  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;
89
+ 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
90
  validateRegionalClient(clientRegion);
85
- validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion });
91
+ validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, useFipsEndpoint: fipsEndpoint });
86
92
  var DNSHostLabel = accesspointName + "-" + bucketName.accountId;
87
93
  validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
88
94
  var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -90,7 +96,7 @@ var getEndpointFromOutpostArn = function (_a) {
90
96
  validateOutpostService(bucketName.service);
91
97
  validateDNSHostLabel(outpostId, { tlsCompatible: tlsCompatible });
92
98
  validateNoDualstack(dualstackEndpoint);
93
- validateNoFIPS(endpointRegion);
99
+ validateNoFIPS(fipsEndpoint);
94
100
  var hostnamePrefix = DNSHostLabel + "." + outpostId;
95
101
  return {
96
102
  bucketEndpoint: true,
@@ -100,9 +106,15 @@ var getEndpointFromOutpostArn = function (_a) {
100
106
  };
101
107
  };
102
108
  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;
109
+ 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
110
  validateRegionalClient(clientRegion);
105
- validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, allowFipsRegion: true });
111
+ validateRegion(bucketName.region, {
112
+ useArnRegion: useArnRegion,
113
+ clientRegion: clientRegion,
114
+ clientSigningRegion: clientSigningRegion,
115
+ allowFipsRegion: true,
116
+ useFipsEndpoint: fipsEndpoint,
117
+ });
106
118
  var hostnamePrefix = accesspointName + "-" + bucketName.accountId;
107
119
  validateDNSHostLabel(hostnamePrefix, { tlsCompatible: tlsCompatible });
108
120
  var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
@@ -112,7 +124,7 @@ var getEndpointFromAccessPointArn = function (_a) {
112
124
  bucketEndpoint: true,
113
125
  hostname: "" + hostnamePrefix + (isCustomEndpoint
114
126
  ? ""
115
- : ".s3-accesspoint" + (isFipsRegion(clientRegion) ? "-fips" : "") + (dualstackEndpoint ? ".dualstack" : "") + "." + getPseudoRegion(endpointRegion)) + "." + hostnameSuffix,
127
+ : ".s3-accesspoint" + (fipsEndpoint ? "-fips" : "") + (dualstackEndpoint ? ".dualstack" : "") + "." + endpointRegion) + "." + hostnameSuffix,
116
128
  signingRegion: signingRegion,
117
129
  };
118
130
  };
@@ -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
  }
@@ -22,30 +23,13 @@ export interface ArnHostnameParams extends Pick<BucketHostnameParams, Exclude<ke
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
- /**
31
- * Determines whether a given string is DNS compliant per the rules outlined by
32
- * S3. Length, capitaization, and leading dot restrictions are enforced by the
33
- * DOMAIN_PATTERN regular expression.
34
- * @internal
35
- *
36
- * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
37
- */
26
+
38
27
  export declare const isDnsCompatibleBucketName: (bucketName: string) => boolean;
39
28
  export declare const getSuffix: (hostname: string) => [
40
29
  string,
41
30
  string
42
31
  ];
43
- /**
44
- * Infer region and hostname suffix from a complete hostname
45
- * @internal
46
- * @param hostname - Hostname
47
- * @returns [Region, Hostname suffix]
48
- */
32
+
49
33
  export declare const getSuffixForArnEndpoint: (hostname: string) => [
50
34
  string,
51
35
  string
@@ -58,43 +42,23 @@ export declare const validateArnEndpointOptions: (options: {
58
42
  export declare const validateService: (service: string) => void;
59
43
  export declare const validateS3Service: (service: string) => void;
60
44
  export declare const validateOutpostService: (service: string) => void;
61
- /**
62
- * Validate partition inferred from ARN is the same to `options.clientPartition`.
63
- * @internal
64
- */
45
+
65
46
  export declare const validatePartition: (partition: string, options: {
66
47
  clientPartition: string;
67
48
  }) => void;
68
- /**
69
- * validate region value inferred from ARN. If `options.useArnRegion` is set, it validates the region is not a FIPS
70
- * region. If `options.useArnRegion` is unset, it validates the region is equal to `options.clientRegion` or
71
- * `options.clientSigningRegion`.
72
- * @internal
73
- */
49
+
74
50
  export declare const validateRegion: (region: string, options: {
75
51
  useArnRegion?: boolean;
76
52
  allowFipsRegion?: boolean;
77
53
  clientRegion: string;
78
54
  clientSigningRegion: string;
55
+ useFipsEndpoint: boolean;
79
56
  }) => void;
80
- /**
81
- *
82
- * @param region
83
- */
57
+
84
58
  export declare const validateRegionalClient: (region: string) => void;
85
- /**
86
- * @internal
87
- */
88
- export declare const isFipsRegion: (region: string) => boolean;
89
- /**
90
- * Validate an account ID
91
- * @internal
92
- */
59
+
93
60
  export declare const validateAccountId: (accountId: string) => void;
94
- /**
95
- * Validate a host label according to https://tools.ietf.org/html/rfc3986#section-3.2.2
96
- * @internal
97
- */
61
+
98
62
  export declare const validateDNSHostLabel: (label: string, options?: {
99
63
  tlsCompatible?: boolean;
100
64
  }) => void;
@@ -103,29 +67,14 @@ export declare const validateCustomEndpoint: (options: {
103
67
  dualstackEndpoint?: boolean;
104
68
  accelerateEndpoint?: boolean;
105
69
  }) => void;
106
- /**
107
- * Validate and parse an Access Point ARN or Outposts ARN
108
- * @internal
109
- *
110
- * @param resource - The resource section of an ARN
111
- * @returns Access Point Name and optional Outpost ID.
112
- */
70
+
113
71
  export declare const getArnResources: (resource: string) => {
114
72
  accesspointName: string;
115
73
  outpostId?: string;
116
74
  };
117
- /**
118
- * Throw if dual stack configuration is set to true.
119
- * @internal
120
- */
75
+
121
76
  export declare const validateNoDualstack: (dualstackEndpoint?: boolean | undefined) => void;
122
- /**
123
- * Validate region is not appended or prepended with a `fips-`
124
- * @internal
125
- */
126
- export declare const validateNoFIPS: (region?: string | undefined) => void;
127
- /**
128
- * Validate the multi-region access point alias.
129
- * @private
130
- */
77
+
78
+ export declare const validateNoFIPS: (useFipsEndpoint?: boolean | undefined) => void;
79
+
131
80
  export declare const validateMrapAlias: (name: string) => void;
@@ -1,87 +1,43 @@
1
- import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
2
1
  import { Provider, RegionInfoProvider } from "@aws-sdk/types";
3
2
  export interface BucketEndpointInputConfig {
4
- /**
5
- * Whether the provided endpoint addresses an individual bucket.
6
- */
3
+
7
4
  bucketEndpoint?: boolean;
8
- /**
9
- * Whether to force path style URLs for S3 objects (e.g., https://s3.amazonaws.com/<bucketName>/<key> instead of https://<bucketName>.s3.amazonaws.com/<key>
10
- */
5
+
11
6
  forcePathStyle?: boolean;
12
- /**
13
- * Whether to use the S3 Transfer Acceleration endpoint by default
14
- */
7
+
15
8
  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
- /**
24
- * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
25
- */
9
+
26
10
  useArnRegion?: boolean | Provider<boolean>;
27
- /**
28
- * Whether to prevent SDK from making cross-region request when supplied bucket is a multi-region access point ARN.
29
- * Defaults to false
30
- */
11
+
31
12
  disableMultiregionAccessPoints?: boolean | Provider<boolean>;
32
13
  }
33
14
  interface PreviouslyResolved {
34
15
  isCustomEndpoint: boolean;
35
16
  region: Provider<string>;
36
17
  regionInfoProvider: RegionInfoProvider;
18
+ useFipsEndpoint: Provider<boolean>;
19
+ useDualstackEndpoint: Provider<boolean>;
37
20
  }
38
21
  export interface BucketEndpointResolvedConfig {
39
- /**
40
- * Whether the endpoint is specified by caller.
41
- * @internal
42
- */
22
+
43
23
  isCustomEndpoint: boolean;
44
- /**
45
- * Resolved value for input config {@link BucketEndpointInputConfig.bucketEndpoint}
46
- */
24
+
47
25
  bucketEndpoint: boolean;
48
- /**
49
- * Resolved value for input config {@link BucketEndpointInputConfig.forcePathStyle}
50
- */
26
+
51
27
  forcePathStyle: boolean;
52
- /**
53
- * Resolved value for input config {@link BucketEndpointInputConfig.useAccelerateEndpoint}
54
- */
28
+
55
29
  useAccelerateEndpoint: boolean;
56
- /**
57
- * Resolved value for input config {@link BucketEndpointInputConfig.useDualstackEndpoint}
58
- */
59
- useDualstackEndpoint: boolean;
60
- /**
61
- * Resolved value for input config {@link BucketEndpointInputConfig.useArnRegion}
62
- */
30
+
31
+ useFipsEndpoint: Provider<boolean>;
32
+
33
+ useDualstackEndpoint: Provider<boolean>;
34
+
63
35
  useArnRegion: Provider<boolean>;
64
- /**
65
- * Resolved value for input config {@link RegionInputConfig.region}
66
- */
36
+
67
37
  region: Provider<string>;
68
- /**
69
- * Fetch related hostname, signing name or signing region with given region.
70
- * @internal
71
- */
38
+
72
39
  regionInfoProvider: RegionInfoProvider;
73
40
  disableMultiregionAccessPoints: Provider<boolean>;
74
41
  }
75
42
  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
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.36.0",
3
+ "version": "3.40.0",
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.36.0",
22
- "@aws-sdk/types": "3.36.0",
23
- "@aws-sdk/util-arn-parser": "3.36.0",
21
+ "@aws-sdk/protocol-http": "3.40.0",
22
+ "@aws-sdk/types": "3.40.0",
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.36.0",
28
- "@aws-sdk/node-config-provider": "3.36.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"