@aws-sdk/middleware-bucket-endpoint 3.53.0 → 3.55.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 +24 -0
- package/dist-cjs/NodeDisableMultiregionAccessPointConfigOptions.js +2 -2
- package/dist-cjs/NodeUseArnRegionConfigOptions.js +2 -2
- package/dist-cjs/bucketEndpointMiddleware.js +5 -5
- package/dist-cjs/bucketHostname.js +27 -27
- package/dist-cjs/bucketHostnameUtils.js +1 -1
- package/dist-es/bucketHostname.js +13 -13
- package/dist-es/bucketHostnameUtils.js +11 -11
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.55.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.54.1...v3.55.0) (2022-03-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.54.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.54.0...v3.54.1) (2022-03-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.54.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.53.1...v3.54.0) (2022-03-11)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [3.53.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.52.0...v3.53.0) (2022-02-24)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @aws-sdk/middleware-bucket-endpoint
|
|
@@ -5,7 +5,7 @@ const util_config_provider_1 = require("@aws-sdk/util-config-provider");
|
|
|
5
5
|
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
|
|
6
6
|
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
|
|
7
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),
|
|
8
|
+
environmentVariableSelector: (env) => (0, util_config_provider_1.booleanSelector)(env, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, util_config_provider_1.SelectorType.ENV),
|
|
9
|
+
configFileSelector: (profile) => (0, util_config_provider_1.booleanSelector)(profile, exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, util_config_provider_1.SelectorType.CONFIG),
|
|
10
10
|
default: false,
|
|
11
11
|
};
|
|
@@ -5,7 +5,7 @@ const util_config_provider_1 = require("@aws-sdk/util-config-provider");
|
|
|
5
5
|
exports.NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
|
|
6
6
|
exports.NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
|
|
7
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),
|
|
8
|
+
environmentVariableSelector: (env) => (0, util_config_provider_1.booleanSelector)(env, exports.NODE_USE_ARN_REGION_ENV_NAME, util_config_provider_1.SelectorType.ENV),
|
|
9
|
+
configFileSelector: (profile) => (0, util_config_provider_1.booleanSelector)(profile, exports.NODE_USE_ARN_REGION_INI_NAME, util_config_provider_1.SelectorType.CONFIG),
|
|
10
10
|
default: false,
|
|
11
11
|
};
|
|
@@ -12,14 +12,14 @@ const bucketEndpointMiddleware = (options) => (next, context) => async (args) =>
|
|
|
12
12
|
if (options.bucketEndpoint) {
|
|
13
13
|
request.hostname = bucketName;
|
|
14
14
|
}
|
|
15
|
-
else if (util_arn_parser_1.validate(bucketName)) {
|
|
16
|
-
const bucketArn = util_arn_parser_1.parse(bucketName);
|
|
15
|
+
else if ((0, util_arn_parser_1.validate)(bucketName)) {
|
|
16
|
+
const bucketArn = (0, util_arn_parser_1.parse)(bucketName);
|
|
17
17
|
const clientRegion = await options.region();
|
|
18
18
|
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
19
19
|
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
20
20
|
const { partition, signingRegion = clientRegion } = (await options.regionInfoProvider(clientRegion, { useDualstackEndpoint, useFipsEndpoint })) || {};
|
|
21
21
|
const useArnRegion = await options.useArnRegion();
|
|
22
|
-
const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService, } = bucketHostname_1.bucketHostname({
|
|
22
|
+
const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService, } = (0, bucketHostname_1.bucketHostname)({
|
|
23
23
|
bucketName: bucketArn,
|
|
24
24
|
baseHostname: request.hostname,
|
|
25
25
|
accelerateEndpoint: options.useAccelerateEndpoint,
|
|
@@ -47,7 +47,7 @@ const bucketEndpointMiddleware = (options) => (next, context) => async (args) =>
|
|
|
47
47
|
const clientRegion = await options.region();
|
|
48
48
|
const dualstackEndpoint = await options.useDualstackEndpoint();
|
|
49
49
|
const fipsEndpoint = await options.useFipsEndpoint();
|
|
50
|
-
const { hostname, bucketEndpoint } = bucketHostname_1.bucketHostname({
|
|
50
|
+
const { hostname, bucketEndpoint } = (0, bucketHostname_1.bucketHostname)({
|
|
51
51
|
bucketName,
|
|
52
52
|
clientRegion,
|
|
53
53
|
baseHostname: request.hostname,
|
|
@@ -80,7 +80,7 @@ exports.bucketEndpointMiddlewareOptions = {
|
|
|
80
80
|
};
|
|
81
81
|
const getBucketEndpointPlugin = (options) => ({
|
|
82
82
|
applyToStack: (clientStack) => {
|
|
83
|
-
clientStack.addRelativeTo(exports.bucketEndpointMiddleware(options), exports.bucketEndpointMiddlewareOptions);
|
|
83
|
+
clientStack.addRelativeTo((0, exports.bucketEndpointMiddleware)(options), exports.bucketEndpointMiddlewareOptions);
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
86
|
exports.getBucketEndpointPlugin = getBucketEndpointPlugin;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.bucketHostname = void 0;
|
|
4
4
|
const bucketHostnameUtils_1 = require("./bucketHostnameUtils");
|
|
5
5
|
const bucketHostname = (options) => {
|
|
6
|
-
bucketHostnameUtils_1.validateCustomEndpoint(options);
|
|
7
|
-
return bucketHostnameUtils_1.isBucketNameOptions(options)
|
|
6
|
+
(0, bucketHostnameUtils_1.validateCustomEndpoint)(options);
|
|
7
|
+
return (0, bucketHostnameUtils_1.isBucketNameOptions)(options)
|
|
8
8
|
?
|
|
9
9
|
getEndpointFromBucketName(options)
|
|
10
10
|
:
|
|
@@ -12,8 +12,8 @@ const bucketHostname = (options) => {
|
|
|
12
12
|
};
|
|
13
13
|
exports.bucketHostname = bucketHostname;
|
|
14
14
|
const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, fipsEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
|
|
15
|
-
const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : bucketHostnameUtils_1.getSuffix(baseHostname);
|
|
16
|
-
if (pathStyleEndpoint || !bucketHostnameUtils_1.isDnsCompatibleBucketName(bucketName) || (tlsCompatible && bucketHostnameUtils_1.DOT_PATTERN.test(bucketName))) {
|
|
15
|
+
const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : (0, bucketHostnameUtils_1.getSuffix)(baseHostname);
|
|
16
|
+
if (pathStyleEndpoint || !(0, bucketHostnameUtils_1.isDnsCompatibleBucketName)(bucketName) || (tlsCompatible && bucketHostnameUtils_1.DOT_PATTERN.test(bucketName))) {
|
|
17
17
|
return {
|
|
18
18
|
bucketEndpoint: false,
|
|
19
19
|
hostname: dualstackEndpoint ? `s3.dualstack.${clientRegion}.${hostnameSuffix}` : baseHostname,
|
|
@@ -32,14 +32,14 @@ const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: r
|
|
|
32
32
|
};
|
|
33
33
|
const getEndpointFromArn = (options) => {
|
|
34
34
|
const { isCustomEndpoint, baseHostname, clientRegion } = options;
|
|
35
|
-
const hostnameSuffix = isCustomEndpoint ? baseHostname : bucketHostnameUtils_1.getSuffixForArnEndpoint(baseHostname)[1];
|
|
35
|
+
const hostnameSuffix = isCustomEndpoint ? baseHostname : (0, bucketHostnameUtils_1.getSuffixForArnEndpoint)(baseHostname)[1];
|
|
36
36
|
const { pathStyleEndpoint, accelerateEndpoint = false, fipsEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
|
|
37
|
-
bucketHostnameUtils_1.validateArnEndpointOptions({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
|
|
37
|
+
(0, bucketHostnameUtils_1.validateArnEndpointOptions)({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
|
|
38
38
|
const { service, partition, accountId, region, resource } = bucketName;
|
|
39
|
-
bucketHostnameUtils_1.validateService(service);
|
|
40
|
-
bucketHostnameUtils_1.validatePartition(partition, { clientPartition });
|
|
41
|
-
bucketHostnameUtils_1.validateAccountId(accountId);
|
|
42
|
-
const { accesspointName, outpostId } = bucketHostnameUtils_1.getArnResources(resource);
|
|
39
|
+
(0, bucketHostnameUtils_1.validateService)(service);
|
|
40
|
+
(0, bucketHostnameUtils_1.validatePartition)(partition, { clientPartition });
|
|
41
|
+
(0, bucketHostnameUtils_1.validateAccountId)(accountId);
|
|
42
|
+
const { accesspointName, outpostId } = (0, bucketHostnameUtils_1.getArnResources)(resource);
|
|
43
43
|
if (service === "s3-object-lambda") {
|
|
44
44
|
return getEndpointFromObjectLambdaArn({ ...options, tlsCompatible, bucketName, accesspointName, hostnameSuffix });
|
|
45
45
|
}
|
|
@@ -53,17 +53,17 @@ const getEndpointFromArn = (options) => {
|
|
|
53
53
|
};
|
|
54
54
|
const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
|
|
55
55
|
const { accountId, region, service } = bucketName;
|
|
56
|
-
bucketHostnameUtils_1.validateRegionalClient(clientRegion);
|
|
57
|
-
bucketHostnameUtils_1.validateRegion(region, {
|
|
56
|
+
(0, bucketHostnameUtils_1.validateRegionalClient)(clientRegion);
|
|
57
|
+
(0, bucketHostnameUtils_1.validateRegion)(region, {
|
|
58
58
|
useArnRegion,
|
|
59
59
|
clientRegion,
|
|
60
60
|
clientSigningRegion,
|
|
61
61
|
allowFipsRegion: true,
|
|
62
62
|
useFipsEndpoint: fipsEndpoint,
|
|
63
63
|
});
|
|
64
|
-
bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
|
|
64
|
+
(0, bucketHostnameUtils_1.validateNoDualstack)(dualstackEndpoint);
|
|
65
65
|
const DNSHostLabel = `${accesspointName}-${accountId}`;
|
|
66
|
-
bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
66
|
+
(0, bucketHostnameUtils_1.validateDNSHostLabel)(DNSHostLabel, { tlsCompatible });
|
|
67
67
|
const endpointRegion = useArnRegion ? region : clientRegion;
|
|
68
68
|
const signingRegion = useArnRegion ? region : clientSigningRegion;
|
|
69
69
|
return {
|
|
@@ -77,8 +77,8 @@ const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpo
|
|
|
77
77
|
if (disableMultiregionAccessPoints === true) {
|
|
78
78
|
throw new Error("SDK is attempting to use a MRAP ARN. Please enable to feature.");
|
|
79
79
|
}
|
|
80
|
-
bucketHostnameUtils_1.validateMrapAlias(mrapAlias);
|
|
81
|
-
bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
|
|
80
|
+
(0, bucketHostnameUtils_1.validateMrapAlias)(mrapAlias);
|
|
81
|
+
(0, bucketHostnameUtils_1.validateNoDualstack)(dualstackEndpoint);
|
|
82
82
|
return {
|
|
83
83
|
bucketEndpoint: true,
|
|
84
84
|
hostname: `${mrapAlias}${isCustomEndpoint ? "" : `.accesspoint.s3-global`}.${hostnameSuffix}`,
|
|
@@ -86,16 +86,16 @@ const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpo
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
89
|
-
bucketHostnameUtils_1.validateRegionalClient(clientRegion);
|
|
90
|
-
bucketHostnameUtils_1.validateRegion(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, useFipsEndpoint: fipsEndpoint });
|
|
89
|
+
(0, bucketHostnameUtils_1.validateRegionalClient)(clientRegion);
|
|
90
|
+
(0, bucketHostnameUtils_1.validateRegion)(bucketName.region, { useArnRegion, clientRegion, clientSigningRegion, useFipsEndpoint: fipsEndpoint });
|
|
91
91
|
const DNSHostLabel = `${accesspointName}-${bucketName.accountId}`;
|
|
92
|
-
bucketHostnameUtils_1.validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
92
|
+
(0, bucketHostnameUtils_1.validateDNSHostLabel)(DNSHostLabel, { tlsCompatible });
|
|
93
93
|
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
94
94
|
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
95
|
-
bucketHostnameUtils_1.validateOutpostService(bucketName.service);
|
|
96
|
-
bucketHostnameUtils_1.validateDNSHostLabel(outpostId, { tlsCompatible });
|
|
97
|
-
bucketHostnameUtils_1.validateNoDualstack(dualstackEndpoint);
|
|
98
|
-
bucketHostnameUtils_1.validateNoFIPS(fipsEndpoint);
|
|
95
|
+
(0, bucketHostnameUtils_1.validateOutpostService)(bucketName.service);
|
|
96
|
+
(0, bucketHostnameUtils_1.validateDNSHostLabel)(outpostId, { tlsCompatible });
|
|
97
|
+
(0, bucketHostnameUtils_1.validateNoDualstack)(dualstackEndpoint);
|
|
98
|
+
(0, bucketHostnameUtils_1.validateNoFIPS)(fipsEndpoint);
|
|
99
99
|
const hostnamePrefix = `${DNSHostLabel}.${outpostId}`;
|
|
100
100
|
return {
|
|
101
101
|
bucketEndpoint: true,
|
|
@@ -105,8 +105,8 @@ const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRe
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
108
|
-
bucketHostnameUtils_1.validateRegionalClient(clientRegion);
|
|
109
|
-
bucketHostnameUtils_1.validateRegion(bucketName.region, {
|
|
108
|
+
(0, bucketHostnameUtils_1.validateRegionalClient)(clientRegion);
|
|
109
|
+
(0, bucketHostnameUtils_1.validateRegion)(bucketName.region, {
|
|
110
110
|
useArnRegion,
|
|
111
111
|
clientRegion,
|
|
112
112
|
clientSigningRegion,
|
|
@@ -114,10 +114,10 @@ const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigni
|
|
|
114
114
|
useFipsEndpoint: fipsEndpoint,
|
|
115
115
|
});
|
|
116
116
|
const hostnamePrefix = `${accesspointName}-${bucketName.accountId}`;
|
|
117
|
-
bucketHostnameUtils_1.validateDNSHostLabel(hostnamePrefix, { tlsCompatible });
|
|
117
|
+
(0, bucketHostnameUtils_1.validateDNSHostLabel)(hostnamePrefix, { tlsCompatible });
|
|
118
118
|
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
119
119
|
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
120
|
-
bucketHostnameUtils_1.validateS3Service(bucketName.service);
|
|
120
|
+
(0, bucketHostnameUtils_1.validateS3Service)(bucketName.service);
|
|
121
121
|
return {
|
|
122
122
|
bucketEndpoint: true,
|
|
123
123
|
hostname: `${hostnamePrefix}${isCustomEndpoint
|
|
@@ -14,18 +14,18 @@ var getEndpointFromBucketName = function (_a) {
|
|
|
14
14
|
if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) {
|
|
15
15
|
return {
|
|
16
16
|
bucketEndpoint: false,
|
|
17
|
-
hostname: dualstackEndpoint ? "s3.dualstack."
|
|
17
|
+
hostname: dualstackEndpoint ? "s3.dualstack.".concat(clientRegion, ".").concat(hostnameSuffix) : baseHostname,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
if (accelerateEndpoint) {
|
|
21
|
-
baseHostname = "s3-accelerate"
|
|
21
|
+
baseHostname = "s3-accelerate".concat(dualstackEndpoint ? ".dualstack" : "", ".").concat(hostnameSuffix);
|
|
22
22
|
}
|
|
23
23
|
else if (dualstackEndpoint) {
|
|
24
|
-
baseHostname = "s3.dualstack."
|
|
24
|
+
baseHostname = "s3.dualstack.".concat(clientRegion, ".").concat(hostnameSuffix);
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
27
|
bucketEndpoint: true,
|
|
28
|
-
hostname: bucketName
|
|
28
|
+
hostname: "".concat(bucketName, ".").concat(baseHostname),
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
var getEndpointFromArn = function (options) {
|
|
@@ -61,13 +61,13 @@ var getEndpointFromObjectLambdaArn = function (_a) {
|
|
|
61
61
|
useFipsEndpoint: fipsEndpoint,
|
|
62
62
|
});
|
|
63
63
|
validateNoDualstack(dualstackEndpoint);
|
|
64
|
-
var DNSHostLabel = accesspointName
|
|
64
|
+
var DNSHostLabel = "".concat(accesspointName, "-").concat(accountId);
|
|
65
65
|
validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
|
|
66
66
|
var endpointRegion = useArnRegion ? region : clientRegion;
|
|
67
67
|
var signingRegion = useArnRegion ? region : clientSigningRegion;
|
|
68
68
|
return {
|
|
69
69
|
bucketEndpoint: true,
|
|
70
|
-
hostname: DNSHostLabel
|
|
70
|
+
hostname: "".concat(DNSHostLabel, ".").concat(service).concat(fipsEndpoint ? "-fips" : "", ".").concat(endpointRegion, ".").concat(hostnameSuffix),
|
|
71
71
|
signingRegion: signingRegion,
|
|
72
72
|
signingService: service,
|
|
73
73
|
};
|
|
@@ -81,7 +81,7 @@ var getEndpointFromMRAPArn = function (_a) {
|
|
|
81
81
|
validateNoDualstack(dualstackEndpoint);
|
|
82
82
|
return {
|
|
83
83
|
bucketEndpoint: true,
|
|
84
|
-
hostname: ""
|
|
84
|
+
hostname: "".concat(mrapAlias).concat(isCustomEndpoint ? "" : ".accesspoint.s3-global", ".").concat(hostnameSuffix),
|
|
85
85
|
signingRegion: "*",
|
|
86
86
|
};
|
|
87
87
|
};
|
|
@@ -89,7 +89,7 @@ var getEndpointFromOutpostArn = function (_a) {
|
|
|
89
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;
|
|
90
90
|
validateRegionalClient(clientRegion);
|
|
91
91
|
validateRegion(bucketName.region, { useArnRegion: useArnRegion, clientRegion: clientRegion, clientSigningRegion: clientSigningRegion, useFipsEndpoint: fipsEndpoint });
|
|
92
|
-
var DNSHostLabel = accesspointName
|
|
92
|
+
var DNSHostLabel = "".concat(accesspointName, "-").concat(bucketName.accountId);
|
|
93
93
|
validateDNSHostLabel(DNSHostLabel, { tlsCompatible: tlsCompatible });
|
|
94
94
|
var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
95
95
|
var signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
@@ -97,10 +97,10 @@ var getEndpointFromOutpostArn = function (_a) {
|
|
|
97
97
|
validateDNSHostLabel(outpostId, { tlsCompatible: tlsCompatible });
|
|
98
98
|
validateNoDualstack(dualstackEndpoint);
|
|
99
99
|
validateNoFIPS(fipsEndpoint);
|
|
100
|
-
var hostnamePrefix = DNSHostLabel
|
|
100
|
+
var hostnamePrefix = "".concat(DNSHostLabel, ".").concat(outpostId);
|
|
101
101
|
return {
|
|
102
102
|
bucketEndpoint: true,
|
|
103
|
-
hostname: ""
|
|
103
|
+
hostname: "".concat(hostnamePrefix).concat(isCustomEndpoint ? "" : ".s3-outposts.".concat(endpointRegion), ".").concat(hostnameSuffix),
|
|
104
104
|
signingRegion: signingRegion,
|
|
105
105
|
signingService: "s3-outposts",
|
|
106
106
|
};
|
|
@@ -115,16 +115,16 @@ var getEndpointFromAccessPointArn = function (_a) {
|
|
|
115
115
|
allowFipsRegion: true,
|
|
116
116
|
useFipsEndpoint: fipsEndpoint,
|
|
117
117
|
});
|
|
118
|
-
var hostnamePrefix = accesspointName
|
|
118
|
+
var hostnamePrefix = "".concat(accesspointName, "-").concat(bucketName.accountId);
|
|
119
119
|
validateDNSHostLabel(hostnamePrefix, { tlsCompatible: tlsCompatible });
|
|
120
120
|
var endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
121
121
|
var signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
122
122
|
validateS3Service(bucketName.service);
|
|
123
123
|
return {
|
|
124
124
|
bucketEndpoint: true,
|
|
125
|
-
hostname: ""
|
|
125
|
+
hostname: "".concat(hostnamePrefix).concat(isCustomEndpoint
|
|
126
126
|
? ""
|
|
127
|
-
: ".s3-accesspoint"
|
|
127
|
+
: ".s3-accesspoint".concat(fipsEndpoint ? "-fips" : "").concat(dualstackEndpoint ? ".dualstack" : "", ".").concat(endpointRegion), ".").concat(hostnameSuffix),
|
|
128
128
|
signingRegion: signingRegion,
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -12,14 +12,14 @@ export var isDnsCompatibleBucketName = function (bucketName) {
|
|
|
12
12
|
};
|
|
13
13
|
var getRegionalSuffix = function (hostname) {
|
|
14
14
|
var parts = hostname.match(S3_HOSTNAME_PATTERN);
|
|
15
|
-
return [parts[4], hostname.replace(new RegExp("^"
|
|
15
|
+
return [parts[4], hostname.replace(new RegExp("^".concat(parts[0])), "")];
|
|
16
16
|
};
|
|
17
17
|
export var getSuffix = function (hostname) {
|
|
18
18
|
return S3_US_EAST_1_ALTNAME_PATTERN.test(hostname) ? ["us-east-1", AWS_PARTITION_SUFFIX] : getRegionalSuffix(hostname);
|
|
19
19
|
};
|
|
20
20
|
export var getSuffixForArnEndpoint = function (hostname) {
|
|
21
21
|
return S3_US_EAST_1_ALTNAME_PATTERN.test(hostname)
|
|
22
|
-
? [hostname.replace("."
|
|
22
|
+
? [hostname.replace(".".concat(AWS_PARTITION_SUFFIX), ""), AWS_PARTITION_SUFFIX]
|
|
23
23
|
: getRegionalSuffix(hostname);
|
|
24
24
|
};
|
|
25
25
|
export var validateArnEndpointOptions = function (options) {
|
|
@@ -50,7 +50,7 @@ export var validateOutpostService = function (service) {
|
|
|
50
50
|
};
|
|
51
51
|
export var validatePartition = function (partition, options) {
|
|
52
52
|
if (partition !== options.clientPartition) {
|
|
53
|
-
throw new Error("Partition in ARN is incompatible, got \""
|
|
53
|
+
throw new Error("Partition in ARN is incompatible, got \"".concat(partition, "\" but expected \"").concat(options.clientPartition, "\""));
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
export var validateRegion = function (region, options) {
|
|
@@ -62,18 +62,18 @@ export var validateRegion = function (region, options) {
|
|
|
62
62
|
throw new Error("FIPS region is not supported");
|
|
63
63
|
}
|
|
64
64
|
else if (!isEqualRegions(region, options.clientRegion)) {
|
|
65
|
-
throw new Error("Client FIPS region "
|
|
65
|
+
throw new Error("Client FIPS region ".concat(options.clientRegion, " doesn't match region ").concat(region, " in ARN"));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
if (!options.useArnRegion &&
|
|
69
69
|
!isEqualRegions(region, options.clientRegion || "") &&
|
|
70
70
|
!isEqualRegions(region, options.clientSigningRegion || "")) {
|
|
71
|
-
throw new Error("Region in ARN is incompatible, got "
|
|
71
|
+
throw new Error("Region in ARN is incompatible, got ".concat(region, " but expected ").concat(options.clientRegion));
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
export var validateRegionalClient = function (region) {
|
|
75
75
|
if (["s3-external-1", "aws-global"].includes(region)) {
|
|
76
|
-
throw new Error("Client region "
|
|
76
|
+
throw new Error("Client region ".concat(region, " is not regional"));
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
var isEqualRegions = function (regionA, regionB) { return regionA === regionB; };
|
|
@@ -89,7 +89,7 @@ export var validateDNSHostLabel = function (label, options) {
|
|
|
89
89
|
/(\d+\.){3}\d+/.test(label) ||
|
|
90
90
|
/[.-]{2}/.test(label) ||
|
|
91
91
|
((options === null || options === void 0 ? void 0 : options.tlsCompatible) && DOT_PATTERN.test(label))) {
|
|
92
|
-
throw new Error("Invalid DNS label "
|
|
92
|
+
throw new Error("Invalid DNS label ".concat(label));
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
export var validateCustomEndpoint = function (options) {
|
|
@@ -105,19 +105,19 @@ export var getArnResources = function (resource) {
|
|
|
105
105
|
var _a = __read(resource.split(delimiter)), resourceType = _a[0], rest = _a.slice(1);
|
|
106
106
|
if (resourceType === "accesspoint") {
|
|
107
107
|
if (rest.length !== 1 || rest[0] === "") {
|
|
108
|
-
throw new Error("Access Point ARN should have one resource accesspoint"
|
|
108
|
+
throw new Error("Access Point ARN should have one resource accesspoint".concat(delimiter, "{accesspointname}"));
|
|
109
109
|
}
|
|
110
110
|
return { accesspointName: rest[0] };
|
|
111
111
|
}
|
|
112
112
|
else if (resourceType === "outpost") {
|
|
113
113
|
if (!rest[0] || rest[1] !== "accesspoint" || !rest[2] || rest.length !== 3) {
|
|
114
|
-
throw new Error("Outpost ARN should have resource outpost"
|
|
114
|
+
throw new Error("Outpost ARN should have resource outpost".concat(delimiter, "{outpostId}").concat(delimiter, "accesspoint").concat(delimiter, "{accesspointName}"));
|
|
115
115
|
}
|
|
116
116
|
var _b = __read(rest, 3), outpostId = _b[0], _1 = _b[1], accesspointName = _b[2];
|
|
117
117
|
return { outpostId: outpostId, accesspointName: accesspointName };
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
throw new Error("ARN resource should begin with 'accesspoint"
|
|
120
|
+
throw new Error("ARN resource should begin with 'accesspoint".concat(delimiter, "' or 'outpost").concat(delimiter, "'"));
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
export var validateNoDualstack = function (dualstackEndpoint) {
|
|
@@ -135,6 +135,6 @@ export var validateMrapAlias = function (name) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
catch (e) {
|
|
138
|
-
throw new Error("\""
|
|
138
|
+
throw new Error("\"".concat(name, "\" is not a DNS compatible name."));
|
|
139
139
|
}
|
|
140
140
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-bucket-endpoint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.55.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/protocol-http": "3.
|
|
23
|
-
"@aws-sdk/types": "3.
|
|
24
|
-
"@aws-sdk/util-arn-parser": "3.
|
|
25
|
-
"@aws-sdk/util-config-provider": "3.
|
|
26
|
-
"tslib": "^2.3.
|
|
22
|
+
"@aws-sdk/protocol-http": "3.55.0",
|
|
23
|
+
"@aws-sdk/types": "3.55.0",
|
|
24
|
+
"@aws-sdk/util-arn-parser": "3.55.0",
|
|
25
|
+
"@aws-sdk/util-config-provider": "3.55.0",
|
|
26
|
+
"tslib": "^2.3.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@aws-sdk/middleware-stack": "3.
|
|
30
|
-
"@aws-sdk/node-config-provider": "3.
|
|
29
|
+
"@aws-sdk/middleware-stack": "3.55.0",
|
|
30
|
+
"@aws-sdk/node-config-provider": "3.55.0",
|
|
31
31
|
"@tsconfig/recommended": "1.0.1",
|
|
32
32
|
"concurrently": "7.0.0",
|
|
33
33
|
"downlevel-dts": "0.7.0",
|
|
34
34
|
"rimraf": "3.0.2",
|
|
35
35
|
"typedoc": "0.19.2",
|
|
36
|
-
"typescript": "~4.
|
|
36
|
+
"typescript": "~4.6.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">= 12.0.0"
|