@aws-sdk/middleware-bucket-endpoint 3.972.19 → 3.972.21
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/dist-cjs/index.js +24 -350
- package/dist-es/index.js +1 -6
- package/dist-types/index.d.ts +2 -6
- package/package.json +4 -20
- package/dist-es/NodeDisableMultiregionAccessPointConfigOptions.js +0 -8
- package/dist-es/NodeUseArnRegionConfigOptions.js +0 -8
- package/dist-es/bucketEndpointMiddleware.js +0 -81
- package/dist-es/bucketHostname.js +0 -106
- package/dist-es/bucketHostnameUtils.js +0 -111
- package/dist-es/configurations.js +0 -12
- package/dist-types/NodeDisableMultiregionAccessPointConfigOptions.d.ts +0 -4
- package/dist-types/NodeUseArnRegionConfigOptions.d.ts +0 -9
- package/dist-types/bucketEndpointMiddleware.d.ts +0 -17
- package/dist-types/bucketHostname.d.ts +0 -16
- package/dist-types/bucketHostnameUtils.d.ts +0 -174
- package/dist-types/configurations.d.ts +0 -95
- package/dist-types/ts3.4/NodeDisableMultiregionAccessPointConfigOptions.d.ts +0 -6
- package/dist-types/ts3.4/NodeUseArnRegionConfigOptions.d.ts +0 -6
- package/dist-types/ts3.4/bucketEndpointMiddleware.d.ts +0 -13
- package/dist-types/ts3.4/bucketHostname.d.ts +0 -10
- package/dist-types/ts3.4/bucketHostnameUtils.d.ts +0 -80
- package/dist-types/ts3.4/configurations.d.ts +0 -31
- package/dist-types/ts3.4/index.d.ts +0 -16
package/dist-cjs/index.js
CHANGED
|
@@ -1,352 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const S3_HOSTNAME_PATTERN = /^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./;
|
|
28
|
-
const S3_US_EAST_1_ALTNAME_PATTERN = /^s3(-external-1)?\.amazonaws\.com$/;
|
|
29
|
-
const AWS_PARTITION_SUFFIX = "amazonaws.com";
|
|
30
|
-
const isBucketNameOptions = (options) => typeof options.bucketName === "string";
|
|
31
|
-
const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
|
|
32
|
-
const getRegionalSuffix = (hostname) => {
|
|
33
|
-
const parts = hostname.match(S3_HOSTNAME_PATTERN);
|
|
34
|
-
return [parts[4], hostname.replace(new RegExp(`^${parts[0]}`), "")];
|
|
35
|
-
};
|
|
36
|
-
const getSuffix = (hostname) => S3_US_EAST_1_ALTNAME_PATTERN.test(hostname) ? ["us-east-1", AWS_PARTITION_SUFFIX] : getRegionalSuffix(hostname);
|
|
37
|
-
const getSuffixForArnEndpoint = (hostname) => S3_US_EAST_1_ALTNAME_PATTERN.test(hostname)
|
|
38
|
-
? [hostname.replace(`.${AWS_PARTITION_SUFFIX}`, ""), AWS_PARTITION_SUFFIX]
|
|
39
|
-
: getRegionalSuffix(hostname);
|
|
40
|
-
const validateArnEndpointOptions = (options) => {
|
|
41
|
-
if (options.pathStyleEndpoint) {
|
|
42
|
-
throw new Error("Path-style S3 endpoint is not supported when bucket is an ARN");
|
|
43
|
-
}
|
|
44
|
-
if (options.accelerateEndpoint) {
|
|
45
|
-
throw new Error("Accelerate endpoint is not supported when bucket is an ARN");
|
|
46
|
-
}
|
|
47
|
-
if (!options.tlsCompatible) {
|
|
48
|
-
throw new Error("HTTPS is required when bucket is an ARN");
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const validateService = (service) => {
|
|
52
|
-
if (service !== "s3" && service !== "s3-outposts" && service !== "s3-object-lambda") {
|
|
53
|
-
throw new Error("Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component");
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const validateS3Service = (service) => {
|
|
57
|
-
if (service !== "s3") {
|
|
58
|
-
throw new Error("Expect 's3' in Accesspoint ARN service component");
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const validateOutpostService = (service) => {
|
|
62
|
-
if (service !== "s3-outposts") {
|
|
63
|
-
throw new Error("Expect 's3-posts' in Outpost ARN service component");
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const validatePartition = (partition, options) => {
|
|
67
|
-
if (partition !== options.clientPartition) {
|
|
68
|
-
throw new Error(`Partition in ARN is incompatible, got "${partition}" but expected "${options.clientPartition}"`);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const validateRegion = (region, options) => { };
|
|
72
|
-
const validateRegionalClient = (region) => {
|
|
73
|
-
if (["s3-external-1", "aws-global"].includes(region)) {
|
|
74
|
-
throw new Error(`Client region ${region} is not regional`);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const validateAccountId = (accountId) => {
|
|
78
|
-
if (!/[0-9]{12}/.exec(accountId)) {
|
|
79
|
-
throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const validateDNSHostLabel = (label, options = { tlsCompatible: true }) => {
|
|
83
|
-
if (label.length >= 64 ||
|
|
84
|
-
!/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(label) ||
|
|
85
|
-
/(\d+\.){3}\d+/.test(label) ||
|
|
86
|
-
/[.-]{2}/.test(label) ||
|
|
87
|
-
(options?.tlsCompatible && DOT_PATTERN.test(label))) {
|
|
88
|
-
throw new Error(`Invalid DNS label ${label}`);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const validateCustomEndpoint = (options) => {
|
|
92
|
-
if (options.isCustomEndpoint) {
|
|
93
|
-
if (options.dualstackEndpoint)
|
|
94
|
-
throw new Error("Dualstack endpoint is not supported with custom endpoint");
|
|
95
|
-
if (options.accelerateEndpoint)
|
|
96
|
-
throw new Error("Accelerate endpoint is not supported with custom endpoint");
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const getArnResources = (resource) => {
|
|
100
|
-
const delimiter = resource.includes(":") ? ":" : "/";
|
|
101
|
-
const [resourceType, ...rest] = resource.split(delimiter);
|
|
102
|
-
if (resourceType === "accesspoint") {
|
|
103
|
-
if (rest.length !== 1 || rest[0] === "") {
|
|
104
|
-
throw new Error(`Access Point ARN should have one resource accesspoint${delimiter}{accesspointname}`);
|
|
105
|
-
}
|
|
106
|
-
return { accesspointName: rest[0] };
|
|
107
|
-
}
|
|
108
|
-
else if (resourceType === "outpost") {
|
|
109
|
-
if (!rest[0] || rest[1] !== "accesspoint" || !rest[2] || rest.length !== 3) {
|
|
110
|
-
throw new Error(`Outpost ARN should have resource outpost${delimiter}{outpostId}${delimiter}accesspoint${delimiter}{accesspointName}`);
|
|
111
|
-
}
|
|
112
|
-
const [outpostId, _, accesspointName] = rest;
|
|
113
|
-
return { outpostId, accesspointName };
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
throw new Error(`ARN resource should begin with 'accesspoint${delimiter}' or 'outpost${delimiter}'`);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const validateNoDualstack = (dualstackEndpoint) => { };
|
|
120
|
-
const validateNoFIPS = (useFipsEndpoint) => {
|
|
121
|
-
if (useFipsEndpoint)
|
|
122
|
-
throw new Error(`FIPS region is not supported with Outpost.`);
|
|
123
|
-
};
|
|
124
|
-
const validateMrapAlias = (name) => {
|
|
125
|
-
try {
|
|
126
|
-
name.split(".").forEach((label) => {
|
|
127
|
-
validateDNSHostLabel(label);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
throw new Error(`"${name}" is not a DNS compatible name.`);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const bucketHostname = (options) => {
|
|
136
|
-
validateCustomEndpoint(options);
|
|
137
|
-
return isBucketNameOptions(options)
|
|
138
|
-
?
|
|
139
|
-
getEndpointFromBucketName(options)
|
|
140
|
-
:
|
|
141
|
-
getEndpointFromArn(options);
|
|
142
|
-
};
|
|
143
|
-
const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, fipsEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
|
|
144
|
-
const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname);
|
|
145
|
-
if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) {
|
|
146
|
-
return {
|
|
147
|
-
bucketEndpoint: false,
|
|
148
|
-
hostname: dualstackEndpoint ? `s3.dualstack.${clientRegion}.${hostnameSuffix}` : baseHostname,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (accelerateEndpoint) {
|
|
152
|
-
baseHostname = `s3-accelerate${dualstackEndpoint ? ".dualstack" : ""}.${hostnameSuffix}`;
|
|
153
|
-
}
|
|
154
|
-
else if (dualstackEndpoint) {
|
|
155
|
-
baseHostname = `s3.dualstack.${clientRegion}.${hostnameSuffix}`;
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
bucketEndpoint: true,
|
|
159
|
-
hostname: `${bucketName}.${baseHostname}`,
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
const getEndpointFromArn = (options) => {
|
|
163
|
-
const { isCustomEndpoint, baseHostname, clientRegion } = options;
|
|
164
|
-
const hostnameSuffix = isCustomEndpoint ? baseHostname : getSuffixForArnEndpoint(baseHostname)[1];
|
|
165
|
-
const { pathStyleEndpoint, accelerateEndpoint = false, fipsEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
|
|
166
|
-
validateArnEndpointOptions({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
|
|
167
|
-
const { service, partition, accountId, region, resource } = bucketName;
|
|
168
|
-
validateService(service);
|
|
169
|
-
validatePartition(partition, { clientPartition });
|
|
170
|
-
validateAccountId(accountId);
|
|
171
|
-
const { accesspointName, outpostId } = getArnResources(resource);
|
|
172
|
-
if (service === "s3-object-lambda") {
|
|
173
|
-
return getEndpointFromObjectLambdaArn({ ...options, tlsCompatible, bucketName, accesspointName, hostnameSuffix });
|
|
174
|
-
}
|
|
175
|
-
if (region === "") {
|
|
176
|
-
return getEndpointFromMRAPArn({ ...options, mrapAlias: accesspointName, hostnameSuffix });
|
|
177
|
-
}
|
|
178
|
-
if (outpostId) {
|
|
179
|
-
return getEndpointFromOutpostArn({ ...options, clientRegion, outpostId, accesspointName, hostnameSuffix });
|
|
180
|
-
}
|
|
181
|
-
return getEndpointFromAccessPointArn({ ...options, clientRegion, accesspointName, hostnameSuffix });
|
|
182
|
-
};
|
|
183
|
-
const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
|
|
184
|
-
const { accountId, region, service } = bucketName;
|
|
185
|
-
validateRegionalClient(clientRegion);
|
|
186
|
-
const DNSHostLabel = `${accesspointName}-${accountId}`;
|
|
187
|
-
validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
188
|
-
const endpointRegion = useArnRegion ? region : clientRegion;
|
|
189
|
-
const signingRegion = useArnRegion ? region : clientSigningRegion;
|
|
190
|
-
return {
|
|
191
|
-
bucketEndpoint: true,
|
|
192
|
-
hostname: `${DNSHostLabel}.${service}${fipsEndpoint ? "-fips" : ""}.${endpointRegion}.${hostnameSuffix}`,
|
|
193
|
-
signingRegion,
|
|
194
|
-
signingService: service,
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpoint = false, isCustomEndpoint, mrapAlias, hostnameSuffix, }) => {
|
|
198
|
-
if (disableMultiregionAccessPoints === true) {
|
|
199
|
-
throw new Error("SDK is attempting to use a MRAP ARN. Please enable to feature.");
|
|
200
|
-
}
|
|
201
|
-
validateMrapAlias(mrapAlias);
|
|
202
|
-
return {
|
|
203
|
-
bucketEndpoint: true,
|
|
204
|
-
hostname: `${mrapAlias}${isCustomEndpoint ? "" : `.accesspoint.s3-global`}.${hostnameSuffix}`,
|
|
205
|
-
signingRegion: "*",
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
209
|
-
validateRegionalClient(clientRegion);
|
|
210
|
-
const DNSHostLabel = `${accesspointName}-${bucketName.accountId}`;
|
|
211
|
-
validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
212
|
-
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
213
|
-
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
214
|
-
validateOutpostService(bucketName.service);
|
|
215
|
-
validateDNSHostLabel(outpostId, { tlsCompatible });
|
|
216
|
-
validateNoFIPS(fipsEndpoint);
|
|
217
|
-
const hostnamePrefix = `${DNSHostLabel}.${outpostId}`;
|
|
218
|
-
return {
|
|
219
|
-
bucketEndpoint: true,
|
|
220
|
-
hostname: `${hostnamePrefix}${isCustomEndpoint ? "" : `.s3-outposts.${endpointRegion}`}.${hostnameSuffix}`,
|
|
221
|
-
signingRegion,
|
|
222
|
-
signingService: "s3-outposts",
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
226
|
-
validateRegionalClient(clientRegion);
|
|
227
|
-
const hostnamePrefix = `${accesspointName}-${bucketName.accountId}`;
|
|
228
|
-
validateDNSHostLabel(hostnamePrefix, { tlsCompatible });
|
|
229
|
-
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
230
|
-
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
231
|
-
validateS3Service(bucketName.service);
|
|
232
|
-
return {
|
|
233
|
-
bucketEndpoint: true,
|
|
234
|
-
hostname: `${hostnamePrefix}${isCustomEndpoint
|
|
235
|
-
? ""
|
|
236
|
-
: `.s3-accesspoint${fipsEndpoint ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${endpointRegion}`}.${hostnameSuffix}`,
|
|
237
|
-
signingRegion,
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
const bucketEndpointMiddleware = (options) => (next, context) => async (args) => {
|
|
242
|
-
const { Bucket: bucketName } = args.input;
|
|
243
|
-
let replaceBucketInPath = options.bucketEndpoint;
|
|
244
|
-
const request = args.request;
|
|
245
|
-
if (protocols.HttpRequest.isInstance(request)) {
|
|
246
|
-
if (options.bucketEndpoint) {
|
|
247
|
-
request.hostname = bucketName;
|
|
248
|
-
}
|
|
249
|
-
else if (util.validate(bucketName)) {
|
|
250
|
-
const bucketArn = util.parse(bucketName);
|
|
251
|
-
const clientRegion = await options.region();
|
|
252
|
-
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
253
|
-
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
254
|
-
const { partition, signingRegion = clientRegion } = (await options.regionInfoProvider(clientRegion, { useDualstackEndpoint, useFipsEndpoint })) || {};
|
|
255
|
-
const useArnRegion = await options.useArnRegion();
|
|
256
|
-
const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService, } = bucketHostname({
|
|
257
|
-
bucketName: bucketArn,
|
|
258
|
-
baseHostname: request.hostname,
|
|
259
|
-
accelerateEndpoint: options.useAccelerateEndpoint,
|
|
260
|
-
dualstackEndpoint: useDualstackEndpoint,
|
|
261
|
-
fipsEndpoint: useFipsEndpoint,
|
|
262
|
-
pathStyleEndpoint: options.forcePathStyle,
|
|
263
|
-
tlsCompatible: request.protocol === "https:",
|
|
264
|
-
useArnRegion,
|
|
265
|
-
clientPartition: partition,
|
|
266
|
-
clientSigningRegion: signingRegion,
|
|
267
|
-
clientRegion: clientRegion,
|
|
268
|
-
isCustomEndpoint: options.isCustomEndpoint,
|
|
269
|
-
disableMultiregionAccessPoints: await options.disableMultiregionAccessPoints(),
|
|
270
|
-
});
|
|
271
|
-
if (modifiedSigningRegion && modifiedSigningRegion !== signingRegion) {
|
|
272
|
-
context["signing_region"] = modifiedSigningRegion;
|
|
273
|
-
}
|
|
274
|
-
if (signingService && signingService !== "s3") {
|
|
275
|
-
context["signing_service"] = signingService;
|
|
276
|
-
}
|
|
277
|
-
request.hostname = hostname;
|
|
278
|
-
replaceBucketInPath = bucketEndpoint;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
const clientRegion = await options.region();
|
|
282
|
-
const dualstackEndpoint = await options.useDualstackEndpoint();
|
|
283
|
-
const fipsEndpoint = await options.useFipsEndpoint();
|
|
284
|
-
const { hostname, bucketEndpoint } = bucketHostname({
|
|
285
|
-
bucketName,
|
|
286
|
-
clientRegion,
|
|
287
|
-
baseHostname: request.hostname,
|
|
288
|
-
accelerateEndpoint: options.useAccelerateEndpoint,
|
|
289
|
-
dualstackEndpoint,
|
|
290
|
-
fipsEndpoint,
|
|
291
|
-
pathStyleEndpoint: options.forcePathStyle,
|
|
292
|
-
tlsCompatible: request.protocol === "https:",
|
|
293
|
-
isCustomEndpoint: options.isCustomEndpoint,
|
|
294
|
-
});
|
|
295
|
-
request.hostname = hostname;
|
|
296
|
-
replaceBucketInPath = bucketEndpoint;
|
|
297
|
-
}
|
|
298
|
-
if (replaceBucketInPath) {
|
|
299
|
-
request.path = request.path.replace(/^(\/)?[^\/]+/, "");
|
|
300
|
-
if (request.path === "") {
|
|
301
|
-
request.path = "/";
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return next({ ...args, request });
|
|
306
|
-
};
|
|
307
|
-
const bucketEndpointMiddlewareOptions = {
|
|
308
|
-
tags: ["BUCKET_ENDPOINT"],
|
|
309
|
-
name: "bucketEndpointMiddleware",
|
|
310
|
-
relation: "before",
|
|
311
|
-
toMiddleware: "hostHeaderMiddleware",
|
|
312
|
-
override: true,
|
|
313
|
-
};
|
|
314
|
-
const getBucketEndpointPlugin = (options) => ({
|
|
315
|
-
applyToStack: (clientStack) => {
|
|
316
|
-
clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions);
|
|
317
|
-
},
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
function resolveBucketEndpointConfig(input) {
|
|
321
|
-
const { bucketEndpoint = false, forcePathStyle = false, useAccelerateEndpoint = false, useArnRegion, disableMultiregionAccessPoints = false, } = input;
|
|
322
|
-
return Object.assign(input, {
|
|
323
|
-
bucketEndpoint,
|
|
324
|
-
forcePathStyle,
|
|
325
|
-
useAccelerateEndpoint,
|
|
326
|
-
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
|
|
327
|
-
disableMultiregionAccessPoints: typeof disableMultiregionAccessPoints === "function"
|
|
328
|
-
? disableMultiregionAccessPoints
|
|
329
|
-
: () => Promise.resolve(disableMultiregionAccessPoints),
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS;
|
|
334
|
-
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME;
|
|
335
|
-
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME;
|
|
336
|
-
exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = NODE_USE_ARN_REGION_CONFIG_OPTIONS;
|
|
337
|
-
exports.NODE_USE_ARN_REGION_ENV_NAME = NODE_USE_ARN_REGION_ENV_NAME;
|
|
338
|
-
exports.NODE_USE_ARN_REGION_INI_NAME = NODE_USE_ARN_REGION_INI_NAME;
|
|
339
|
-
exports.bucketEndpointMiddleware = bucketEndpointMiddleware;
|
|
340
|
-
exports.bucketEndpointMiddlewareOptions = bucketEndpointMiddlewareOptions;
|
|
341
|
-
exports.bucketHostname = bucketHostname;
|
|
342
|
-
exports.getArnResources = getArnResources;
|
|
343
|
-
exports.getBucketEndpointPlugin = getBucketEndpointPlugin;
|
|
344
|
-
exports.getSuffixForArnEndpoint = getSuffixForArnEndpoint;
|
|
345
|
-
exports.resolveBucketEndpointConfig = resolveBucketEndpointConfig;
|
|
346
|
-
exports.validateAccountId = validateAccountId;
|
|
347
|
-
exports.validateDNSHostLabel = validateDNSHostLabel;
|
|
348
|
-
exports.validateNoDualstack = validateNoDualstack;
|
|
349
|
-
exports.validateNoFIPS = validateNoFIPS;
|
|
350
|
-
exports.validateOutpostService = validateOutpostService;
|
|
351
|
-
exports.validatePartition = validatePartition;
|
|
352
|
-
exports.validateRegion = validateRegion;
|
|
3
|
+
var s3 = require('@aws-sdk/middleware-sdk-s3/s3');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = s3.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS;
|
|
8
|
+
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = s3.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME;
|
|
9
|
+
exports.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = s3.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME;
|
|
10
|
+
exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = s3.NODE_USE_ARN_REGION_CONFIG_OPTIONS;
|
|
11
|
+
exports.NODE_USE_ARN_REGION_ENV_NAME = s3.NODE_USE_ARN_REGION_ENV_NAME;
|
|
12
|
+
exports.NODE_USE_ARN_REGION_INI_NAME = s3.NODE_USE_ARN_REGION_INI_NAME;
|
|
13
|
+
exports.bucketEndpointMiddleware = s3.bucketEndpointMiddleware;
|
|
14
|
+
exports.bucketEndpointMiddlewareOptions = s3.bucketEndpointMiddlewareOptions;
|
|
15
|
+
exports.bucketHostname = s3.bucketHostname;
|
|
16
|
+
exports.getArnResources = s3.getArnResources;
|
|
17
|
+
exports.getBucketEndpointPlugin = s3.getBucketEndpointPlugin;
|
|
18
|
+
exports.getSuffixForArnEndpoint = s3.getSuffixForArnEndpoint;
|
|
19
|
+
exports.resolveBucketEndpointConfig = s3.resolveBucketEndpointConfig;
|
|
20
|
+
exports.validateAccountId = s3.validateAccountId;
|
|
21
|
+
exports.validateDNSHostLabel = s3.validateDNSHostLabel;
|
|
22
|
+
exports.validateNoDualstack = s3.validateNoDualstack;
|
|
23
|
+
exports.validateNoFIPS = s3.validateNoFIPS;
|
|
24
|
+
exports.validateOutpostService = s3.validateOutpostService;
|
|
25
|
+
exports.validatePartition = s3.validatePartition;
|
|
26
|
+
exports.validateRegion = s3.validateRegion;
|
package/dist-es/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./NodeUseArnRegionConfigOptions";
|
|
3
|
-
export * from "./bucketEndpointMiddleware";
|
|
4
|
-
export * from "./bucketHostname";
|
|
5
|
-
export * from "./configurations";
|
|
6
|
-
export { getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
|
|
1
|
+
export { NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS, NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, NODE_USE_ARN_REGION_CONFIG_OPTIONS, NODE_USE_ARN_REGION_ENV_NAME, NODE_USE_ARN_REGION_INI_NAME, bucketEndpointMiddleware, bucketEndpointMiddlewareOptions, getBucketEndpointPlugin, bucketHostname, resolveBucketEndpointConfig, getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "@aws-sdk/middleware-sdk-s3/s3";
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from "./bucketEndpointMiddleware";
|
|
4
|
-
export * from "./bucketHostname";
|
|
5
|
-
export * from "./configurations";
|
|
6
|
-
export { getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "./bucketHostnameUtils";
|
|
1
|
+
export { NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS, NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, NODE_USE_ARN_REGION_CONFIG_OPTIONS, NODE_USE_ARN_REGION_ENV_NAME, NODE_USE_ARN_REGION_INI_NAME, bucketEndpointMiddleware, bucketEndpointMiddlewareOptions, getBucketEndpointPlugin, bucketHostname, resolveBucketEndpointConfig, getArnResources, getSuffixForArnEndpoint, validateOutpostService, validatePartition, validateAccountId, validateRegion, validateDNSHostLabel, validateNoDualstack, validateNoFIPS, } from "@aws-sdk/middleware-sdk-s3/s3";
|
|
2
|
+
export type { BucketHostname, BucketEndpointInputConfig, BucketEndpointResolvedConfig, } from "@aws-sdk/middleware-sdk-s3/s3";
|
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-bucket-endpoint",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.21",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-bucket-endpoint",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
10
|
-
"
|
|
11
|
-
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
12
|
-
"extract:docs": "api-extractor run --local",
|
|
13
|
-
"test": "yarn g:vitest run",
|
|
14
|
-
"test:watch": "yarn g:vitest watch"
|
|
10
|
+
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
|
|
15
11
|
},
|
|
16
12
|
"main": "./dist-cjs/index.js",
|
|
17
13
|
"module": "./dist-es/index.js",
|
|
@@ -19,33 +15,21 @@
|
|
|
19
15
|
"sideEffects": false,
|
|
20
16
|
"author": {
|
|
21
17
|
"name": "AWS SDK for JavaScript Team",
|
|
22
|
-
"url": "https://aws.amazon.com/javascript/"
|
|
18
|
+
"url": "https://aws.amazon.com/sdk-for-javascript/"
|
|
23
19
|
},
|
|
24
20
|
"license": "Apache-2.0",
|
|
25
21
|
"dependencies": {
|
|
26
|
-
"@aws-sdk/
|
|
27
|
-
"@aws-sdk/types": "^3.973.10",
|
|
28
|
-
"@smithy/core": "^3.24.6",
|
|
29
|
-
"@smithy/types": "^4.14.3",
|
|
22
|
+
"@aws-sdk/middleware-sdk-s3": "^3.972.48",
|
|
30
23
|
"tslib": "^2.6.2"
|
|
31
24
|
},
|
|
32
25
|
"devDependencies": {
|
|
33
|
-
"@tsconfig/recommended": "1.0.1",
|
|
34
26
|
"concurrently": "7.0.0",
|
|
35
|
-
"downlevel-dts": "0.10.1",
|
|
36
27
|
"premove": "4.0.0",
|
|
37
28
|
"typescript": "~5.8.3"
|
|
38
29
|
},
|
|
39
30
|
"engines": {
|
|
40
31
|
"node": ">=20.0.0"
|
|
41
32
|
},
|
|
42
|
-
"typesVersions": {
|
|
43
|
-
"<4.5": {
|
|
44
|
-
"dist-types/*": [
|
|
45
|
-
"dist-types/ts3.4/*"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
33
|
"files": [
|
|
50
34
|
"dist-*/**"
|
|
51
35
|
],
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { booleanSelector, SelectorType } from "@smithy/core/config";
|
|
2
|
-
export const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
|
|
3
|
-
export const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME = "s3_disable_multiregion_access_points";
|
|
4
|
-
export const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS = {
|
|
5
|
-
environmentVariableSelector: (env) => booleanSelector(env, NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME, SelectorType.ENV),
|
|
6
|
-
configFileSelector: (profile) => booleanSelector(profile, NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME, SelectorType.CONFIG),
|
|
7
|
-
default: false,
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { booleanSelector, SelectorType } from "@smithy/core/config";
|
|
2
|
-
export const NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
|
|
3
|
-
export const NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
|
|
4
|
-
export const NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
|
|
5
|
-
environmentVariableSelector: (env) => booleanSelector(env, NODE_USE_ARN_REGION_ENV_NAME, SelectorType.ENV),
|
|
6
|
-
configFileSelector: (profile) => booleanSelector(profile, NODE_USE_ARN_REGION_INI_NAME, SelectorType.CONFIG),
|
|
7
|
-
default: undefined,
|
|
8
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { parse as parseArn, validate as validateArn } from "@aws-sdk/core/util";
|
|
2
|
-
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
-
import { bucketHostname } from "./bucketHostname";
|
|
4
|
-
export const bucketEndpointMiddleware = (options) => (next, context) => async (args) => {
|
|
5
|
-
const { Bucket: bucketName } = args.input;
|
|
6
|
-
let replaceBucketInPath = options.bucketEndpoint;
|
|
7
|
-
const request = args.request;
|
|
8
|
-
if (HttpRequest.isInstance(request)) {
|
|
9
|
-
if (options.bucketEndpoint) {
|
|
10
|
-
request.hostname = bucketName;
|
|
11
|
-
}
|
|
12
|
-
else if (validateArn(bucketName)) {
|
|
13
|
-
const bucketArn = parseArn(bucketName);
|
|
14
|
-
const clientRegion = await options.region();
|
|
15
|
-
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
16
|
-
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
17
|
-
const { partition, signingRegion = clientRegion } = (await options.regionInfoProvider(clientRegion, { useDualstackEndpoint, useFipsEndpoint })) || {};
|
|
18
|
-
const useArnRegion = await options.useArnRegion();
|
|
19
|
-
const { hostname, bucketEndpoint, signingRegion: modifiedSigningRegion, signingService, } = bucketHostname({
|
|
20
|
-
bucketName: bucketArn,
|
|
21
|
-
baseHostname: request.hostname,
|
|
22
|
-
accelerateEndpoint: options.useAccelerateEndpoint,
|
|
23
|
-
dualstackEndpoint: useDualstackEndpoint,
|
|
24
|
-
fipsEndpoint: useFipsEndpoint,
|
|
25
|
-
pathStyleEndpoint: options.forcePathStyle,
|
|
26
|
-
tlsCompatible: request.protocol === "https:",
|
|
27
|
-
useArnRegion,
|
|
28
|
-
clientPartition: partition,
|
|
29
|
-
clientSigningRegion: signingRegion,
|
|
30
|
-
clientRegion: clientRegion,
|
|
31
|
-
isCustomEndpoint: options.isCustomEndpoint,
|
|
32
|
-
disableMultiregionAccessPoints: await options.disableMultiregionAccessPoints(),
|
|
33
|
-
});
|
|
34
|
-
if (modifiedSigningRegion && modifiedSigningRegion !== signingRegion) {
|
|
35
|
-
context["signing_region"] = modifiedSigningRegion;
|
|
36
|
-
}
|
|
37
|
-
if (signingService && signingService !== "s3") {
|
|
38
|
-
context["signing_service"] = signingService;
|
|
39
|
-
}
|
|
40
|
-
request.hostname = hostname;
|
|
41
|
-
replaceBucketInPath = bucketEndpoint;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const clientRegion = await options.region();
|
|
45
|
-
const dualstackEndpoint = await options.useDualstackEndpoint();
|
|
46
|
-
const fipsEndpoint = await options.useFipsEndpoint();
|
|
47
|
-
const { hostname, bucketEndpoint } = bucketHostname({
|
|
48
|
-
bucketName,
|
|
49
|
-
clientRegion,
|
|
50
|
-
baseHostname: request.hostname,
|
|
51
|
-
accelerateEndpoint: options.useAccelerateEndpoint,
|
|
52
|
-
dualstackEndpoint,
|
|
53
|
-
fipsEndpoint,
|
|
54
|
-
pathStyleEndpoint: options.forcePathStyle,
|
|
55
|
-
tlsCompatible: request.protocol === "https:",
|
|
56
|
-
isCustomEndpoint: options.isCustomEndpoint,
|
|
57
|
-
});
|
|
58
|
-
request.hostname = hostname;
|
|
59
|
-
replaceBucketInPath = bucketEndpoint;
|
|
60
|
-
}
|
|
61
|
-
if (replaceBucketInPath) {
|
|
62
|
-
request.path = request.path.replace(/^(\/)?[^\/]+/, "");
|
|
63
|
-
if (request.path === "") {
|
|
64
|
-
request.path = "/";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return next({ ...args, request });
|
|
69
|
-
};
|
|
70
|
-
export const bucketEndpointMiddlewareOptions = {
|
|
71
|
-
tags: ["BUCKET_ENDPOINT"],
|
|
72
|
-
name: "bucketEndpointMiddleware",
|
|
73
|
-
relation: "before",
|
|
74
|
-
toMiddleware: "hostHeaderMiddleware",
|
|
75
|
-
override: true,
|
|
76
|
-
};
|
|
77
|
-
export const getBucketEndpointPlugin = (options) => ({
|
|
78
|
-
applyToStack: (clientStack) => {
|
|
79
|
-
clientStack.addRelativeTo(bucketEndpointMiddleware(options), bucketEndpointMiddlewareOptions);
|
|
80
|
-
},
|
|
81
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { DOT_PATTERN, getArnResources, getSuffix, getSuffixForArnEndpoint, isBucketNameOptions, isDnsCompatibleBucketName, validateAccountId, validateArnEndpointOptions, validateCustomEndpoint, validateDNSHostLabel, validateMrapAlias, validateNoFIPS, validateOutpostService, validatePartition, validateRegionalClient, validateS3Service, validateService, } from "./bucketHostnameUtils";
|
|
2
|
-
export const bucketHostname = (options) => {
|
|
3
|
-
validateCustomEndpoint(options);
|
|
4
|
-
return isBucketNameOptions(options)
|
|
5
|
-
?
|
|
6
|
-
getEndpointFromBucketName(options)
|
|
7
|
-
:
|
|
8
|
-
getEndpointFromArn(options);
|
|
9
|
-
};
|
|
10
|
-
const getEndpointFromBucketName = ({ accelerateEndpoint = false, clientRegion: region, baseHostname, bucketName, dualstackEndpoint = false, fipsEndpoint = false, pathStyleEndpoint = false, tlsCompatible = true, isCustomEndpoint = false, }) => {
|
|
11
|
-
const [clientRegion, hostnameSuffix] = isCustomEndpoint ? [region, baseHostname] : getSuffix(baseHostname);
|
|
12
|
-
if (pathStyleEndpoint || !isDnsCompatibleBucketName(bucketName) || (tlsCompatible && DOT_PATTERN.test(bucketName))) {
|
|
13
|
-
return {
|
|
14
|
-
bucketEndpoint: false,
|
|
15
|
-
hostname: dualstackEndpoint ? `s3.dualstack.${clientRegion}.${hostnameSuffix}` : baseHostname,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
if (accelerateEndpoint) {
|
|
19
|
-
baseHostname = `s3-accelerate${dualstackEndpoint ? ".dualstack" : ""}.${hostnameSuffix}`;
|
|
20
|
-
}
|
|
21
|
-
else if (dualstackEndpoint) {
|
|
22
|
-
baseHostname = `s3.dualstack.${clientRegion}.${hostnameSuffix}`;
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
bucketEndpoint: true,
|
|
26
|
-
hostname: `${bucketName}.${baseHostname}`,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const getEndpointFromArn = (options) => {
|
|
30
|
-
const { isCustomEndpoint, baseHostname, clientRegion } = options;
|
|
31
|
-
const hostnameSuffix = isCustomEndpoint ? baseHostname : getSuffixForArnEndpoint(baseHostname)[1];
|
|
32
|
-
const { pathStyleEndpoint, accelerateEndpoint = false, fipsEndpoint = false, tlsCompatible = true, bucketName, clientPartition = "aws", } = options;
|
|
33
|
-
validateArnEndpointOptions({ pathStyleEndpoint, accelerateEndpoint, tlsCompatible });
|
|
34
|
-
const { service, partition, accountId, region, resource } = bucketName;
|
|
35
|
-
validateService(service);
|
|
36
|
-
validatePartition(partition, { clientPartition });
|
|
37
|
-
validateAccountId(accountId);
|
|
38
|
-
const { accesspointName, outpostId } = getArnResources(resource);
|
|
39
|
-
if (service === "s3-object-lambda") {
|
|
40
|
-
return getEndpointFromObjectLambdaArn({ ...options, tlsCompatible, bucketName, accesspointName, hostnameSuffix });
|
|
41
|
-
}
|
|
42
|
-
if (region === "") {
|
|
43
|
-
return getEndpointFromMRAPArn({ ...options, clientRegion, mrapAlias: accesspointName, hostnameSuffix });
|
|
44
|
-
}
|
|
45
|
-
if (outpostId) {
|
|
46
|
-
return getEndpointFromOutpostArn({ ...options, clientRegion, outpostId, accesspointName, hostnameSuffix });
|
|
47
|
-
}
|
|
48
|
-
return getEndpointFromAccessPointArn({ ...options, clientRegion, accesspointName, hostnameSuffix });
|
|
49
|
-
};
|
|
50
|
-
const getEndpointFromObjectLambdaArn = ({ dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, useArnRegion, clientRegion, clientSigningRegion = clientRegion, accesspointName, bucketName, hostnameSuffix, }) => {
|
|
51
|
-
const { accountId, region, service } = bucketName;
|
|
52
|
-
validateRegionalClient(clientRegion);
|
|
53
|
-
const DNSHostLabel = `${accesspointName}-${accountId}`;
|
|
54
|
-
validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
55
|
-
const endpointRegion = useArnRegion ? region : clientRegion;
|
|
56
|
-
const signingRegion = useArnRegion ? region : clientSigningRegion;
|
|
57
|
-
return {
|
|
58
|
-
bucketEndpoint: true,
|
|
59
|
-
hostname: `${DNSHostLabel}.${service}${fipsEndpoint ? "-fips" : ""}.${endpointRegion}.${hostnameSuffix}`,
|
|
60
|
-
signingRegion,
|
|
61
|
-
signingService: service,
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
const getEndpointFromMRAPArn = ({ disableMultiregionAccessPoints, dualstackEndpoint = false, isCustomEndpoint, mrapAlias, hostnameSuffix, }) => {
|
|
65
|
-
if (disableMultiregionAccessPoints === true) {
|
|
66
|
-
throw new Error("SDK is attempting to use a MRAP ARN. Please enable to feature.");
|
|
67
|
-
}
|
|
68
|
-
validateMrapAlias(mrapAlias);
|
|
69
|
-
return {
|
|
70
|
-
bucketEndpoint: true,
|
|
71
|
-
hostname: `${mrapAlias}${isCustomEndpoint ? "" : `.accesspoint.s3-global`}.${hostnameSuffix}`,
|
|
72
|
-
signingRegion: "*",
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const getEndpointFromOutpostArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, outpostId, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
76
|
-
validateRegionalClient(clientRegion);
|
|
77
|
-
const DNSHostLabel = `${accesspointName}-${bucketName.accountId}`;
|
|
78
|
-
validateDNSHostLabel(DNSHostLabel, { tlsCompatible });
|
|
79
|
-
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
80
|
-
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
81
|
-
validateOutpostService(bucketName.service);
|
|
82
|
-
validateDNSHostLabel(outpostId, { tlsCompatible });
|
|
83
|
-
validateNoFIPS(fipsEndpoint);
|
|
84
|
-
const hostnamePrefix = `${DNSHostLabel}.${outpostId}`;
|
|
85
|
-
return {
|
|
86
|
-
bucketEndpoint: true,
|
|
87
|
-
hostname: `${hostnamePrefix}${isCustomEndpoint ? "" : `.s3-outposts.${endpointRegion}`}.${hostnameSuffix}`,
|
|
88
|
-
signingRegion,
|
|
89
|
-
signingService: "s3-outposts",
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
const getEndpointFromAccessPointArn = ({ useArnRegion, clientRegion, clientSigningRegion = clientRegion, bucketName, dualstackEndpoint = false, fipsEndpoint = false, tlsCompatible = true, accesspointName, isCustomEndpoint, hostnameSuffix, }) => {
|
|
93
|
-
validateRegionalClient(clientRegion);
|
|
94
|
-
const hostnamePrefix = `${accesspointName}-${bucketName.accountId}`;
|
|
95
|
-
validateDNSHostLabel(hostnamePrefix, { tlsCompatible });
|
|
96
|
-
const endpointRegion = useArnRegion ? bucketName.region : clientRegion;
|
|
97
|
-
const signingRegion = useArnRegion ? bucketName.region : clientSigningRegion;
|
|
98
|
-
validateS3Service(bucketName.service);
|
|
99
|
-
return {
|
|
100
|
-
bucketEndpoint: true,
|
|
101
|
-
hostname: `${hostnamePrefix}${isCustomEndpoint
|
|
102
|
-
? ""
|
|
103
|
-
: `.s3-accesspoint${fipsEndpoint ? "-fips" : ""}${dualstackEndpoint ? ".dualstack" : ""}.${endpointRegion}`}.${hostnameSuffix}`,
|
|
104
|
-
signingRegion,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
|
|
2
|
-
const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
|
|
3
|
-
const DOTS_PATTERN = /\.\./;
|
|
4
|
-
export const DOT_PATTERN = /\./;
|
|
5
|
-
export const S3_HOSTNAME_PATTERN = /^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./;
|
|
6
|
-
const S3_US_EAST_1_ALTNAME_PATTERN = /^s3(-external-1)?\.amazonaws\.com$/;
|
|
7
|
-
const AWS_PARTITION_SUFFIX = "amazonaws.com";
|
|
8
|
-
export const isBucketNameOptions = (options) => typeof options.bucketName === "string";
|
|
9
|
-
export const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
|
|
10
|
-
const getRegionalSuffix = (hostname) => {
|
|
11
|
-
const parts = hostname.match(S3_HOSTNAME_PATTERN);
|
|
12
|
-
return [parts[4], hostname.replace(new RegExp(`^${parts[0]}`), "")];
|
|
13
|
-
};
|
|
14
|
-
export const getSuffix = (hostname) => S3_US_EAST_1_ALTNAME_PATTERN.test(hostname) ? ["us-east-1", AWS_PARTITION_SUFFIX] : getRegionalSuffix(hostname);
|
|
15
|
-
export const getSuffixForArnEndpoint = (hostname) => S3_US_EAST_1_ALTNAME_PATTERN.test(hostname)
|
|
16
|
-
? [hostname.replace(`.${AWS_PARTITION_SUFFIX}`, ""), AWS_PARTITION_SUFFIX]
|
|
17
|
-
: getRegionalSuffix(hostname);
|
|
18
|
-
export const validateArnEndpointOptions = (options) => {
|
|
19
|
-
if (options.pathStyleEndpoint) {
|
|
20
|
-
throw new Error("Path-style S3 endpoint is not supported when bucket is an ARN");
|
|
21
|
-
}
|
|
22
|
-
if (options.accelerateEndpoint) {
|
|
23
|
-
throw new Error("Accelerate endpoint is not supported when bucket is an ARN");
|
|
24
|
-
}
|
|
25
|
-
if (!options.tlsCompatible) {
|
|
26
|
-
throw new Error("HTTPS is required when bucket is an ARN");
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export const validateService = (service) => {
|
|
30
|
-
if (service !== "s3" && service !== "s3-outposts" && service !== "s3-object-lambda") {
|
|
31
|
-
throw new Error("Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component");
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export const validateS3Service = (service) => {
|
|
35
|
-
if (service !== "s3") {
|
|
36
|
-
throw new Error("Expect 's3' in Accesspoint ARN service component");
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const validateOutpostService = (service) => {
|
|
40
|
-
if (service !== "s3-outposts") {
|
|
41
|
-
throw new Error("Expect 's3-posts' in Outpost ARN service component");
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
export const validatePartition = (partition, options) => {
|
|
45
|
-
if (partition !== options.clientPartition) {
|
|
46
|
-
throw new Error(`Partition in ARN is incompatible, got "${partition}" but expected "${options.clientPartition}"`);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
export const validateRegion = (region, options) => { };
|
|
50
|
-
export const validateRegionalClient = (region) => {
|
|
51
|
-
if (["s3-external-1", "aws-global"].includes(region)) {
|
|
52
|
-
throw new Error(`Client region ${region} is not regional`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
export const validateAccountId = (accountId) => {
|
|
56
|
-
if (!/[0-9]{12}/.exec(accountId)) {
|
|
57
|
-
throw new Error("Access point ARN accountID does not match regex '[0-9]{12}'");
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
export const validateDNSHostLabel = (label, options = { tlsCompatible: true }) => {
|
|
61
|
-
if (label.length >= 64 ||
|
|
62
|
-
!/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(label) ||
|
|
63
|
-
/(\d+\.){3}\d+/.test(label) ||
|
|
64
|
-
/[.-]{2}/.test(label) ||
|
|
65
|
-
(options?.tlsCompatible && DOT_PATTERN.test(label))) {
|
|
66
|
-
throw new Error(`Invalid DNS label ${label}`);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
export const validateCustomEndpoint = (options) => {
|
|
70
|
-
if (options.isCustomEndpoint) {
|
|
71
|
-
if (options.dualstackEndpoint)
|
|
72
|
-
throw new Error("Dualstack endpoint is not supported with custom endpoint");
|
|
73
|
-
if (options.accelerateEndpoint)
|
|
74
|
-
throw new Error("Accelerate endpoint is not supported with custom endpoint");
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
export const getArnResources = (resource) => {
|
|
78
|
-
const delimiter = resource.includes(":") ? ":" : "/";
|
|
79
|
-
const [resourceType, ...rest] = resource.split(delimiter);
|
|
80
|
-
if (resourceType === "accesspoint") {
|
|
81
|
-
if (rest.length !== 1 || rest[0] === "") {
|
|
82
|
-
throw new Error(`Access Point ARN should have one resource accesspoint${delimiter}{accesspointname}`);
|
|
83
|
-
}
|
|
84
|
-
return { accesspointName: rest[0] };
|
|
85
|
-
}
|
|
86
|
-
else if (resourceType === "outpost") {
|
|
87
|
-
if (!rest[0] || rest[1] !== "accesspoint" || !rest[2] || rest.length !== 3) {
|
|
88
|
-
throw new Error(`Outpost ARN should have resource outpost${delimiter}{outpostId}${delimiter}accesspoint${delimiter}{accesspointName}`);
|
|
89
|
-
}
|
|
90
|
-
const [outpostId, _, accesspointName] = rest;
|
|
91
|
-
return { outpostId, accesspointName };
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
throw new Error(`ARN resource should begin with 'accesspoint${delimiter}' or 'outpost${delimiter}'`);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
export const validateNoDualstack = (dualstackEndpoint) => { };
|
|
98
|
-
export const validateNoFIPS = (useFipsEndpoint) => {
|
|
99
|
-
if (useFipsEndpoint)
|
|
100
|
-
throw new Error(`FIPS region is not supported with Outpost.`);
|
|
101
|
-
};
|
|
102
|
-
export const validateMrapAlias = (name) => {
|
|
103
|
-
try {
|
|
104
|
-
name.split(".").forEach((label) => {
|
|
105
|
-
validateDNSHostLabel(label);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
catch (e) {
|
|
109
|
-
throw new Error(`"${name}" is not a DNS compatible name.`);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function resolveBucketEndpointConfig(input) {
|
|
2
|
-
const { bucketEndpoint = false, forcePathStyle = false, useAccelerateEndpoint = false, useArnRegion, disableMultiregionAccessPoints = false, } = input;
|
|
3
|
-
return Object.assign(input, {
|
|
4
|
-
bucketEndpoint,
|
|
5
|
-
forcePathStyle,
|
|
6
|
-
useAccelerateEndpoint,
|
|
7
|
-
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
|
|
8
|
-
disableMultiregionAccessPoints: typeof disableMultiregionAccessPoints === "function"
|
|
9
|
-
? disableMultiregionAccessPoints
|
|
10
|
-
: () => Promise.resolve(disableMultiregionAccessPoints),
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LoadedConfigSelectors } from "@smithy/core/config";
|
|
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>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LoadedConfigSelectors } from "@smithy/core/config";
|
|
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
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean | undefined>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { BuildMiddleware, Pluggable, RelativeMiddlewareOptions } from "@smithy/types";
|
|
2
|
-
import type { BucketEndpointResolvedConfig } from "./configurations";
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated unused as of EndpointsV2.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare const bucketEndpointMiddleware: (options: BucketEndpointResolvedConfig) => BuildMiddleware<any, any>;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated unused as of EndpointsV2.
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const bucketEndpointMiddlewareOptions: RelativeMiddlewareOptions;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated unused as of EndpointsV2.
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const getBucketEndpointPlugin: (options: BucketEndpointResolvedConfig) => Pluggable<any, any>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ArnHostnameParams, BucketHostnameParams } from "./bucketHostnameUtils";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated unused as of EndpointsV2.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export interface BucketHostname {
|
|
7
|
-
hostname: string;
|
|
8
|
-
bucketEndpoint: boolean;
|
|
9
|
-
signingRegion?: string;
|
|
10
|
-
signingService?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated unused as of EndpointsV2.
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare const bucketHostname: (options: BucketHostnameParams | ArnHostnameParams) => BucketHostname;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import type { ARN } from "@aws-sdk/core/util";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated unused as of EndpointsV2.
|
|
4
|
-
*/
|
|
5
|
-
export declare const DOT_PATTERN: RegExp;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated unused as of EndpointsV2.
|
|
8
|
-
*/
|
|
9
|
-
export declare const S3_HOSTNAME_PATTERN: RegExp;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated unused as of EndpointsV2.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export interface AccessPointArn extends ARN {
|
|
15
|
-
accessPointName: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated unused as of EndpointsV2.
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export interface BucketHostnameParams {
|
|
22
|
-
isCustomEndpoint?: boolean;
|
|
23
|
-
baseHostname: string;
|
|
24
|
-
bucketName: string;
|
|
25
|
-
clientRegion: string;
|
|
26
|
-
accelerateEndpoint?: boolean;
|
|
27
|
-
dualstackEndpoint?: boolean;
|
|
28
|
-
fipsEndpoint?: boolean;
|
|
29
|
-
pathStyleEndpoint?: boolean;
|
|
30
|
-
tlsCompatible?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated unused as of EndpointsV2.
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export interface ArnHostnameParams extends Omit<BucketHostnameParams, "bucketName"> {
|
|
37
|
-
bucketName: ARN;
|
|
38
|
-
clientSigningRegion?: string;
|
|
39
|
-
clientPartition?: string;
|
|
40
|
-
useArnRegion?: boolean;
|
|
41
|
-
disableMultiregionAccessPoints?: boolean;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated unused as of EndpointsV2.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export declare const isBucketNameOptions: (options: BucketHostnameParams | ArnHostnameParams) => options is BucketHostnameParams;
|
|
48
|
-
/**
|
|
49
|
-
* Determines whether a given string is DNS compliant per the rules outlined by
|
|
50
|
-
* S3. Length, capitaization, and leading dot restrictions are enforced by the
|
|
51
|
-
* DOMAIN_PATTERN regular expression.
|
|
52
|
-
* @internal
|
|
53
|
-
*
|
|
54
|
-
* @see https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
|
|
55
|
-
*
|
|
56
|
-
* @deprecated unused as of EndpointsV2.
|
|
57
|
-
*/
|
|
58
|
-
export declare const isDnsCompatibleBucketName: (bucketName: string) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated unused as of EndpointsV2.
|
|
61
|
-
* @internal
|
|
62
|
-
*/
|
|
63
|
-
export declare const getSuffix: (hostname: string) => [string, string];
|
|
64
|
-
/**
|
|
65
|
-
* Infer region and hostname suffix from a complete hostname
|
|
66
|
-
* @internal
|
|
67
|
-
* @param hostname - Hostname
|
|
68
|
-
* @returns [Region, Hostname suffix]
|
|
69
|
-
*
|
|
70
|
-
* @deprecated unused as of EndpointsV2.
|
|
71
|
-
*/
|
|
72
|
-
export declare const getSuffixForArnEndpoint: (hostname: string) => [string, string];
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated unused as of EndpointsV2.
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
export declare const validateArnEndpointOptions: (options: {
|
|
78
|
-
accelerateEndpoint?: boolean;
|
|
79
|
-
tlsCompatible?: boolean;
|
|
80
|
-
pathStyleEndpoint?: boolean;
|
|
81
|
-
}) => void;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated unused as of EndpointsV2.
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
export declare const validateService: (service: string) => void;
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated unused as of EndpointsV2.
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
91
|
-
export declare const validateS3Service: (service: string) => void;
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
export declare const validateOutpostService: (service: string) => void;
|
|
96
|
-
/**
|
|
97
|
-
* Validate partition inferred from ARN is the same to `options.clientPartition`.
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
export declare const validatePartition: (partition: string, options: {
|
|
101
|
-
clientPartition: string;
|
|
102
|
-
}) => void;
|
|
103
|
-
/**
|
|
104
|
-
* (Previous to deprecation)
|
|
105
|
-
* validate region value inferred from ARN. If `options.useArnRegion` is set, it validates the region is not a FIPS
|
|
106
|
-
* region. If `options.useArnRegion` is unset, it validates the region is equal to `options.clientRegion` or
|
|
107
|
-
* `options.clientSigningRegion`.
|
|
108
|
-
*
|
|
109
|
-
* @internal
|
|
110
|
-
*
|
|
111
|
-
* @deprecated validation is deferred to the endpoint ruleset.
|
|
112
|
-
*/
|
|
113
|
-
export declare const validateRegion: (region: string, options: {
|
|
114
|
-
useArnRegion?: boolean;
|
|
115
|
-
allowFipsRegion?: boolean;
|
|
116
|
-
clientRegion: string;
|
|
117
|
-
clientSigningRegion: string;
|
|
118
|
-
useFipsEndpoint: boolean;
|
|
119
|
-
}) => void;
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated unused as of EndpointsV2.
|
|
122
|
-
*/
|
|
123
|
-
export declare const validateRegionalClient: (region: string) => void;
|
|
124
|
-
/**
|
|
125
|
-
* Validate an account ID
|
|
126
|
-
* @internal
|
|
127
|
-
*/
|
|
128
|
-
export declare const validateAccountId: (accountId: string) => void;
|
|
129
|
-
/**
|
|
130
|
-
* Validate a host label according to https://tools.ietf.org/html/rfc3986#section-3.2.2
|
|
131
|
-
* @internal
|
|
132
|
-
* @deprecated unused as of EndpointsV2.
|
|
133
|
-
*/
|
|
134
|
-
export declare const validateDNSHostLabel: (label: string, options?: {
|
|
135
|
-
tlsCompatible?: boolean;
|
|
136
|
-
}) => void;
|
|
137
|
-
/**
|
|
138
|
-
* @deprecated unused as of EndpointsV2.
|
|
139
|
-
*/
|
|
140
|
-
export declare const validateCustomEndpoint: (options: {
|
|
141
|
-
isCustomEndpoint?: boolean;
|
|
142
|
-
dualstackEndpoint?: boolean;
|
|
143
|
-
accelerateEndpoint?: boolean;
|
|
144
|
-
}) => void;
|
|
145
|
-
/**
|
|
146
|
-
* Validate and parse an Access Point ARN or Outposts ARN
|
|
147
|
-
* @internal
|
|
148
|
-
*
|
|
149
|
-
* @param resource - The resource section of an ARN
|
|
150
|
-
* @returns Access Point Name and optional Outpost ID.
|
|
151
|
-
*/
|
|
152
|
-
export declare const getArnResources: (resource: string) => {
|
|
153
|
-
accesspointName: string;
|
|
154
|
-
outpostId?: string;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* (Prior to deprecation) Throw if dual stack configuration is set to true.
|
|
158
|
-
* @internal
|
|
159
|
-
*
|
|
160
|
-
* @deprecated validation deferred to endpoints ruleset.
|
|
161
|
-
*/
|
|
162
|
-
export declare const validateNoDualstack: (dualstackEndpoint?: boolean) => void;
|
|
163
|
-
/**
|
|
164
|
-
* Validate fips endpoint is not set up.
|
|
165
|
-
* @internal
|
|
166
|
-
* @deprecated unused as of EndpointsV2.
|
|
167
|
-
*/
|
|
168
|
-
export declare const validateNoFIPS: (useFipsEndpoint?: boolean) => void;
|
|
169
|
-
/**
|
|
170
|
-
* Validate the multi-region access point alias.
|
|
171
|
-
* @internal
|
|
172
|
-
* @deprecated unused as of EndpointsV2.
|
|
173
|
-
*/
|
|
174
|
-
export declare const validateMrapAlias: (name: string) => void;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { Provider, RegionInfoProvider } from "@smithy/types";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated unused as of EndpointsV2.
|
|
4
|
-
*/
|
|
5
|
-
export interface BucketEndpointInputConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Whether to use the bucket name as the endpoint for this request. The bucket
|
|
8
|
-
* name must be a domain name with a CNAME record alias to an appropriate virtual
|
|
9
|
-
* hosted-style S3 hostname, e.g. a bucket of `images.johnsmith.net` and a DNS
|
|
10
|
-
* record of:
|
|
11
|
-
*
|
|
12
|
-
* ```
|
|
13
|
-
* images.johnsmith.net CNAME images.johnsmith.net.s3.amazonaws.com.
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @see https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#VirtualHostingCustomURLs
|
|
17
|
-
*/
|
|
18
|
-
bucketEndpoint?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* 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>
|
|
21
|
-
*/
|
|
22
|
-
forcePathStyle?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Whether to use the S3 Transfer Acceleration endpoint by default
|
|
25
|
-
*/
|
|
26
|
-
useAccelerateEndpoint?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
|
|
29
|
-
*/
|
|
30
|
-
useArnRegion?: boolean | Provider<boolean>;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to prevent SDK from making cross-region request when supplied bucket is a multi-region access point ARN.
|
|
33
|
-
* Defaults to false
|
|
34
|
-
*/
|
|
35
|
-
disableMultiregionAccessPoints?: boolean | Provider<boolean>;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated unused as of EndpointsV2.
|
|
39
|
-
*/
|
|
40
|
-
interface PreviouslyResolved {
|
|
41
|
-
isCustomEndpoint?: boolean;
|
|
42
|
-
region: Provider<string>;
|
|
43
|
-
regionInfoProvider: RegionInfoProvider;
|
|
44
|
-
useFipsEndpoint: Provider<boolean>;
|
|
45
|
-
useDualstackEndpoint: Provider<boolean>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated unused as of EndpointsV2.
|
|
49
|
-
*/
|
|
50
|
-
export interface BucketEndpointResolvedConfig {
|
|
51
|
-
/**
|
|
52
|
-
* Whether the endpoint is specified by caller.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
isCustomEndpoint?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Resolved value for input config {@link BucketEndpointInputConfig.bucketEndpoint}
|
|
58
|
-
*/
|
|
59
|
-
bucketEndpoint: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Resolved value for input config {@link BucketEndpointInputConfig.forcePathStyle}
|
|
62
|
-
*/
|
|
63
|
-
forcePathStyle: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Resolved value for input config {@link BucketEndpointInputConfig.useAccelerateEndpoint}
|
|
66
|
-
*/
|
|
67
|
-
useAccelerateEndpoint: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Enables FIPS compatible endpoints.
|
|
70
|
-
*/
|
|
71
|
-
useFipsEndpoint: Provider<boolean>;
|
|
72
|
-
/**
|
|
73
|
-
* Enables IPv6/IPv4 dualstack endpoint.
|
|
74
|
-
*/
|
|
75
|
-
useDualstackEndpoint: Provider<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* Resolved value for input config {@link BucketEndpointInputConfig.useArnRegion}
|
|
78
|
-
*/
|
|
79
|
-
useArnRegion: Provider<boolean | undefined>;
|
|
80
|
-
/**
|
|
81
|
-
* Resolved value for input config {@link RegionInputConfig.region}
|
|
82
|
-
*/
|
|
83
|
-
region: Provider<string>;
|
|
84
|
-
/**
|
|
85
|
-
* Fetch related hostname, signing name or signing region with given region.
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
regionInfoProvider: RegionInfoProvider;
|
|
89
|
-
disableMultiregionAccessPoints: Provider<boolean>;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated unused as of EndpointsV2.
|
|
93
|
-
*/
|
|
94
|
-
export declare function resolveBucketEndpointConfig<T>(input: T & PreviouslyResolved & BucketEndpointInputConfig): T & BucketEndpointResolvedConfig;
|
|
95
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
|
-
export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME =
|
|
3
|
-
"AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS";
|
|
4
|
-
export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME =
|
|
5
|
-
"s3_disable_multiregion_access_points";
|
|
6
|
-
export declare const NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
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
|
-
export declare const NODE_USE_ARN_REGION_CONFIG_OPTIONS: LoadedConfigSelectors<
|
|
5
|
-
boolean | undefined
|
|
6
|
-
>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BuildMiddleware,
|
|
3
|
-
Pluggable,
|
|
4
|
-
RelativeMiddlewareOptions,
|
|
5
|
-
} from "@smithy/types";
|
|
6
|
-
import { BucketEndpointResolvedConfig } from "./configurations";
|
|
7
|
-
export declare const bucketEndpointMiddleware: (
|
|
8
|
-
options: BucketEndpointResolvedConfig
|
|
9
|
-
) => BuildMiddleware<any, any>;
|
|
10
|
-
export declare const bucketEndpointMiddlewareOptions: RelativeMiddlewareOptions;
|
|
11
|
-
export declare const getBucketEndpointPlugin: (
|
|
12
|
-
options: BucketEndpointResolvedConfig
|
|
13
|
-
) => Pluggable<any, any>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ArnHostnameParams, BucketHostnameParams } from "./bucketHostnameUtils";
|
|
2
|
-
export interface BucketHostname {
|
|
3
|
-
hostname: string;
|
|
4
|
-
bucketEndpoint: boolean;
|
|
5
|
-
signingRegion?: string;
|
|
6
|
-
signingService?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const bucketHostname: (
|
|
9
|
-
options: BucketHostnameParams | ArnHostnameParams
|
|
10
|
-
) => BucketHostname;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ARN } from "@aws-sdk/core/util";
|
|
2
|
-
export declare const DOT_PATTERN: RegExp;
|
|
3
|
-
export declare const S3_HOSTNAME_PATTERN: RegExp;
|
|
4
|
-
export interface AccessPointArn extends ARN {
|
|
5
|
-
accessPointName: string;
|
|
6
|
-
}
|
|
7
|
-
export interface BucketHostnameParams {
|
|
8
|
-
isCustomEndpoint?: boolean;
|
|
9
|
-
baseHostname: string;
|
|
10
|
-
bucketName: string;
|
|
11
|
-
clientRegion: string;
|
|
12
|
-
accelerateEndpoint?: boolean;
|
|
13
|
-
dualstackEndpoint?: boolean;
|
|
14
|
-
fipsEndpoint?: boolean;
|
|
15
|
-
pathStyleEndpoint?: boolean;
|
|
16
|
-
tlsCompatible?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface ArnHostnameParams
|
|
19
|
-
extends Pick<
|
|
20
|
-
BucketHostnameParams,
|
|
21
|
-
Exclude<keyof BucketHostnameParams, "bucketName">
|
|
22
|
-
> {
|
|
23
|
-
bucketName: ARN;
|
|
24
|
-
clientSigningRegion?: string;
|
|
25
|
-
clientPartition?: string;
|
|
26
|
-
useArnRegion?: boolean;
|
|
27
|
-
disableMultiregionAccessPoints?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare const isBucketNameOptions: (
|
|
30
|
-
options: BucketHostnameParams | ArnHostnameParams
|
|
31
|
-
) => options is BucketHostnameParams;
|
|
32
|
-
export declare const isDnsCompatibleBucketName: (bucketName: string) => boolean;
|
|
33
|
-
export declare const getSuffix: (hostname: string) => [string, string];
|
|
34
|
-
export declare const getSuffixForArnEndpoint: (
|
|
35
|
-
hostname: string
|
|
36
|
-
) => [string, string];
|
|
37
|
-
export declare const validateArnEndpointOptions: (options: {
|
|
38
|
-
accelerateEndpoint?: boolean;
|
|
39
|
-
tlsCompatible?: boolean;
|
|
40
|
-
pathStyleEndpoint?: boolean;
|
|
41
|
-
}) => void;
|
|
42
|
-
export declare const validateService: (service: string) => void;
|
|
43
|
-
export declare const validateS3Service: (service: string) => void;
|
|
44
|
-
export declare const validateOutpostService: (service: string) => void;
|
|
45
|
-
export declare const validatePartition: (
|
|
46
|
-
partition: string,
|
|
47
|
-
options: {
|
|
48
|
-
clientPartition: string;
|
|
49
|
-
}
|
|
50
|
-
) => void;
|
|
51
|
-
export declare const validateRegion: (
|
|
52
|
-
region: string,
|
|
53
|
-
options: {
|
|
54
|
-
useArnRegion?: boolean;
|
|
55
|
-
allowFipsRegion?: boolean;
|
|
56
|
-
clientRegion: string;
|
|
57
|
-
clientSigningRegion: string;
|
|
58
|
-
useFipsEndpoint: boolean;
|
|
59
|
-
}
|
|
60
|
-
) => void;
|
|
61
|
-
export declare const validateRegionalClient: (region: string) => void;
|
|
62
|
-
export declare const validateAccountId: (accountId: string) => void;
|
|
63
|
-
export declare const validateDNSHostLabel: (
|
|
64
|
-
label: string,
|
|
65
|
-
options?: {
|
|
66
|
-
tlsCompatible?: boolean;
|
|
67
|
-
}
|
|
68
|
-
) => void;
|
|
69
|
-
export declare const validateCustomEndpoint: (options: {
|
|
70
|
-
isCustomEndpoint?: boolean;
|
|
71
|
-
dualstackEndpoint?: boolean;
|
|
72
|
-
accelerateEndpoint?: boolean;
|
|
73
|
-
}) => void;
|
|
74
|
-
export declare const getArnResources: (resource: string) => {
|
|
75
|
-
accesspointName: string;
|
|
76
|
-
outpostId?: string;
|
|
77
|
-
};
|
|
78
|
-
export declare const validateNoDualstack: (dualstackEndpoint?: boolean) => void;
|
|
79
|
-
export declare const validateNoFIPS: (useFipsEndpoint?: boolean) => void;
|
|
80
|
-
export declare const validateMrapAlias: (name: string) => void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Provider, RegionInfoProvider } from "@smithy/types";
|
|
2
|
-
export interface BucketEndpointInputConfig {
|
|
3
|
-
bucketEndpoint?: boolean;
|
|
4
|
-
forcePathStyle?: boolean;
|
|
5
|
-
useAccelerateEndpoint?: boolean;
|
|
6
|
-
useArnRegion?: boolean | Provider<boolean>;
|
|
7
|
-
disableMultiregionAccessPoints?: boolean | Provider<boolean>;
|
|
8
|
-
}
|
|
9
|
-
interface PreviouslyResolved {
|
|
10
|
-
isCustomEndpoint?: boolean;
|
|
11
|
-
region: Provider<string>;
|
|
12
|
-
regionInfoProvider: RegionInfoProvider;
|
|
13
|
-
useFipsEndpoint: Provider<boolean>;
|
|
14
|
-
useDualstackEndpoint: Provider<boolean>;
|
|
15
|
-
}
|
|
16
|
-
export interface BucketEndpointResolvedConfig {
|
|
17
|
-
isCustomEndpoint?: boolean;
|
|
18
|
-
bucketEndpoint: boolean;
|
|
19
|
-
forcePathStyle: boolean;
|
|
20
|
-
useAccelerateEndpoint: boolean;
|
|
21
|
-
useFipsEndpoint: Provider<boolean>;
|
|
22
|
-
useDualstackEndpoint: Provider<boolean>;
|
|
23
|
-
useArnRegion: Provider<boolean | undefined>;
|
|
24
|
-
region: Provider<string>;
|
|
25
|
-
regionInfoProvider: RegionInfoProvider;
|
|
26
|
-
disableMultiregionAccessPoints: Provider<boolean>;
|
|
27
|
-
}
|
|
28
|
-
export declare function resolveBucketEndpointConfig<T>(
|
|
29
|
-
input: T & PreviouslyResolved & BucketEndpointInputConfig
|
|
30
|
-
): T & BucketEndpointResolvedConfig;
|
|
31
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./NodeDisableMultiregionAccessPointConfigOptions";
|
|
2
|
-
export * from "./NodeUseArnRegionConfigOptions";
|
|
3
|
-
export * from "./bucketEndpointMiddleware";
|
|
4
|
-
export * from "./bucketHostname";
|
|
5
|
-
export * from "./configurations";
|
|
6
|
-
export {
|
|
7
|
-
getArnResources,
|
|
8
|
-
getSuffixForArnEndpoint,
|
|
9
|
-
validateOutpostService,
|
|
10
|
-
validatePartition,
|
|
11
|
-
validateAccountId,
|
|
12
|
-
validateRegion,
|
|
13
|
-
validateDNSHostLabel,
|
|
14
|
-
validateNoDualstack,
|
|
15
|
-
validateNoFIPS,
|
|
16
|
-
} from "./bucketHostnameUtils";
|