@aws-sdk/middleware-sdk-s3-control 3.186.0 → 3.190.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist-cjs/process-arnables-plugin/parse-outpost-arnables.js +14 -4
- package/dist-es/configurations.js +5 -3
- package/dist-es/constants.js +5 -5
- package/dist-es/process-arnables-plugin/getOutpostEndpoint.js +6 -8
- package/dist-es/process-arnables-plugin/parse-outpost-arnables.js +74 -86
- package/dist-es/process-arnables-plugin/plugin.js +3 -3
- package/dist-es/process-arnables-plugin/update-arnables-request.js +20 -33
- package/dist-es/redirect-from-postid.js +15 -28
- package/dist-types/configurations.d.ts +4 -4
- package/dist-types/process-arnables-plugin/update-arnables-request.d.ts +1 -1
- package/dist-types/redirect-from-postid.d.ts +1 -1
- package/dist-types/ts3.4/configurations.d.ts +4 -4
- package/dist-types/ts3.4/process-arnables-plugin/update-arnables-request.d.ts +1 -1
- package/dist-types/ts3.4/redirect-from-postid.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **endpoint:** e2e test fixes for endpoints 2.0 all services ([#4044](https://github.com/aws/aws-sdk-js-v3/issues/4044)) ([b53f5bd](https://github.com/aws/aws-sdk-js-v3/commit/b53f5bdd2bb4f0d1bab208ef2cd8f67d56291934))
|
|
12
|
+
* **endpoint:** endpoints 2.0 all-service TS compilation fixes ([#4043](https://github.com/aws/aws-sdk-js-v3/issues/4043)) ([f2da618](https://github.com/aws/aws-sdk-js-v3/commit/f2da6182298d4d6b02e84fb723492c07c27469a8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-s3-control
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @aws-sdk/middleware-sdk-s3-control
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseOutpostArnablesMiddleawareOptions = exports.parseOutpostArnablesMiddleaware = void 0;
|
|
4
4
|
const middleware_bucket_endpoint_1 = require("@aws-sdk/middleware-bucket-endpoint");
|
|
5
5
|
const util_arn_parser_1 = require("@aws-sdk/util-arn-parser");
|
|
6
|
+
const util_endpoints_1 = require("@aws-sdk/util-endpoints");
|
|
6
7
|
const constants_1 = require("../constants");
|
|
7
8
|
const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (args) => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
8
10
|
const { input } = args;
|
|
9
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;
|
|
10
12
|
if (!parameter)
|
|
@@ -14,10 +16,18 @@ const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (a
|
|
|
14
16
|
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
15
17
|
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
16
18
|
const baseRegion = clientRegion;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
31
|
const validatorOptions = {
|
|
22
32
|
useFipsEndpoint,
|
|
23
33
|
useDualstackEndpoint,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
|
|
3
2
|
export function resolveS3ControlConfig(input) {
|
|
4
|
-
|
|
5
|
-
return
|
|
3
|
+
const { useArnRegion = false } = input;
|
|
4
|
+
return {
|
|
5
|
+
...input,
|
|
6
|
+
useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
|
|
7
|
+
};
|
|
6
8
|
}
|
package/dist-es/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export const CONTEXT_OUTPOST_ID = "outpost_id";
|
|
2
|
+
export const CONTEXT_ACCOUNT_ID = "account_id";
|
|
3
|
+
export const CONTEXT_ARN_REGION = "outpost_arn_region";
|
|
4
|
+
export const CONTEXT_SIGNING_SERVICE = "signing_service";
|
|
5
|
+
export const CONTEXT_SIGNING_REGION = "signing_region";
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export var getOutpostEndpoint = function (hostname, _a) {
|
|
4
|
-
var isCustomEndpoint = _a.isCustomEndpoint, regionOverride = _a.regionOverride, useFipsEndpoint = _a.useFipsEndpoint;
|
|
1
|
+
const REGEX_S3CONTROL_HOSTNAME = /^(.+\.)?s3-control(-fips)?[.-]([a-z0-9-]+)\./;
|
|
2
|
+
export const getOutpostEndpoint = (hostname, { isCustomEndpoint, regionOverride, useFipsEndpoint }) => {
|
|
5
3
|
if (isCustomEndpoint) {
|
|
6
4
|
return hostname;
|
|
7
5
|
}
|
|
8
|
-
|
|
6
|
+
const [matched, prefix, fips, region] = hostname.match(REGEX_S3CONTROL_HOSTNAME);
|
|
9
7
|
return [
|
|
10
|
-
|
|
8
|
+
`s3-outposts${useFipsEndpoint ? "-fips" : ""}`,
|
|
11
9
|
regionOverride || region,
|
|
12
|
-
hostname.replace(new RegExp(
|
|
10
|
+
hostname.replace(new RegExp(`^${matched}`), ""),
|
|
13
11
|
]
|
|
14
|
-
.filter(
|
|
12
|
+
.filter((part) => part !== undefined)
|
|
15
13
|
.join(".");
|
|
16
14
|
};
|
|
@@ -1,116 +1,104 @@
|
|
|
1
|
-
import { __awaiter, __generator, __read } from "tslib";
|
|
2
1
|
import { getArnResources as getS3AccesspointArnResources, validateAccountId, validateNoDualstack, validateOutpostService, validatePartition, validateRegion, } from "@aws-sdk/middleware-bucket-endpoint";
|
|
3
2
|
import { parse as parseArn, validate as validateArn } from "@aws-sdk/util-arn-parser";
|
|
3
|
+
import { partition } from "@aws-sdk/util-endpoints";
|
|
4
4
|
import { CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID, CONTEXT_SIGNING_REGION, CONTEXT_SIGNING_SERVICE } from "../constants";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_a = (_e.sent()), clientPartition = _a.partition, _b = _a.signingRegion, signingRegion = _b === void 0 ? baseRegion : _b;
|
|
35
|
-
validatorOptions = {
|
|
36
|
-
useFipsEndpoint: useFipsEndpoint,
|
|
37
|
-
useDualstackEndpoint: useDualstackEndpoint,
|
|
38
|
-
clientRegion: clientRegion,
|
|
39
|
-
clientPartition: clientPartition,
|
|
40
|
-
signingRegion: signingRegion,
|
|
41
|
-
useArnRegion: useArnRegion,
|
|
42
|
-
};
|
|
43
|
-
if (parameter === "Name") {
|
|
44
|
-
arn = parseArn(input.Name);
|
|
45
|
-
validateOutpostsArn(arn, validatorOptions);
|
|
46
|
-
_c = parseOutpostsAccessPointArnResource(arn.resource), outpostId = _c.outpostId, accesspointName = _c.accesspointName;
|
|
47
|
-
input.Name = accesspointName;
|
|
48
|
-
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
arn = parseArn(input.Bucket);
|
|
52
|
-
validateOutpostsArn(arn, validatorOptions);
|
|
53
|
-
_d = parseOutpostBucketArnResource(arn.resource), outpostId = _d.outpostId, bucketName = _d.bucketName;
|
|
54
|
-
input.Bucket = bucketName;
|
|
55
|
-
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
56
|
-
}
|
|
57
|
-
context[CONTEXT_SIGNING_SERVICE] = arn.service;
|
|
58
|
-
context[CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
|
|
59
|
-
if (!input.AccountId) {
|
|
60
|
-
input.AccountId = arn.accountId;
|
|
61
|
-
}
|
|
62
|
-
else if (input.AccountId !== arn.accountId) {
|
|
63
|
-
throw new Error("AccountId is incompatible with account id inferred from ".concat(parameter));
|
|
64
|
-
}
|
|
65
|
-
if (useArnRegion)
|
|
66
|
-
context[CONTEXT_ARN_REGION] = arn.region;
|
|
67
|
-
return [2, next(args)];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}); };
|
|
5
|
+
export const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (args) => {
|
|
6
|
+
const { input } = args;
|
|
7
|
+
const parameter = input.Name && validateArn(input.Name) ? "Name" : input.Bucket && validateArn(input.Bucket) ? "Bucket" : undefined;
|
|
8
|
+
if (!parameter)
|
|
9
|
+
return next(args);
|
|
10
|
+
const clientRegion = await options.region();
|
|
11
|
+
const useArnRegion = await options.useArnRegion();
|
|
12
|
+
const useFipsEndpoint = await options.useFipsEndpoint();
|
|
13
|
+
const useDualstackEndpoint = await options.useDualstackEndpoint();
|
|
14
|
+
const baseRegion = clientRegion;
|
|
15
|
+
let clientPartition;
|
|
16
|
+
let signingRegion;
|
|
17
|
+
if (options.regionInfoProvider) {
|
|
18
|
+
({ partition: clientPartition, signingRegion = baseRegion } = (await options.regionInfoProvider(baseRegion, {
|
|
19
|
+
useFipsEndpoint,
|
|
20
|
+
useDualstackEndpoint,
|
|
21
|
+
})));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
signingRegion = context.endpointV2?.properties?.authSchemes?.[0]?.signingRegion || baseRegion;
|
|
25
|
+
clientPartition = partition(signingRegion).name;
|
|
26
|
+
}
|
|
27
|
+
const validatorOptions = {
|
|
28
|
+
useFipsEndpoint,
|
|
29
|
+
useDualstackEndpoint,
|
|
30
|
+
clientRegion,
|
|
31
|
+
clientPartition,
|
|
32
|
+
signingRegion,
|
|
33
|
+
useArnRegion,
|
|
71
34
|
};
|
|
35
|
+
let arn;
|
|
36
|
+
if (parameter === "Name") {
|
|
37
|
+
arn = parseArn(input.Name);
|
|
38
|
+
validateOutpostsArn(arn, validatorOptions);
|
|
39
|
+
const { outpostId, accesspointName } = parseOutpostsAccessPointArnResource(arn.resource);
|
|
40
|
+
input.Name = accesspointName;
|
|
41
|
+
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
arn = parseArn(input.Bucket);
|
|
45
|
+
validateOutpostsArn(arn, validatorOptions);
|
|
46
|
+
const { outpostId, bucketName } = parseOutpostBucketArnResource(arn.resource);
|
|
47
|
+
input.Bucket = bucketName;
|
|
48
|
+
context[CONTEXT_OUTPOST_ID] = outpostId;
|
|
49
|
+
}
|
|
50
|
+
context[CONTEXT_SIGNING_SERVICE] = arn.service;
|
|
51
|
+
context[CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
|
|
52
|
+
if (!input.AccountId) {
|
|
53
|
+
input.AccountId = arn.accountId;
|
|
54
|
+
}
|
|
55
|
+
else if (input.AccountId !== arn.accountId) {
|
|
56
|
+
throw new Error(`AccountId is incompatible with account id inferred from ${parameter}`);
|
|
57
|
+
}
|
|
58
|
+
if (useArnRegion)
|
|
59
|
+
context[CONTEXT_ARN_REGION] = arn.region;
|
|
60
|
+
return next(args);
|
|
72
61
|
};
|
|
73
|
-
export
|
|
62
|
+
export const parseOutpostArnablesMiddleawareOptions = {
|
|
74
63
|
step: "initialize",
|
|
75
64
|
tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
|
|
76
65
|
name: "parseOutpostArnablesMiddleaware",
|
|
77
66
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var service = arn.service, partition = arn.partition, accountId = arn.accountId, region = arn.region;
|
|
67
|
+
const validateOutpostsArn = (arn, { clientRegion, signingRegion, clientPartition, useArnRegion, useFipsEndpoint, useDualstackEndpoint, }) => {
|
|
68
|
+
const { service, partition, accountId, region } = arn;
|
|
81
69
|
validateOutpostService(service);
|
|
82
|
-
validatePartition(partition, { clientPartition
|
|
70
|
+
validatePartition(partition, { clientPartition });
|
|
83
71
|
validateAccountId(accountId);
|
|
84
72
|
validateRegion(region, {
|
|
85
|
-
useArnRegion
|
|
86
|
-
clientRegion
|
|
73
|
+
useArnRegion,
|
|
74
|
+
clientRegion,
|
|
87
75
|
clientSigningRegion: signingRegion,
|
|
88
|
-
useFipsEndpoint
|
|
76
|
+
useFipsEndpoint,
|
|
89
77
|
allowFipsRegion: true,
|
|
90
78
|
});
|
|
91
79
|
validateNoDualstack(useDualstackEndpoint);
|
|
92
80
|
};
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
const parseOutpostsAccessPointArnResource = (resource) => {
|
|
82
|
+
const { outpostId, accesspointName } = getS3AccesspointArnResources(resource);
|
|
95
83
|
if (!outpostId) {
|
|
96
84
|
throw new Error("ARN resource should begin with 'outpost'");
|
|
97
85
|
}
|
|
98
86
|
return {
|
|
99
|
-
outpostId
|
|
100
|
-
accesspointName
|
|
87
|
+
outpostId,
|
|
88
|
+
accesspointName,
|
|
101
89
|
};
|
|
102
90
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
const parseOutpostBucketArnResource = (resource) => {
|
|
92
|
+
const delimiter = resource.includes(":") ? ":" : "/";
|
|
93
|
+
const [resourceType, ...rest] = resource.split(delimiter);
|
|
106
94
|
if (resourceType === "outpost") {
|
|
107
95
|
if (!rest[0] || rest[1] !== "bucket" || !rest[2] || rest.length !== 3) {
|
|
108
|
-
throw new Error(
|
|
96
|
+
throw new Error(`Outpost Bucket ARN should have resource outpost${delimiter}{outpostId}${delimiter}bucket${delimiter}{bucketName}`);
|
|
109
97
|
}
|
|
110
|
-
|
|
111
|
-
return { outpostId
|
|
98
|
+
const [outpostId, _, bucketName] = rest;
|
|
99
|
+
return { outpostId, bucketName };
|
|
112
100
|
}
|
|
113
101
|
else {
|
|
114
|
-
throw new Error(
|
|
102
|
+
throw new Error(`ARN resource should begin with 'outpost${delimiter}'`);
|
|
115
103
|
}
|
|
116
104
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions } from "./parse-outpost-arnables";
|
|
2
2
|
import { updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions } from "./update-arnables-request";
|
|
3
|
-
export
|
|
4
|
-
applyToStack:
|
|
3
|
+
export const getProcessArnablesPlugin = (options) => ({
|
|
4
|
+
applyToStack: (clientStack) => {
|
|
5
5
|
clientStack.add(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
|
|
6
6
|
clientStack.add(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
|
|
7
7
|
},
|
|
8
|
-
});
|
|
8
|
+
});
|
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { CONTEXT_ACCOUNT_ID, CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID } from "../constants";
|
|
4
3
|
import { getOutpostEndpoint } from "./getOutpostEndpoint";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
request.headers[OUTPOST_ID_HEADER] = context[CONTEXT_OUTPOST_ID];
|
|
25
|
-
request.hostname = getOutpostEndpoint(request.hostname, {
|
|
26
|
-
isCustomEndpoint: isCustomEndpoint,
|
|
27
|
-
regionOverride: context[CONTEXT_ARN_REGION],
|
|
28
|
-
useFipsEndpoint: useFipsEndpoint,
|
|
29
|
-
});
|
|
30
|
-
_a.label = 2;
|
|
31
|
-
case 2: return [2, next(args)];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}); };
|
|
35
|
-
};
|
|
4
|
+
const ACCOUNT_ID_HEADER = "x-amz-account-id";
|
|
5
|
+
const OUTPOST_ID_HEADER = "x-amz-outpost-id";
|
|
6
|
+
export const updateArnablesRequestMiddleware = (config) => (next, context) => async (args) => {
|
|
7
|
+
const { request } = args;
|
|
8
|
+
if (!HttpRequest.isInstance(request))
|
|
9
|
+
return next(args);
|
|
10
|
+
if (context[CONTEXT_ACCOUNT_ID])
|
|
11
|
+
request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
|
|
12
|
+
if (context[CONTEXT_OUTPOST_ID]) {
|
|
13
|
+
const { isCustomEndpoint } = config;
|
|
14
|
+
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
15
|
+
request.headers[OUTPOST_ID_HEADER] = context[CONTEXT_OUTPOST_ID];
|
|
16
|
+
request.hostname = getOutpostEndpoint(request.hostname, {
|
|
17
|
+
isCustomEndpoint,
|
|
18
|
+
regionOverride: context[CONTEXT_ARN_REGION],
|
|
19
|
+
useFipsEndpoint,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return next(args);
|
|
36
23
|
};
|
|
37
|
-
export
|
|
24
|
+
export const updateArnablesRequestMiddlewareOptions = {
|
|
38
25
|
step: "build",
|
|
39
26
|
name: "updateArnablesRequestMiddleware",
|
|
40
27
|
tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"],
|
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { CONTEXT_SIGNING_SERVICE } from "./constants";
|
|
4
3
|
import { getOutpostEndpoint } from "./process-arnables-plugin";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isCustomEndpoint = config.isCustomEndpoint;
|
|
17
|
-
return [4, config.useFipsEndpoint()];
|
|
18
|
-
case 1:
|
|
19
|
-
useFipsEndpoint = _a.sent();
|
|
20
|
-
request.hostname = getOutpostEndpoint(request.hostname, { isCustomEndpoint: isCustomEndpoint, useFipsEndpoint: useFipsEndpoint });
|
|
21
|
-
context[CONTEXT_SIGNING_SERVICE] = "s3-outposts";
|
|
22
|
-
_a.label = 2;
|
|
23
|
-
case 2: return [2, next(args)];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}); };
|
|
27
|
-
};
|
|
4
|
+
export const redirectFromPostIdMiddleware = (config) => (next, context) => async (args) => {
|
|
5
|
+
const { input, request } = args;
|
|
6
|
+
if (!HttpRequest.isInstance(request))
|
|
7
|
+
return next(args);
|
|
8
|
+
if (input.OutpostId) {
|
|
9
|
+
const { isCustomEndpoint } = config;
|
|
10
|
+
const useFipsEndpoint = await config.useFipsEndpoint();
|
|
11
|
+
request.hostname = getOutpostEndpoint(request.hostname, { isCustomEndpoint, useFipsEndpoint });
|
|
12
|
+
context[CONTEXT_SIGNING_SERVICE] = "s3-outposts";
|
|
13
|
+
}
|
|
14
|
+
return next(args);
|
|
28
15
|
};
|
|
29
|
-
export
|
|
16
|
+
export const redirectFromPostIdMiddlewareOptions = {
|
|
30
17
|
step: "build",
|
|
31
18
|
name: "redirectFromPostIdMiddleware",
|
|
32
19
|
tags: ["OUTPOST"],
|
|
33
20
|
override: true,
|
|
34
21
|
};
|
|
35
|
-
export
|
|
36
|
-
applyToStack:
|
|
22
|
+
export const getRedirectFromPostIdPlugin = (options) => ({
|
|
23
|
+
applyToStack: (clientStack) => {
|
|
37
24
|
clientStack.add(redirectFromPostIdMiddleware(options), redirectFromPostIdMiddlewareOptions);
|
|
38
25
|
},
|
|
39
|
-
});
|
|
26
|
+
});
|
|
@@ -7,9 +7,9 @@ export interface S3ControlInputConfig {
|
|
|
7
7
|
useArnRegion?: boolean | Provider<boolean>;
|
|
8
8
|
}
|
|
9
9
|
interface PreviouslyResolved {
|
|
10
|
-
isCustomEndpoint
|
|
10
|
+
isCustomEndpoint?: boolean;
|
|
11
11
|
region: Provider<string>;
|
|
12
|
-
regionInfoProvider
|
|
12
|
+
regionInfoProvider?: RegionInfoProvider;
|
|
13
13
|
useFipsEndpoint: Provider<boolean>;
|
|
14
14
|
useDualstackEndpoint: Provider<boolean>;
|
|
15
15
|
}
|
|
@@ -18,7 +18,7 @@ export interface S3ControlResolvedConfig {
|
|
|
18
18
|
* Whether the endpoint is specified by caller.
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
isCustomEndpoint
|
|
21
|
+
isCustomEndpoint?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* Enables FIPS compatible endpoints.
|
|
24
24
|
*/
|
|
@@ -39,6 +39,6 @@ export interface S3ControlResolvedConfig {
|
|
|
39
39
|
* Fetch related hostname, signing name or signing region with given region.
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
|
-
regionInfoProvider
|
|
42
|
+
regionInfoProvider?: RegionInfoProvider;
|
|
43
43
|
}
|
|
44
44
|
export declare function resolveS3ControlConfig<T>(input: T & PreviouslyResolved & S3ControlInputConfig): T & S3ControlResolvedConfig;
|
|
@@ -4,19 +4,19 @@ export interface S3ControlInputConfig {
|
|
|
4
4
|
useArnRegion?: boolean | Provider<boolean>;
|
|
5
5
|
}
|
|
6
6
|
interface PreviouslyResolved {
|
|
7
|
-
isCustomEndpoint
|
|
7
|
+
isCustomEndpoint?: boolean;
|
|
8
8
|
region: Provider<string>;
|
|
9
|
-
regionInfoProvider
|
|
9
|
+
regionInfoProvider?: RegionInfoProvider;
|
|
10
10
|
useFipsEndpoint: Provider<boolean>;
|
|
11
11
|
useDualstackEndpoint: Provider<boolean>;
|
|
12
12
|
}
|
|
13
13
|
export interface S3ControlResolvedConfig {
|
|
14
|
-
isCustomEndpoint
|
|
14
|
+
isCustomEndpoint?: boolean;
|
|
15
15
|
useFipsEndpoint: Provider<boolean>;
|
|
16
16
|
useDualstackEndpoint: Provider<boolean>;
|
|
17
17
|
useArnRegion: Provider<boolean>;
|
|
18
18
|
region: Provider<string>;
|
|
19
|
-
regionInfoProvider
|
|
19
|
+
regionInfoProvider?: RegionInfoProvider;
|
|
20
20
|
}
|
|
21
21
|
export declare function resolveS3ControlConfig<T>(
|
|
22
22
|
input: T & PreviouslyResolved & S3ControlInputConfig
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildHandlerOptions, BuildMiddleware, Provider } from "@aws-sdk/types";
|
|
2
2
|
export interface UpdateArnablesRequestMiddlewareConfig {
|
|
3
|
-
isCustomEndpoint
|
|
3
|
+
isCustomEndpoint?: boolean;
|
|
4
4
|
useFipsEndpoint: Provider<boolean>;
|
|
5
5
|
}
|
|
6
6
|
export declare const updateArnablesRequestMiddleware: (
|
|
@@ -9,7 +9,7 @@ declare type InputType = {
|
|
|
9
9
|
OutpostId?: string;
|
|
10
10
|
};
|
|
11
11
|
export interface RedirectFromPostIdMiddlewareConfig {
|
|
12
|
-
isCustomEndpoint
|
|
12
|
+
isCustomEndpoint?: boolean;
|
|
13
13
|
useFipsEndpoint: Provider<boolean>;
|
|
14
14
|
}
|
|
15
15
|
export declare const redirectFromPostIdMiddleware: (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3-control",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.190.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/middleware-bucket-endpoint": "3.
|
|
24
|
-
"@aws-sdk/protocol-http": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
26
|
-
"@aws-sdk/util-arn-parser": "3.
|
|
23
|
+
"@aws-sdk/middleware-bucket-endpoint": "3.190.0",
|
|
24
|
+
"@aws-sdk/protocol-http": "3.190.0",
|
|
25
|
+
"@aws-sdk/types": "3.190.0",
|
|
26
|
+
"@aws-sdk/util-arn-parser": "3.188.0",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aws-sdk/middleware-stack": "3.
|
|
30
|
+
"@aws-sdk/middleware-stack": "3.190.0",
|
|
31
31
|
"@tsconfig/recommended": "1.0.1",
|
|
32
32
|
"concurrently": "7.0.0",
|
|
33
33
|
"downlevel-dts": "0.10.1",
|