@aws-sdk/middleware-sdk-s3-control 3.489.0 → 3.495.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/dist-cjs/configurations.js +1 -13
- package/dist-cjs/constants.js +1 -8
- package/dist-cjs/host-prefix-deduplication/deduplicateHostPrefix.js +1 -15
- package/dist-cjs/host-prefix-deduplication/hostPrefixDeduplicationMiddleware.js +1 -28
- package/dist-cjs/index.js +302 -13
- package/dist-cjs/process-arnables-plugin/getOutpostEndpoint.js +1 -22
- package/dist-cjs/process-arnables-plugin/getProcessArnablesPlugin.js +1 -12
- package/dist-cjs/process-arnables-plugin/index.js +1 -13
- package/dist-cjs/process-arnables-plugin/parse-outpost-arnables.js +1 -109
- package/dist-cjs/process-arnables-plugin/update-arnables-request.js +1 -32
- package/dist-cjs/redirect-from-postid.js +1 -31
- package/package.json +10 -10
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveS3ControlConfig = exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = void 0;
|
|
4
|
-
var middleware_bucket_endpoint_1 = require("@aws-sdk/middleware-bucket-endpoint");
|
|
5
|
-
Object.defineProperty(exports, "NODE_USE_ARN_REGION_CONFIG_OPTIONS", { enumerable: true, get: function () { return middleware_bucket_endpoint_1.NODE_USE_ARN_REGION_CONFIG_OPTIONS; } });
|
|
6
|
-
function resolveS3ControlConfig(input) {
|
|
7
|
-
const { useArnRegion = false } = input;
|
|
8
|
-
return {
|
|
9
|
-
...input,
|
|
10
|
-
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.resolveS3ControlConfig = resolveS3ControlConfig;
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-cjs/constants.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTEXT_SIGNING_REGION = exports.CONTEXT_SIGNING_SERVICE = exports.CONTEXT_ARN_REGION = exports.CONTEXT_ACCOUNT_ID = exports.CONTEXT_OUTPOST_ID = void 0;
|
|
4
|
-
exports.CONTEXT_OUTPOST_ID = "outpost_id";
|
|
5
|
-
exports.CONTEXT_ACCOUNT_ID = "account_id";
|
|
6
|
-
exports.CONTEXT_ARN_REGION = "outpost_arn_region";
|
|
7
|
-
exports.CONTEXT_SIGNING_SERVICE = "signing_service";
|
|
8
|
-
exports.CONTEXT_SIGNING_REGION = "signing_region";
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deduplicateHostPrefix = void 0;
|
|
4
|
-
const util_endpoints_1 = require("@smithy/util-endpoints");
|
|
5
|
-
const deduplicateHostPrefix = (hostname) => {
|
|
6
|
-
const [p1, p2, p3, p4, ...rest] = hostname.split(".");
|
|
7
|
-
if ((0, util_endpoints_1.isIpAddress)(`${p1}.${p2}.${p3}.${parseInt(p4, 10)}`)) {
|
|
8
|
-
return hostname;
|
|
9
|
-
}
|
|
10
|
-
if (p1 === p2) {
|
|
11
|
-
return [p2, p3, p4, ...rest].join(".");
|
|
12
|
-
}
|
|
13
|
-
return hostname;
|
|
14
|
-
};
|
|
15
|
-
exports.deduplicateHostPrefix = deduplicateHostPrefix;
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHostPrefixDeduplicationPlugin = exports.hostPrefixDeduplicationMiddlewareOptions = exports.hostPrefixDeduplicationMiddleware = void 0;
|
|
4
|
-
const deduplicateHostPrefix_1 = require("./deduplicateHostPrefix");
|
|
5
|
-
const hostPrefixDeduplicationMiddleware = () => {
|
|
6
|
-
return (next, context) => async (args) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const httpRequest = ((_a = args.request) !== null && _a !== void 0 ? _a : {});
|
|
9
|
-
if (httpRequest === null || httpRequest === void 0 ? void 0 : httpRequest.hostname) {
|
|
10
|
-
httpRequest.hostname = (0, deduplicateHostPrefix_1.deduplicateHostPrefix)(httpRequest.hostname);
|
|
11
|
-
}
|
|
12
|
-
return next(args);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.hostPrefixDeduplicationMiddleware = hostPrefixDeduplicationMiddleware;
|
|
16
|
-
exports.hostPrefixDeduplicationMiddlewareOptions = {
|
|
17
|
-
tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
|
|
18
|
-
toMiddleware: "serializerMiddleware",
|
|
19
|
-
relation: "after",
|
|
20
|
-
name: "hostPrefixDeduplicationMiddleware",
|
|
21
|
-
override: true,
|
|
22
|
-
};
|
|
23
|
-
const getHostPrefixDeduplicationPlugin = (config) => ({
|
|
24
|
-
applyToStack: (clientStack) => {
|
|
25
|
-
clientStack.addRelativeTo((0, exports.hostPrefixDeduplicationMiddleware)(), exports.hostPrefixDeduplicationMiddlewareOptions);
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
exports.getHostPrefixDeduplicationPlugin = getHostPrefixDeduplicationPlugin;
|
|
1
|
+
module.exports = require("../index.js");
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,13 +1,302 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
NODE_USE_ARN_REGION_CONFIG_OPTIONS: () => import_middleware_bucket_endpoint.NODE_USE_ARN_REGION_CONFIG_OPTIONS,
|
|
24
|
+
getHostPrefixDeduplicationPlugin: () => getHostPrefixDeduplicationPlugin,
|
|
25
|
+
getProcessArnablesPlugin: () => getProcessArnablesPlugin,
|
|
26
|
+
getRedirectFromPostIdPlugin: () => getRedirectFromPostIdPlugin,
|
|
27
|
+
hostPrefixDeduplicationMiddleware: () => hostPrefixDeduplicationMiddleware,
|
|
28
|
+
hostPrefixDeduplicationMiddlewareOptions: () => hostPrefixDeduplicationMiddlewareOptions,
|
|
29
|
+
parseOutpostArnablesMiddleaware: () => parseOutpostArnablesMiddleaware,
|
|
30
|
+
parseOutpostArnablesMiddleawareOptions: () => parseOutpostArnablesMiddleawareOptions,
|
|
31
|
+
redirectFromPostIdMiddleware: () => redirectFromPostIdMiddleware,
|
|
32
|
+
redirectFromPostIdMiddlewareOptions: () => redirectFromPostIdMiddlewareOptions,
|
|
33
|
+
resolveS3ControlConfig: () => resolveS3ControlConfig,
|
|
34
|
+
updateArnablesRequestMiddleware: () => updateArnablesRequestMiddleware,
|
|
35
|
+
updateArnablesRequestMiddlewareOptions: () => updateArnablesRequestMiddlewareOptions
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
38
|
+
|
|
39
|
+
// src/configurations.ts
|
|
40
|
+
var import_middleware_bucket_endpoint = require("@aws-sdk/middleware-bucket-endpoint");
|
|
41
|
+
function resolveS3ControlConfig(input) {
|
|
42
|
+
const { useArnRegion = false } = input;
|
|
43
|
+
return {
|
|
44
|
+
...input,
|
|
45
|
+
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
__name(resolveS3ControlConfig, "resolveS3ControlConfig");
|
|
49
|
+
|
|
50
|
+
// src/process-arnables-plugin/parse-outpost-arnables.ts
|
|
51
|
+
|
|
52
|
+
var import_util_arn_parser = require("@aws-sdk/util-arn-parser");
|
|
53
|
+
var import_util_endpoints = require("@aws-sdk/util-endpoints");
|
|
54
|
+
|
|
55
|
+
// src/constants.ts
|
|
56
|
+
var CONTEXT_OUTPOST_ID = "outpost_id";
|
|
57
|
+
var CONTEXT_ACCOUNT_ID = "account_id";
|
|
58
|
+
var CONTEXT_ARN_REGION = "outpost_arn_region";
|
|
59
|
+
var CONTEXT_SIGNING_SERVICE = "signing_service";
|
|
60
|
+
var CONTEXT_SIGNING_REGION = "signing_region";
|
|
61
|
+
|
|
62
|
+
// src/process-arnables-plugin/parse-outpost-arnables.ts
|
|
63
|
+
var parseOutpostArnablesMiddleaware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => {
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
|
+
const { input } = args;
|
|
66
|
+
const parameter = input.Name && (0, import_util_arn_parser.validate)(input.Name) ? "Name" : input.Bucket && (0, import_util_arn_parser.validate)(input.Bucket) ? "Bucket" : void 0;
|
|
67
|
+
if (!parameter)
|
|
68
|
+
return next(args);
|
|
69
|
+
const clientRegion = await options.region();
|
|
70
|
+
const useArnRegion = await options.useArnRegion();
|
|
71
|
+
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
72
|
+
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
73
|
+
const baseRegion = clientRegion;
|
|
74
|
+
let clientPartition;
|
|
75
|
+
let signingRegion;
|
|
76
|
+
if (options.regionInfoProvider) {
|
|
77
|
+
({ partition: clientPartition, signingRegion = baseRegion } = await options.regionInfoProvider(baseRegion, {
|
|
78
|
+
useFipsEndpoint,
|
|
79
|
+
useDualstackEndpoint
|
|
80
|
+
}));
|
|
81
|
+
} else {
|
|
82
|
+
signingRegion = ((_d = (_c = (_b = (_a = context.endpointV2) == null ? void 0 : _a.properties) == null ? void 0 : _b.authSchemes) == null ? void 0 : _c[0]) == null ? void 0 : _d.signingRegion) || baseRegion;
|
|
83
|
+
clientPartition = (0, import_util_endpoints.partition)(signingRegion).name;
|
|
84
|
+
}
|
|
85
|
+
const validatorOptions = {
|
|
86
|
+
useFipsEndpoint,
|
|
87
|
+
useDualstackEndpoint,
|
|
88
|
+
clientRegion,
|
|
89
|
+
clientPartition,
|
|
90
|
+
signingRegion,
|
|
91
|
+
useArnRegion
|
|
92
|
+
};
|
|
93
|
+
let arn;
|
|
94
|
+
if (parameter === "Name") {
|
|
95
|
+
arn = (0, import_util_arn_parser.parse)(input.Name);
|
|
96
|
+
validateOutpostsArn(arn, validatorOptions);
|
|
97
|
+
const { outpostId, accesspointName } = parseOutpostsAccessPointArnResource(arn.resource);
|
|
98
|
+
input.Name = accesspointName;
|
|
99
|
+
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
100
|
+
} else {
|
|
101
|
+
arn = (0, import_util_arn_parser.parse)(input.Bucket);
|
|
102
|
+
validateOutpostsArn(arn, validatorOptions);
|
|
103
|
+
const { outpostId, bucketName } = parseOutpostBucketArnResource(arn.resource);
|
|
104
|
+
input.Bucket = bucketName;
|
|
105
|
+
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
106
|
+
}
|
|
107
|
+
context[CONTEXT_SIGNING_SERVICE] = arn.service;
|
|
108
|
+
context[CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
|
|
109
|
+
if (!input.AccountId) {
|
|
110
|
+
input.AccountId = arn.accountId;
|
|
111
|
+
} else if (input.AccountId !== arn.accountId) {
|
|
112
|
+
throw new Error(`AccountId is incompatible with account id inferred from ${parameter}`);
|
|
113
|
+
}
|
|
114
|
+
if (useArnRegion)
|
|
115
|
+
context[CONTEXT_ARN_REGION] = arn.region;
|
|
116
|
+
return next(args);
|
|
117
|
+
}, "parseOutpostArnablesMiddleaware");
|
|
118
|
+
var parseOutpostArnablesMiddleawareOptions = {
|
|
119
|
+
step: "initialize",
|
|
120
|
+
tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
|
|
121
|
+
name: "parseOutpostArnablesMiddleaware"
|
|
122
|
+
};
|
|
123
|
+
var validateOutpostsArn = /* @__PURE__ */ __name((arn, {
|
|
124
|
+
clientRegion,
|
|
125
|
+
signingRegion,
|
|
126
|
+
clientPartition,
|
|
127
|
+
useArnRegion,
|
|
128
|
+
useFipsEndpoint,
|
|
129
|
+
useDualstackEndpoint
|
|
130
|
+
}) => {
|
|
131
|
+
const { service, partition: partition2, accountId, region } = arn;
|
|
132
|
+
(0, import_middleware_bucket_endpoint.validateOutpostService)(service);
|
|
133
|
+
(0, import_middleware_bucket_endpoint.validatePartition)(partition2, { clientPartition });
|
|
134
|
+
(0, import_middleware_bucket_endpoint.validateAccountId)(accountId);
|
|
135
|
+
(0, import_middleware_bucket_endpoint.validateRegion)(region, {
|
|
136
|
+
useArnRegion,
|
|
137
|
+
clientRegion,
|
|
138
|
+
clientSigningRegion: signingRegion,
|
|
139
|
+
useFipsEndpoint,
|
|
140
|
+
allowFipsRegion: true
|
|
141
|
+
});
|
|
142
|
+
(0, import_middleware_bucket_endpoint.validateNoDualstack)(useDualstackEndpoint);
|
|
143
|
+
}, "validateOutpostsArn");
|
|
144
|
+
var parseOutpostsAccessPointArnResource = /* @__PURE__ */ __name((resource) => {
|
|
145
|
+
const { outpostId, accesspointName } = (0, import_middleware_bucket_endpoint.getArnResources)(resource);
|
|
146
|
+
if (!outpostId) {
|
|
147
|
+
throw new Error("ARN resource should begin with 'outpost'");
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
outpostId,
|
|
151
|
+
accesspointName
|
|
152
|
+
};
|
|
153
|
+
}, "parseOutpostsAccessPointArnResource");
|
|
154
|
+
var parseOutpostBucketArnResource = /* @__PURE__ */ __name((resource) => {
|
|
155
|
+
const delimiter = resource.includes(":") ? ":" : "/";
|
|
156
|
+
const [resourceType, ...rest] = resource.split(delimiter);
|
|
157
|
+
if (resourceType === "outpost") {
|
|
158
|
+
if (!rest[0] || rest[1] !== "bucket" || !rest[2] || rest.length !== 3) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`Outpost Bucket ARN should have resource outpost${delimiter}{outpostId}${delimiter}bucket${delimiter}{bucketName}`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const [outpostId, _, bucketName] = rest;
|
|
164
|
+
return { outpostId, bucketName };
|
|
165
|
+
} else {
|
|
166
|
+
throw new Error(`ARN resource should begin with 'outpost${delimiter}'`);
|
|
167
|
+
}
|
|
168
|
+
}, "parseOutpostBucketArnResource");
|
|
169
|
+
|
|
170
|
+
// src/process-arnables-plugin/update-arnables-request.ts
|
|
171
|
+
var import_protocol_http = require("@smithy/protocol-http");
|
|
172
|
+
|
|
173
|
+
// src/process-arnables-plugin/getOutpostEndpoint.ts
|
|
174
|
+
var REGEX_S3CONTROL_HOSTNAME = /^(.+\.)?s3-control(-fips)?[.-]([a-z0-9-]+)\./;
|
|
175
|
+
var getOutpostEndpoint = /* @__PURE__ */ __name((hostname, { isCustomEndpoint, regionOverride, useFipsEndpoint }) => {
|
|
176
|
+
if (isCustomEndpoint) {
|
|
177
|
+
return hostname;
|
|
178
|
+
}
|
|
179
|
+
const match = hostname.match(REGEX_S3CONTROL_HOSTNAME);
|
|
180
|
+
if (!match) {
|
|
181
|
+
return hostname;
|
|
182
|
+
}
|
|
183
|
+
const [matched, prefix, fips, region] = hostname.match(REGEX_S3CONTROL_HOSTNAME);
|
|
184
|
+
return [
|
|
185
|
+
`s3-outposts${useFipsEndpoint ? "-fips" : ""}`,
|
|
186
|
+
regionOverride || region,
|
|
187
|
+
hostname.replace(new RegExp(`^${matched}`), "")
|
|
188
|
+
].filter((part) => part !== void 0).join(".");
|
|
189
|
+
}, "getOutpostEndpoint");
|
|
190
|
+
|
|
191
|
+
// src/process-arnables-plugin/update-arnables-request.ts
|
|
192
|
+
var ACCOUNT_ID_HEADER = "x-amz-account-id";
|
|
193
|
+
var OUTPOST_ID_HEADER = "x-amz-outpost-id";
|
|
194
|
+
var updateArnablesRequestMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => {
|
|
195
|
+
const { request } = args;
|
|
196
|
+
if (!import_protocol_http.HttpRequest.isInstance(request))
|
|
197
|
+
return next(args);
|
|
198
|
+
if (context[CONTEXT_ACCOUNT_ID])
|
|
199
|
+
request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
|
|
200
|
+
if (context[CONTEXT_OUTPOST_ID]) {
|
|
201
|
+
const { isCustomEndpoint } = config;
|
|
202
|
+
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
203
|
+
request.headers[OUTPOST_ID_HEADER] = context[CONTEXT_OUTPOST_ID];
|
|
204
|
+
request.hostname = getOutpostEndpoint(request.hostname, {
|
|
205
|
+
isCustomEndpoint,
|
|
206
|
+
regionOverride: context[CONTEXT_ARN_REGION],
|
|
207
|
+
useFipsEndpoint
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return next(args);
|
|
211
|
+
}, "updateArnablesRequestMiddleware");
|
|
212
|
+
var updateArnablesRequestMiddlewareOptions = {
|
|
213
|
+
step: "build",
|
|
214
|
+
name: "updateArnablesRequestMiddleware",
|
|
215
|
+
tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"]
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// src/process-arnables-plugin/getProcessArnablesPlugin.ts
|
|
219
|
+
var getProcessArnablesPlugin = /* @__PURE__ */ __name((options) => ({
|
|
220
|
+
applyToStack: (clientStack) => {
|
|
221
|
+
clientStack.add(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
|
|
222
|
+
clientStack.add(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
|
|
223
|
+
}
|
|
224
|
+
}), "getProcessArnablesPlugin");
|
|
225
|
+
|
|
226
|
+
// src/host-prefix-deduplication/deduplicateHostPrefix.ts
|
|
227
|
+
var import_util_endpoints2 = require("@smithy/util-endpoints");
|
|
228
|
+
var deduplicateHostPrefix = /* @__PURE__ */ __name((hostname) => {
|
|
229
|
+
const [p1, p2, p3, p4, ...rest] = hostname.split(".");
|
|
230
|
+
if ((0, import_util_endpoints2.isIpAddress)(`${p1}.${p2}.${p3}.${parseInt(p4, 10)}`)) {
|
|
231
|
+
return hostname;
|
|
232
|
+
}
|
|
233
|
+
if (p1 === p2) {
|
|
234
|
+
return [p2, p3, p4, ...rest].join(".");
|
|
235
|
+
}
|
|
236
|
+
return hostname;
|
|
237
|
+
}, "deduplicateHostPrefix");
|
|
238
|
+
|
|
239
|
+
// src/host-prefix-deduplication/hostPrefixDeduplicationMiddleware.ts
|
|
240
|
+
var hostPrefixDeduplicationMiddleware = /* @__PURE__ */ __name(() => {
|
|
241
|
+
return (next, context) => async (args) => {
|
|
242
|
+
const httpRequest = args.request ?? {};
|
|
243
|
+
if (httpRequest == null ? void 0 : httpRequest.hostname) {
|
|
244
|
+
httpRequest.hostname = deduplicateHostPrefix(httpRequest.hostname);
|
|
245
|
+
}
|
|
246
|
+
return next(args);
|
|
247
|
+
};
|
|
248
|
+
}, "hostPrefixDeduplicationMiddleware");
|
|
249
|
+
var hostPrefixDeduplicationMiddlewareOptions = {
|
|
250
|
+
tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
|
|
251
|
+
toMiddleware: "serializerMiddleware",
|
|
252
|
+
relation: "after",
|
|
253
|
+
name: "hostPrefixDeduplicationMiddleware",
|
|
254
|
+
override: true
|
|
255
|
+
};
|
|
256
|
+
var getHostPrefixDeduplicationPlugin = /* @__PURE__ */ __name((config) => ({
|
|
257
|
+
applyToStack: (clientStack) => {
|
|
258
|
+
clientStack.addRelativeTo(hostPrefixDeduplicationMiddleware(), hostPrefixDeduplicationMiddlewareOptions);
|
|
259
|
+
}
|
|
260
|
+
}), "getHostPrefixDeduplicationPlugin");
|
|
261
|
+
|
|
262
|
+
// src/redirect-from-postid.ts
|
|
263
|
+
|
|
264
|
+
var redirectFromPostIdMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => {
|
|
265
|
+
const { input, request } = args;
|
|
266
|
+
if (!import_protocol_http.HttpRequest.isInstance(request))
|
|
267
|
+
return next(args);
|
|
268
|
+
if (input.OutpostId) {
|
|
269
|
+
const { isCustomEndpoint } = config;
|
|
270
|
+
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
271
|
+
request.hostname = getOutpostEndpoint(request.hostname, { isCustomEndpoint, useFipsEndpoint });
|
|
272
|
+
context[CONTEXT_SIGNING_SERVICE] = "s3-outposts";
|
|
273
|
+
}
|
|
274
|
+
return next(args);
|
|
275
|
+
}, "redirectFromPostIdMiddleware");
|
|
276
|
+
var redirectFromPostIdMiddlewareOptions = {
|
|
277
|
+
step: "build",
|
|
278
|
+
name: "redirectFromPostIdMiddleware",
|
|
279
|
+
tags: ["OUTPOST"],
|
|
280
|
+
override: true
|
|
281
|
+
};
|
|
282
|
+
var getRedirectFromPostIdPlugin = /* @__PURE__ */ __name((options) => ({
|
|
283
|
+
applyToStack: (clientStack) => {
|
|
284
|
+
clientStack.add(redirectFromPostIdMiddleware(options), redirectFromPostIdMiddlewareOptions);
|
|
285
|
+
}
|
|
286
|
+
}), "getRedirectFromPostIdPlugin");
|
|
287
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
288
|
+
0 && (module.exports = {
|
|
289
|
+
NODE_USE_ARN_REGION_CONFIG_OPTIONS,
|
|
290
|
+
getHostPrefixDeduplicationPlugin,
|
|
291
|
+
getProcessArnablesPlugin,
|
|
292
|
+
getRedirectFromPostIdPlugin,
|
|
293
|
+
hostPrefixDeduplicationMiddleware,
|
|
294
|
+
hostPrefixDeduplicationMiddlewareOptions,
|
|
295
|
+
parseOutpostArnablesMiddleaware,
|
|
296
|
+
parseOutpostArnablesMiddleawareOptions,
|
|
297
|
+
redirectFromPostIdMiddleware,
|
|
298
|
+
redirectFromPostIdMiddlewareOptions,
|
|
299
|
+
resolveS3ControlConfig,
|
|
300
|
+
updateArnablesRequestMiddleware,
|
|
301
|
+
updateArnablesRequestMiddlewareOptions
|
|
302
|
+
});
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOutpostEndpoint = void 0;
|
|
4
|
-
const REGEX_S3CONTROL_HOSTNAME = /^(.+\.)?s3-control(-fips)?[.-]([a-z0-9-]+)\./;
|
|
5
|
-
const getOutpostEndpoint = (hostname, { isCustomEndpoint, regionOverride, useFipsEndpoint }) => {
|
|
6
|
-
if (isCustomEndpoint) {
|
|
7
|
-
return hostname;
|
|
8
|
-
}
|
|
9
|
-
const match = hostname.match(REGEX_S3CONTROL_HOSTNAME);
|
|
10
|
-
if (!match) {
|
|
11
|
-
return hostname;
|
|
12
|
-
}
|
|
13
|
-
const [matched, prefix, fips, region] = hostname.match(REGEX_S3CONTROL_HOSTNAME);
|
|
14
|
-
return [
|
|
15
|
-
`s3-outposts${useFipsEndpoint ? "-fips" : ""}`,
|
|
16
|
-
regionOverride || region,
|
|
17
|
-
hostname.replace(new RegExp(`^${matched}`), ""),
|
|
18
|
-
]
|
|
19
|
-
.filter((part) => part !== undefined)
|
|
20
|
-
.join(".");
|
|
21
|
-
};
|
|
22
|
-
exports.getOutpostEndpoint = getOutpostEndpoint;
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProcessArnablesPlugin = void 0;
|
|
4
|
-
const parse_outpost_arnables_1 = require("./parse-outpost-arnables");
|
|
5
|
-
const update_arnables_request_1 = require("./update-arnables-request");
|
|
6
|
-
const getProcessArnablesPlugin = (options) => ({
|
|
7
|
-
applyToStack: (clientStack) => {
|
|
8
|
-
clientStack.add((0, parse_outpost_arnables_1.parseOutpostArnablesMiddleaware)(options), parse_outpost_arnables_1.parseOutpostArnablesMiddleawareOptions);
|
|
9
|
-
clientStack.add((0, update_arnables_request_1.updateArnablesRequestMiddleware)(options), update_arnables_request_1.updateArnablesRequestMiddlewareOptions);
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
exports.getProcessArnablesPlugin = getProcessArnablesPlugin;
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOutpostEndpoint = exports.updateArnablesRequestMiddlewareOptions = exports.updateArnablesRequestMiddleware = exports.parseOutpostArnablesMiddleawareOptions = exports.parseOutpostArnablesMiddleaware = exports.getProcessArnablesPlugin = void 0;
|
|
4
|
-
var getProcessArnablesPlugin_1 = require("./getProcessArnablesPlugin");
|
|
5
|
-
Object.defineProperty(exports, "getProcessArnablesPlugin", { enumerable: true, get: function () { return getProcessArnablesPlugin_1.getProcessArnablesPlugin; } });
|
|
6
|
-
var parse_outpost_arnables_1 = require("./parse-outpost-arnables");
|
|
7
|
-
Object.defineProperty(exports, "parseOutpostArnablesMiddleaware", { enumerable: true, get: function () { return parse_outpost_arnables_1.parseOutpostArnablesMiddleaware; } });
|
|
8
|
-
Object.defineProperty(exports, "parseOutpostArnablesMiddleawareOptions", { enumerable: true, get: function () { return parse_outpost_arnables_1.parseOutpostArnablesMiddleawareOptions; } });
|
|
9
|
-
var update_arnables_request_1 = require("./update-arnables-request");
|
|
10
|
-
Object.defineProperty(exports, "updateArnablesRequestMiddleware", { enumerable: true, get: function () { return update_arnables_request_1.updateArnablesRequestMiddleware; } });
|
|
11
|
-
Object.defineProperty(exports, "updateArnablesRequestMiddlewareOptions", { enumerable: true, get: function () { return update_arnables_request_1.updateArnablesRequestMiddlewareOptions; } });
|
|
12
|
-
var getOutpostEndpoint_1 = require("./getOutpostEndpoint");
|
|
13
|
-
Object.defineProperty(exports, "getOutpostEndpoint", { enumerable: true, get: function () { return getOutpostEndpoint_1.getOutpostEndpoint; } });
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,109 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseOutpostArnablesMiddleawareOptions = exports.parseOutpostArnablesMiddleaware = void 0;
|
|
4
|
-
const middleware_bucket_endpoint_1 = require("@aws-sdk/middleware-bucket-endpoint");
|
|
5
|
-
const util_arn_parser_1 = require("@aws-sdk/util-arn-parser");
|
|
6
|
-
const util_endpoints_1 = require("@aws-sdk/util-endpoints");
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (args) => {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
|
-
const { input } = args;
|
|
11
|
-
const parameter = input.Name && (0, util_arn_parser_1.validate)(input.Name) ? "Name" : input.Bucket && (0, util_arn_parser_1.validate)(input.Bucket) ? "Bucket" : undefined;
|
|
12
|
-
if (!parameter)
|
|
13
|
-
return next(args);
|
|
14
|
-
const clientRegion = await options.region();
|
|
15
|
-
const useArnRegion = await options.useArnRegion();
|
|
16
|
-
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
17
|
-
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
18
|
-
const baseRegion = clientRegion;
|
|
19
|
-
let clientPartition;
|
|
20
|
-
let signingRegion;
|
|
21
|
-
if (options.regionInfoProvider) {
|
|
22
|
-
({ partition: clientPartition, signingRegion = baseRegion } = (await options.regionInfoProvider(baseRegion, {
|
|
23
|
-
useFipsEndpoint,
|
|
24
|
-
useDualstackEndpoint,
|
|
25
|
-
})));
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
signingRegion = ((_d = (_c = (_b = (_a = context.endpointV2) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.authSchemes) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.signingRegion) || baseRegion;
|
|
29
|
-
clientPartition = (0, util_endpoints_1.partition)(signingRegion).name;
|
|
30
|
-
}
|
|
31
|
-
const validatorOptions = {
|
|
32
|
-
useFipsEndpoint,
|
|
33
|
-
useDualstackEndpoint,
|
|
34
|
-
clientRegion,
|
|
35
|
-
clientPartition,
|
|
36
|
-
signingRegion,
|
|
37
|
-
useArnRegion,
|
|
38
|
-
};
|
|
39
|
-
let arn;
|
|
40
|
-
if (parameter === "Name") {
|
|
41
|
-
arn = (0, util_arn_parser_1.parse)(input.Name);
|
|
42
|
-
validateOutpostsArn(arn, validatorOptions);
|
|
43
|
-
const { outpostId, accesspointName } = parseOutpostsAccessPointArnResource(arn.resource);
|
|
44
|
-
input.Name = accesspointName;
|
|
45
|
-
context[constants_1.CONTEXT_OUTPOST_ID] = outpostId;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
arn = (0, util_arn_parser_1.parse)(input.Bucket);
|
|
49
|
-
validateOutpostsArn(arn, validatorOptions);
|
|
50
|
-
const { outpostId, bucketName } = parseOutpostBucketArnResource(arn.resource);
|
|
51
|
-
input.Bucket = bucketName;
|
|
52
|
-
context[constants_1.CONTEXT_OUTPOST_ID] = outpostId;
|
|
53
|
-
}
|
|
54
|
-
context[constants_1.CONTEXT_SIGNING_SERVICE] = arn.service;
|
|
55
|
-
context[constants_1.CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
|
|
56
|
-
if (!input.AccountId) {
|
|
57
|
-
input.AccountId = arn.accountId;
|
|
58
|
-
}
|
|
59
|
-
else if (input.AccountId !== arn.accountId) {
|
|
60
|
-
throw new Error(`AccountId is incompatible with account id inferred from ${parameter}`);
|
|
61
|
-
}
|
|
62
|
-
if (useArnRegion)
|
|
63
|
-
context[constants_1.CONTEXT_ARN_REGION] = arn.region;
|
|
64
|
-
return next(args);
|
|
65
|
-
};
|
|
66
|
-
exports.parseOutpostArnablesMiddleaware = parseOutpostArnablesMiddleaware;
|
|
67
|
-
exports.parseOutpostArnablesMiddleawareOptions = {
|
|
68
|
-
step: "initialize",
|
|
69
|
-
tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
|
|
70
|
-
name: "parseOutpostArnablesMiddleaware",
|
|
71
|
-
};
|
|
72
|
-
const validateOutpostsArn = (arn, { clientRegion, signingRegion, clientPartition, useArnRegion, useFipsEndpoint, useDualstackEndpoint, }) => {
|
|
73
|
-
const { service, partition, accountId, region } = arn;
|
|
74
|
-
(0, middleware_bucket_endpoint_1.validateOutpostService)(service);
|
|
75
|
-
(0, middleware_bucket_endpoint_1.validatePartition)(partition, { clientPartition });
|
|
76
|
-
(0, middleware_bucket_endpoint_1.validateAccountId)(accountId);
|
|
77
|
-
(0, middleware_bucket_endpoint_1.validateRegion)(region, {
|
|
78
|
-
useArnRegion,
|
|
79
|
-
clientRegion,
|
|
80
|
-
clientSigningRegion: signingRegion,
|
|
81
|
-
useFipsEndpoint,
|
|
82
|
-
allowFipsRegion: true,
|
|
83
|
-
});
|
|
84
|
-
(0, middleware_bucket_endpoint_1.validateNoDualstack)(useDualstackEndpoint);
|
|
85
|
-
};
|
|
86
|
-
const parseOutpostsAccessPointArnResource = (resource) => {
|
|
87
|
-
const { outpostId, accesspointName } = (0, middleware_bucket_endpoint_1.getArnResources)(resource);
|
|
88
|
-
if (!outpostId) {
|
|
89
|
-
throw new Error("ARN resource should begin with 'outpost'");
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
outpostId,
|
|
93
|
-
accesspointName,
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
const parseOutpostBucketArnResource = (resource) => {
|
|
97
|
-
const delimiter = resource.includes(":") ? ":" : "/";
|
|
98
|
-
const [resourceType, ...rest] = resource.split(delimiter);
|
|
99
|
-
if (resourceType === "outpost") {
|
|
100
|
-
if (!rest[0] || rest[1] !== "bucket" || !rest[2] || rest.length !== 3) {
|
|
101
|
-
throw new Error(`Outpost Bucket ARN should have resource outpost${delimiter}{outpostId}${delimiter}bucket${delimiter}{bucketName}`);
|
|
102
|
-
}
|
|
103
|
-
const [outpostId, _, bucketName] = rest;
|
|
104
|
-
return { outpostId, bucketName };
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
throw new Error(`ARN resource should begin with 'outpost${delimiter}'`);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateArnablesRequestMiddlewareOptions = exports.updateArnablesRequestMiddleware = void 0;
|
|
4
|
-
const protocol_http_1 = require("@smithy/protocol-http");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const getOutpostEndpoint_1 = require("./getOutpostEndpoint");
|
|
7
|
-
const ACCOUNT_ID_HEADER = "x-amz-account-id";
|
|
8
|
-
const OUTPOST_ID_HEADER = "x-amz-outpost-id";
|
|
9
|
-
const updateArnablesRequestMiddleware = (config) => (next, context) => async (args) => {
|
|
10
|
-
const { request } = args;
|
|
11
|
-
if (!protocol_http_1.HttpRequest.isInstance(request))
|
|
12
|
-
return next(args);
|
|
13
|
-
if (context[constants_1.CONTEXT_ACCOUNT_ID])
|
|
14
|
-
request.headers[ACCOUNT_ID_HEADER] = context[constants_1.CONTEXT_ACCOUNT_ID];
|
|
15
|
-
if (context[constants_1.CONTEXT_OUTPOST_ID]) {
|
|
16
|
-
const { isCustomEndpoint } = config;
|
|
17
|
-
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
18
|
-
request.headers[OUTPOST_ID_HEADER] = context[constants_1.CONTEXT_OUTPOST_ID];
|
|
19
|
-
request.hostname = (0, getOutpostEndpoint_1.getOutpostEndpoint)(request.hostname, {
|
|
20
|
-
isCustomEndpoint,
|
|
21
|
-
regionOverride: context[constants_1.CONTEXT_ARN_REGION],
|
|
22
|
-
useFipsEndpoint,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return next(args);
|
|
26
|
-
};
|
|
27
|
-
exports.updateArnablesRequestMiddleware = updateArnablesRequestMiddleware;
|
|
28
|
-
exports.updateArnablesRequestMiddlewareOptions = {
|
|
29
|
-
step: "build",
|
|
30
|
-
name: "updateArnablesRequestMiddleware",
|
|
31
|
-
tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"],
|
|
32
|
-
};
|
|
1
|
+
module.exports = require("../index.js");
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRedirectFromPostIdPlugin = exports.redirectFromPostIdMiddlewareOptions = exports.redirectFromPostIdMiddleware = void 0;
|
|
4
|
-
const protocol_http_1 = require("@smithy/protocol-http");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const process_arnables_plugin_1 = require("./process-arnables-plugin");
|
|
7
|
-
const redirectFromPostIdMiddleware = (config) => (next, context) => async (args) => {
|
|
8
|
-
const { input, request } = args;
|
|
9
|
-
if (!protocol_http_1.HttpRequest.isInstance(request))
|
|
10
|
-
return next(args);
|
|
11
|
-
if (input.OutpostId) {
|
|
12
|
-
const { isCustomEndpoint } = config;
|
|
13
|
-
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
14
|
-
request.hostname = (0, process_arnables_plugin_1.getOutpostEndpoint)(request.hostname, { isCustomEndpoint, useFipsEndpoint });
|
|
15
|
-
context[constants_1.CONTEXT_SIGNING_SERVICE] = "s3-outposts";
|
|
16
|
-
}
|
|
17
|
-
return next(args);
|
|
18
|
-
};
|
|
19
|
-
exports.redirectFromPostIdMiddleware = redirectFromPostIdMiddleware;
|
|
20
|
-
exports.redirectFromPostIdMiddlewareOptions = {
|
|
21
|
-
step: "build",
|
|
22
|
-
name: "redirectFromPostIdMiddleware",
|
|
23
|
-
tags: ["OUTPOST"],
|
|
24
|
-
override: true,
|
|
25
|
-
};
|
|
26
|
-
const getRedirectFromPostIdPlugin = (options) => ({
|
|
27
|
-
applyToStack: (clientStack) => {
|
|
28
|
-
clientStack.add((0, exports.redirectFromPostIdMiddleware)(options), exports.redirectFromPostIdMiddlewareOptions);
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
exports.getRedirectFromPostIdPlugin = getRedirectFromPostIdPlugin;
|
|
1
|
+
module.exports = require("./index.js");
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3-control",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.495.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
|
-
"build:cjs": "
|
|
6
|
+
"build:cjs": "node ../../scripts/compilation/inline middleware-sdk-s3-control",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/middleware-bucket-endpoint": "3.
|
|
26
|
-
"@aws-sdk/types": "3.
|
|
27
|
-
"@aws-sdk/util-arn-parser": "3.
|
|
28
|
-
"@aws-sdk/util-endpoints": "3.
|
|
29
|
-
"@smithy/protocol-http": "^3.0
|
|
30
|
-
"@smithy/types": "^2.
|
|
31
|
-
"@smithy/util-endpoints": "^1.0
|
|
25
|
+
"@aws-sdk/middleware-bucket-endpoint": "3.495.0",
|
|
26
|
+
"@aws-sdk/types": "3.495.0",
|
|
27
|
+
"@aws-sdk/util-arn-parser": "3.495.0",
|
|
28
|
+
"@aws-sdk/util-endpoints": "3.495.0",
|
|
29
|
+
"@smithy/protocol-http": "^3.1.0",
|
|
30
|
+
"@smithy/types": "^2.9.0",
|
|
31
|
+
"@smithy/util-endpoints": "^1.1.0",
|
|
32
32
|
"tslib": "^2.5.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@smithy/middleware-stack": "^2.0
|
|
35
|
+
"@smithy/middleware-stack": "^2.1.0",
|
|
36
36
|
"@tsconfig/recommended": "1.0.1",
|
|
37
37
|
"concurrently": "7.0.0",
|
|
38
38
|
"downlevel-dts": "0.10.1",
|