@aws-sdk/middleware-sdk-s3-control 3.972.20 → 3.972.22

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.
Files changed (32) hide show
  1. package/dist-cjs/index.js +18 -213
  2. package/dist-es/index.js +2 -4
  3. package/dist-types/index.d.ts +3 -4
  4. package/package.json +4 -23
  5. package/dist-es/configurations.js +0 -7
  6. package/dist-es/constants.js +0 -5
  7. package/dist-es/host-prefix-deduplication/hostPrefixDeduplicationMiddleware.js +0 -17
  8. package/dist-es/process-arnables-plugin/getOutpostEndpoint.js +0 -18
  9. package/dist-es/process-arnables-plugin/getProcessArnablesPlugin.js +0 -8
  10. package/dist-es/process-arnables-plugin/index.js +0 -4
  11. package/dist-es/process-arnables-plugin/parse-outpost-arnables.js +0 -94
  12. package/dist-es/process-arnables-plugin/update-arnables-request.js +0 -31
  13. package/dist-es/redirect-from-postid.js +0 -26
  14. package/dist-types/configurations.d.ts +0 -47
  15. package/dist-types/constants.d.ts +0 -5
  16. package/dist-types/host-prefix-deduplication/hostPrefixDeduplicationMiddleware.d.ts +0 -17
  17. package/dist-types/process-arnables-plugin/getOutpostEndpoint.d.ts +0 -6
  18. package/dist-types/process-arnables-plugin/getProcessArnablesPlugin.d.ts +0 -3
  19. package/dist-types/process-arnables-plugin/index.d.ts +0 -4
  20. package/dist-types/process-arnables-plugin/parse-outpost-arnables.d.ts +0 -27
  21. package/dist-types/process-arnables-plugin/update-arnables-request.d.ts +0 -19
  22. package/dist-types/redirect-from-postid.d.ts +0 -17
  23. package/dist-types/ts3.4/configurations.d.ts +0 -23
  24. package/dist-types/ts3.4/constants.d.ts +0 -5
  25. package/dist-types/ts3.4/host-prefix-deduplication/hostPrefixDeduplicationMiddleware.d.ts +0 -13
  26. package/dist-types/ts3.4/index.d.ts +0 -10
  27. package/dist-types/ts3.4/process-arnables-plugin/getOutpostEndpoint.d.ts +0 -13
  28. package/dist-types/ts3.4/process-arnables-plugin/getProcessArnablesPlugin.d.ts +0 -5
  29. package/dist-types/ts3.4/process-arnables-plugin/index.d.ts +0 -10
  30. package/dist-types/ts3.4/process-arnables-plugin/parse-outpost-arnables.d.ts +0 -12
  31. package/dist-types/ts3.4/process-arnables-plugin/update-arnables-request.d.ts +0 -13
  32. package/dist-types/ts3.4/redirect-from-postid.d.ts +0 -22
package/dist-cjs/index.js CHANGED
@@ -1,215 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var middlewareBucketEndpoint = require('@aws-sdk/middleware-bucket-endpoint');
4
- var protocols = require('@smithy/core/protocols');
5
- var client = require('@aws-sdk/core/client');
6
- var util = require('@aws-sdk/core/util');
7
-
8
- function resolveS3ControlConfig(input) {
9
- const { useArnRegion } = input;
10
- return Object.assign(input, {
11
- useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
12
- });
13
- }
14
-
15
- const CONTEXT_OUTPOST_ID = "outpost_id";
16
- const CONTEXT_ACCOUNT_ID = "account_id";
17
- const CONTEXT_ARN_REGION = "outpost_arn_region";
18
- const CONTEXT_SIGNING_SERVICE = "signing_service";
19
- const CONTEXT_SIGNING_REGION = "signing_region";
20
-
21
- const parseOutpostArnablesMiddleaware = (options) => (next, context) => async (args) => {
22
- const { input } = args;
23
- const parameter = input.Name && util.validate(input.Name) ? "Name" : input.Bucket && util.validate(input.Bucket) ? "Bucket" : undefined;
24
- if (!parameter)
25
- return next(args);
26
- const clientRegion = await options.region();
27
- const useArnRegion = await options.useArnRegion();
28
- const useFipsEndpoint = await options.useFipsEndpoint();
29
- const useDualstackEndpoint = await options.useDualstackEndpoint();
30
- const baseRegion = clientRegion;
31
- let clientPartition;
32
- let signingRegion;
33
- if (options.regionInfoProvider) {
34
- ({ partition: clientPartition, signingRegion = baseRegion } = (await options.regionInfoProvider(baseRegion, {
35
- useFipsEndpoint,
36
- useDualstackEndpoint,
37
- })));
38
- }
39
- else {
40
- signingRegion = context.endpointV2?.properties?.authSchemes?.[0]?.signingRegion || baseRegion;
41
- clientPartition = client.partition(signingRegion).name;
42
- }
43
- const validatorOptions = {
44
- clientPartition};
45
- let arn;
46
- if (parameter === "Name") {
47
- arn = util.parse(input.Name);
48
- validateOutpostsArn(arn, validatorOptions);
49
- const { outpostId, accesspointName } = parseOutpostsAccessPointArnResource(arn.resource);
50
- input.Name = accesspointName;
51
- context[CONTEXT_OUTPOST_ID] = outpostId;
52
- }
53
- else {
54
- arn = util.parse(input.Bucket);
55
- validateOutpostsArn(arn, validatorOptions);
56
- const { outpostId, bucketName } = parseOutpostBucketArnResource(arn.resource);
57
- input.Bucket = bucketName;
58
- context[CONTEXT_OUTPOST_ID] = outpostId;
59
- }
60
- context[CONTEXT_SIGNING_SERVICE] = arn.service;
61
- context[CONTEXT_SIGNING_REGION] = useArnRegion ? arn.region : signingRegion;
62
- if (!input.AccountId) {
63
- input.AccountId = arn.accountId;
64
- }
65
- if (useArnRegion)
66
- context[CONTEXT_ARN_REGION] = arn.region;
67
- return next(args);
68
- };
69
- const parseOutpostArnablesMiddleawareOptions = {
70
- toMiddleware: "serializerMiddleware",
71
- relation: "before",
72
- tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
73
- name: "parseOutpostArnablesMiddleaware",
74
- };
75
- const validateOutpostsArn = (arn, { clientPartition }) => {
76
- const { service, partition, accountId, region } = arn;
77
- middlewareBucketEndpoint.validateOutpostService(service);
78
- middlewareBucketEndpoint.validatePartition(partition, { clientPartition });
79
- middlewareBucketEndpoint.validateAccountId(accountId);
80
- };
81
- const parseOutpostsAccessPointArnResource = (resource) => {
82
- const { outpostId, accesspointName } = middlewareBucketEndpoint.getArnResources(resource);
83
- if (!outpostId) {
84
- throw new Error("ARN resource should begin with 'outpost'");
85
- }
86
- return {
87
- outpostId,
88
- accesspointName,
89
- };
90
- };
91
- const parseOutpostBucketArnResource = (resource) => {
92
- const delimiter = resource.includes(":") ? ":" : "/";
93
- const [resourceType, ...rest] = resource.split(delimiter);
94
- if (resourceType === "outpost") {
95
- if (!rest[0] || rest[1] !== "bucket" || !rest[2] || rest.length !== 3) {
96
- throw new Error(`Outpost Bucket ARN should have resource outpost${delimiter}{outpostId}${delimiter}bucket${delimiter}{bucketName}`);
97
- }
98
- const [outpostId, _, bucketName] = rest;
99
- return { outpostId, bucketName };
100
- }
101
- else {
102
- throw new Error(`ARN resource should begin with 'outpost${delimiter}'`);
103
- }
104
- };
105
-
106
- const REGEX_S3CONTROL_HOSTNAME = /^(.+\.)?s3-control(-fips)?[.-]([a-z0-9-]+)\./;
107
- const getOutpostEndpoint = (hostname, { isCustomEndpoint, regionOverride, useFipsEndpoint }) => {
108
- if (isCustomEndpoint) {
109
- return hostname;
110
- }
111
- const match = hostname.match(REGEX_S3CONTROL_HOSTNAME);
112
- if (!match) {
113
- return hostname;
114
- }
115
- const [matched, prefix, fips, region] = hostname.match(REGEX_S3CONTROL_HOSTNAME);
116
- return [
117
- `s3-outposts${useFipsEndpoint ? "-fips" : ""}`,
118
- regionOverride || region,
119
- hostname.replace(new RegExp(`^${matched}`), ""),
120
- ]
121
- .filter((part) => part !== undefined)
122
- .join(".");
123
- };
124
-
125
- const ACCOUNT_ID_HEADER = "x-amz-account-id";
126
- const OUTPOST_ID_HEADER = "x-amz-outpost-id";
127
- const updateArnablesRequestMiddleware = (config) => (next, context) => async (args) => {
128
- const { request } = args;
129
- if (!protocols.HttpRequest.isInstance(request)) {
130
- return next(args);
131
- }
132
- if (context[CONTEXT_ACCOUNT_ID]) {
133
- request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
134
- }
135
- if (context[CONTEXT_OUTPOST_ID]) {
136
- const { isCustomEndpoint } = config;
137
- const useFipsEndpoint = await config.useFipsEndpoint();
138
- request.headers[OUTPOST_ID_HEADER] = context[CONTEXT_OUTPOST_ID];
139
- request.hostname = getOutpostEndpoint(request.hostname, {
140
- isCustomEndpoint,
141
- regionOverride: context[CONTEXT_ARN_REGION],
142
- useFipsEndpoint,
143
- });
144
- }
145
- return next(args);
146
- };
147
- const updateArnablesRequestMiddlewareOptions = {
148
- toMiddleware: "serializerMiddleware",
149
- relation: "after",
150
- name: "updateArnablesRequestMiddleware",
151
- tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"],
152
- };
153
-
154
- const getProcessArnablesPlugin = (options) => ({
155
- applyToStack: (clientStack) => {
156
- clientStack.addRelativeTo(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
157
- clientStack.addRelativeTo(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
158
- },
159
- });
160
-
161
- const hostPrefixDeduplicationMiddleware = () => {
162
- return (next, context) => (args) => {
163
- return next(args);
164
- };
165
- };
166
- const hostPrefixDeduplicationMiddlewareOptions = {
167
- tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
168
- toMiddleware: "serializerMiddleware",
169
- relation: "after",
170
- name: "hostPrefixDeduplicationMiddleware",
171
- override: true,
172
- };
173
- const getHostPrefixDeduplicationPlugin = (config) => ({
174
- applyToStack: (clientStack) => {
175
- clientStack.addRelativeTo(hostPrefixDeduplicationMiddleware(), hostPrefixDeduplicationMiddlewareOptions);
176
- },
177
- });
178
-
179
- const redirectFromPostIdMiddleware = (config) => (next, context) => async (args) => {
180
- const { input, request } = args;
181
- if (!protocols.HttpRequest.isInstance(request))
182
- return next(args);
183
- if (input.OutpostId) {
184
- const { isCustomEndpoint } = config;
185
- const useFipsEndpoint = await config.useFipsEndpoint();
186
- request.hostname = getOutpostEndpoint(request.hostname, { isCustomEndpoint, useFipsEndpoint });
187
- context[CONTEXT_SIGNING_SERVICE] = "s3-outposts";
188
- }
189
- return next(args);
190
- };
191
- const redirectFromPostIdMiddlewareOptions = {
192
- step: "build",
193
- name: "redirectFromPostIdMiddleware",
194
- tags: ["OUTPOST"],
195
- override: true,
196
- };
197
- const getRedirectFromPostIdPlugin = (options) => ({
198
- applyToStack: (clientStack) => {
199
- clientStack.add(redirectFromPostIdMiddleware(options), redirectFromPostIdMiddlewareOptions);
200
- },
201
- });
202
-
203
- exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = middlewareBucketEndpoint.NODE_USE_ARN_REGION_CONFIG_OPTIONS;
204
- exports.getHostPrefixDeduplicationPlugin = getHostPrefixDeduplicationPlugin;
205
- exports.getProcessArnablesPlugin = getProcessArnablesPlugin;
206
- exports.getRedirectFromPostIdPlugin = getRedirectFromPostIdPlugin;
207
- exports.hostPrefixDeduplicationMiddleware = hostPrefixDeduplicationMiddleware;
208
- exports.hostPrefixDeduplicationMiddlewareOptions = hostPrefixDeduplicationMiddlewareOptions;
209
- exports.parseOutpostArnablesMiddleaware = parseOutpostArnablesMiddleaware;
210
- exports.parseOutpostArnablesMiddleawareOptions = parseOutpostArnablesMiddleawareOptions;
211
- exports.redirectFromPostIdMiddleware = redirectFromPostIdMiddleware;
212
- exports.redirectFromPostIdMiddlewareOptions = redirectFromPostIdMiddlewareOptions;
213
- exports.resolveS3ControlConfig = resolveS3ControlConfig;
214
- exports.updateArnablesRequestMiddleware = updateArnablesRequestMiddleware;
215
- exports.updateArnablesRequestMiddlewareOptions = updateArnablesRequestMiddlewareOptions;
3
+ var s3 = require('@aws-sdk/middleware-sdk-s3/s3');
4
+ var s3Control = require('@aws-sdk/middleware-sdk-s3/s3-control');
5
+
6
+
7
+
8
+ exports.NODE_USE_ARN_REGION_CONFIG_OPTIONS = s3.NODE_USE_ARN_REGION_CONFIG_OPTIONS;
9
+ exports.getHostPrefixDeduplicationPlugin = s3Control.getHostPrefixDeduplicationPlugin;
10
+ exports.getProcessArnablesPlugin = s3Control.getProcessArnablesPlugin;
11
+ exports.getRedirectFromPostIdPlugin = s3Control.getRedirectFromPostIdPlugin;
12
+ exports.hostPrefixDeduplicationMiddleware = s3Control.hostPrefixDeduplicationMiddleware;
13
+ exports.hostPrefixDeduplicationMiddlewareOptions = s3Control.hostPrefixDeduplicationMiddlewareOptions;
14
+ exports.parseOutpostArnablesMiddleaware = s3Control.parseOutpostArnablesMiddleaware;
15
+ exports.parseOutpostArnablesMiddleawareOptions = s3Control.parseOutpostArnablesMiddleawareOptions;
16
+ exports.redirectFromPostIdMiddleware = s3Control.redirectFromPostIdMiddleware;
17
+ exports.redirectFromPostIdMiddlewareOptions = s3Control.redirectFromPostIdMiddlewareOptions;
18
+ exports.resolveS3ControlConfig = s3Control.resolveS3ControlConfig;
19
+ exports.updateArnablesRequestMiddleware = s3Control.updateArnablesRequestMiddleware;
20
+ exports.updateArnablesRequestMiddlewareOptions = s3Control.updateArnablesRequestMiddlewareOptions;
package/dist-es/index.js CHANGED
@@ -1,4 +1,2 @@
1
- export * from "./configurations";
2
- export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, } from "./process-arnables-plugin";
3
- export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
4
- export * from "./redirect-from-postid";
1
+ export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-sdk-s3/s3";
2
+ export { resolveS3ControlConfig, parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, hostPrefixDeduplicationMiddleware, hostPrefixDeduplicationMiddlewareOptions, getHostPrefixDeduplicationPlugin, redirectFromPostIdMiddleware, redirectFromPostIdMiddlewareOptions, getRedirectFromPostIdPlugin, } from "@aws-sdk/middleware-sdk-s3/s3-control";
@@ -1,4 +1,3 @@
1
- export * from "./configurations";
2
- export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, } from "./process-arnables-plugin";
3
- export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
4
- export * from "./redirect-from-postid";
1
+ export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-sdk-s3/s3";
2
+ export { resolveS3ControlConfig, parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions, updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions, getProcessArnablesPlugin, hostPrefixDeduplicationMiddleware, hostPrefixDeduplicationMiddlewareOptions, getHostPrefixDeduplicationPlugin, redirectFromPostIdMiddleware, redirectFromPostIdMiddlewareOptions, getRedirectFromPostIdPlugin, } from "@aws-sdk/middleware-sdk-s3/s3-control";
3
+ export type { S3ControlInputConfig, S3ControlResolvedConfig, RedirectFromPostIdMiddlewareConfig, } from "@aws-sdk/middleware-sdk-s3/s3-control";
package/package.json CHANGED
@@ -1,19 +1,13 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-s3-control",
3
- "version": "3.972.20",
3
+ "version": "3.972.22",
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-sdk-s3-control",
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
- "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
12
- "test": "yarn g:vitest run",
13
- "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
14
- "extract:docs": "api-extractor run --local",
15
- "test:watch": "yarn g:vitest watch",
16
- "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
10
+ "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
17
11
  },
18
12
  "main": "./dist-cjs/index.js",
19
13
  "module": "./dist-es/index.js",
@@ -21,34 +15,21 @@
21
15
  "sideEffects": false,
22
16
  "author": {
23
17
  "name": "AWS SDK for JavaScript Team",
24
- "url": "https://aws.amazon.com/javascript/"
18
+ "url": "https://aws.amazon.com/sdk-for-javascript/"
25
19
  },
26
20
  "license": "Apache-2.0",
27
21
  "dependencies": {
28
- "@aws-sdk/core": "^3.974.17",
29
- "@aws-sdk/middleware-bucket-endpoint": "^3.972.19",
30
- "@aws-sdk/types": "^3.973.10",
31
- "@smithy/core": "^3.24.6",
32
- "@smithy/types": "^4.14.3",
22
+ "@aws-sdk/middleware-sdk-s3": "^3.972.48",
33
23
  "tslib": "^2.6.2"
34
24
  },
35
25
  "devDependencies": {
36
- "@tsconfig/recommended": "1.0.1",
37
26
  "concurrently": "7.0.0",
38
- "downlevel-dts": "0.10.1",
39
27
  "premove": "4.0.0",
40
28
  "typescript": "~5.8.3"
41
29
  },
42
30
  "engines": {
43
31
  "node": ">=20.0.0"
44
32
  },
45
- "typesVersions": {
46
- "<4.5": {
47
- "dist-types/*": [
48
- "dist-types/ts3.4/*"
49
- ]
50
- }
51
- },
52
33
  "files": [
53
34
  "dist-*/**"
54
35
  ],
@@ -1,7 +0,0 @@
1
- export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
2
- export function resolveS3ControlConfig(input) {
3
- const { useArnRegion } = input;
4
- return Object.assign(input, {
5
- useArnRegion: typeof useArnRegion === "function" ? useArnRegion : () => Promise.resolve(useArnRegion),
6
- });
7
- }
@@ -1,5 +0,0 @@
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,17 +0,0 @@
1
- export const hostPrefixDeduplicationMiddleware = () => {
2
- return (next, context) => (args) => {
3
- return next(args);
4
- };
5
- };
6
- export const hostPrefixDeduplicationMiddlewareOptions = {
7
- tags: ["HOST_PREFIX_DEDUPLICATION", "ENDPOINT_V2", "ENDPOINT"],
8
- toMiddleware: "serializerMiddleware",
9
- relation: "after",
10
- name: "hostPrefixDeduplicationMiddleware",
11
- override: true,
12
- };
13
- export const getHostPrefixDeduplicationPlugin = (config) => ({
14
- applyToStack: (clientStack) => {
15
- clientStack.addRelativeTo(hostPrefixDeduplicationMiddleware(), hostPrefixDeduplicationMiddlewareOptions);
16
- },
17
- });
@@ -1,18 +0,0 @@
1
- const REGEX_S3CONTROL_HOSTNAME = /^(.+\.)?s3-control(-fips)?[.-]([a-z0-9-]+)\./;
2
- export const getOutpostEndpoint = (hostname, { isCustomEndpoint, regionOverride, useFipsEndpoint }) => {
3
- if (isCustomEndpoint) {
4
- return hostname;
5
- }
6
- const match = hostname.match(REGEX_S3CONTROL_HOSTNAME);
7
- if (!match) {
8
- return hostname;
9
- }
10
- const [matched, prefix, fips, region] = hostname.match(REGEX_S3CONTROL_HOSTNAME);
11
- return [
12
- `s3-outposts${useFipsEndpoint ? "-fips" : ""}`,
13
- regionOverride || region,
14
- hostname.replace(new RegExp(`^${matched}`), ""),
15
- ]
16
- .filter((part) => part !== undefined)
17
- .join(".");
18
- };
@@ -1,8 +0,0 @@
1
- import { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions } from "./parse-outpost-arnables";
2
- import { updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions } from "./update-arnables-request";
3
- export const getProcessArnablesPlugin = (options) => ({
4
- applyToStack: (clientStack) => {
5
- clientStack.addRelativeTo(parseOutpostArnablesMiddleaware(options), parseOutpostArnablesMiddleawareOptions);
6
- clientStack.addRelativeTo(updateArnablesRequestMiddleware(options), updateArnablesRequestMiddlewareOptions);
7
- },
8
- });
@@ -1,4 +0,0 @@
1
- export { getProcessArnablesPlugin } from "./getProcessArnablesPlugin";
2
- export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions } from "./parse-outpost-arnables";
3
- export { updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions } from "./update-arnables-request";
4
- export { getOutpostEndpoint } from "./getOutpostEndpoint";
@@ -1,94 +0,0 @@
1
- import { partition } from "@aws-sdk/core/client";
2
- import { parse as parseArn, validate as validateArn } from "@aws-sdk/core/util";
3
- import { getArnResources as getS3AccesspointArnResources, validateAccountId, validateOutpostService, validatePartition, } from "@aws-sdk/middleware-bucket-endpoint";
4
- import { CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID, CONTEXT_SIGNING_REGION, CONTEXT_SIGNING_SERVICE } from "../constants";
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,
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
- if (useArnRegion)
56
- context[CONTEXT_ARN_REGION] = arn.region;
57
- return next(args);
58
- };
59
- export const parseOutpostArnablesMiddleawareOptions = {
60
- toMiddleware: "serializerMiddleware",
61
- relation: "before",
62
- tags: ["CONVERT_ARN", "OUTPOST_BUCKET_ARN", "OUTPOST_ACCESS_POINT_ARN", "OUTPOST"],
63
- name: "parseOutpostArnablesMiddleaware",
64
- };
65
- const validateOutpostsArn = (arn, { clientPartition }) => {
66
- const { service, partition, accountId, region } = arn;
67
- validateOutpostService(service);
68
- validatePartition(partition, { clientPartition });
69
- validateAccountId(accountId);
70
- };
71
- const parseOutpostsAccessPointArnResource = (resource) => {
72
- const { outpostId, accesspointName } = getS3AccesspointArnResources(resource);
73
- if (!outpostId) {
74
- throw new Error("ARN resource should begin with 'outpost'");
75
- }
76
- return {
77
- outpostId,
78
- accesspointName,
79
- };
80
- };
81
- const parseOutpostBucketArnResource = (resource) => {
82
- const delimiter = resource.includes(":") ? ":" : "/";
83
- const [resourceType, ...rest] = resource.split(delimiter);
84
- if (resourceType === "outpost") {
85
- if (!rest[0] || rest[1] !== "bucket" || !rest[2] || rest.length !== 3) {
86
- throw new Error(`Outpost Bucket ARN should have resource outpost${delimiter}{outpostId}${delimiter}bucket${delimiter}{bucketName}`);
87
- }
88
- const [outpostId, _, bucketName] = rest;
89
- return { outpostId, bucketName };
90
- }
91
- else {
92
- throw new Error(`ARN resource should begin with 'outpost${delimiter}'`);
93
- }
94
- };
@@ -1,31 +0,0 @@
1
- import { HttpRequest } from "@smithy/core/protocols";
2
- import { CONTEXT_ACCOUNT_ID, CONTEXT_ARN_REGION, CONTEXT_OUTPOST_ID } from "../constants";
3
- import { getOutpostEndpoint } from "./getOutpostEndpoint";
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
- }
11
- if (context[CONTEXT_ACCOUNT_ID]) {
12
- request.headers[ACCOUNT_ID_HEADER] = context[CONTEXT_ACCOUNT_ID];
13
- }
14
- if (context[CONTEXT_OUTPOST_ID]) {
15
- const { isCustomEndpoint } = config;
16
- const useFipsEndpoint = await config.useFipsEndpoint();
17
- request.headers[OUTPOST_ID_HEADER] = context[CONTEXT_OUTPOST_ID];
18
- request.hostname = getOutpostEndpoint(request.hostname, {
19
- isCustomEndpoint,
20
- regionOverride: context[CONTEXT_ARN_REGION],
21
- useFipsEndpoint,
22
- });
23
- }
24
- return next(args);
25
- };
26
- export const updateArnablesRequestMiddlewareOptions = {
27
- toMiddleware: "serializerMiddleware",
28
- relation: "after",
29
- name: "updateArnablesRequestMiddleware",
30
- tags: ["ACCOUNT_ID", "OUTPOST_ID", "OUTPOST"],
31
- };
@@ -1,26 +0,0 @@
1
- import { HttpRequest } from "@smithy/core/protocols";
2
- import { CONTEXT_SIGNING_SERVICE } from "./constants";
3
- import { getOutpostEndpoint } from "./process-arnables-plugin";
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);
15
- };
16
- export const redirectFromPostIdMiddlewareOptions = {
17
- step: "build",
18
- name: "redirectFromPostIdMiddleware",
19
- tags: ["OUTPOST"],
20
- override: true,
21
- };
22
- export const getRedirectFromPostIdPlugin = (options) => ({
23
- applyToStack: (clientStack) => {
24
- clientStack.add(redirectFromPostIdMiddleware(options), redirectFromPostIdMiddlewareOptions);
25
- },
26
- });
@@ -1,47 +0,0 @@
1
- import type { Provider, RegionInfoProvider } from "@smithy/types";
2
- export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
3
- /**
4
- * @public
5
- */
6
- export interface S3ControlInputConfig {
7
- /**
8
- * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false
9
- */
10
- useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
11
- }
12
- interface PreviouslyResolved {
13
- isCustomEndpoint?: boolean;
14
- region: Provider<string>;
15
- regionInfoProvider?: RegionInfoProvider;
16
- useFipsEndpoint: Provider<boolean>;
17
- useDualstackEndpoint: Provider<boolean>;
18
- }
19
- export interface S3ControlResolvedConfig {
20
- /**
21
- * Whether the endpoint is specified by caller.
22
- * @internal
23
- */
24
- isCustomEndpoint?: boolean;
25
- /**
26
- * Enables FIPS compatible endpoints.
27
- */
28
- useFipsEndpoint: Provider<boolean>;
29
- /**
30
- * Enables IPv6/IPv4 dualstack endpoint.
31
- */
32
- useDualstackEndpoint: Provider<boolean>;
33
- /**
34
- * Resolved value for input config {@link S3ControlInputConfig.useArnRegion}
35
- */
36
- useArnRegion: Provider<boolean | undefined>;
37
- /**
38
- * Resolved value for input config {@link RegionInputConfig.region}
39
- */
40
- region: Provider<string>;
41
- /**
42
- * Fetch related hostname, signing name or signing region with given region.
43
- * @internal
44
- */
45
- regionInfoProvider?: RegionInfoProvider;
46
- }
47
- export declare function resolveS3ControlConfig<T>(input: T & PreviouslyResolved & S3ControlInputConfig): T & S3ControlResolvedConfig;
@@ -1,5 +0,0 @@
1
- export declare const CONTEXT_OUTPOST_ID = "outpost_id";
2
- export declare const CONTEXT_ACCOUNT_ID = "account_id";
3
- export declare const CONTEXT_ARN_REGION = "outpost_arn_region";
4
- export declare const CONTEXT_SIGNING_SERVICE = "signing_service";
5
- export declare const CONTEXT_SIGNING_REGION = "signing_region";
@@ -1,17 +0,0 @@
1
- import type { Pluggable, RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
- /**
3
- * @internal
4
- * @deprecated - the middleware is no longer necessary since hostPrefix was
5
- * removed by S3Control codegen customization's model preprocessing.
6
- */
7
- export declare const hostPrefixDeduplicationMiddleware: () => SerializeMiddleware<any, any>;
8
- /**
9
- * @internal
10
- * @deprecated
11
- */
12
- export declare const hostPrefixDeduplicationMiddlewareOptions: RelativeMiddlewareOptions;
13
- /**
14
- * @internal
15
- * @deprecated
16
- */
17
- export declare const getHostPrefixDeduplicationPlugin: <T>(config: T) => Pluggable<any, any>;
@@ -1,6 +0,0 @@
1
- export interface GetOutpostEndpointOptions {
2
- isCustomEndpoint?: boolean;
3
- regionOverride?: string;
4
- useFipsEndpoint: boolean;
5
- }
6
- export declare const getOutpostEndpoint: (hostname: string, { isCustomEndpoint, regionOverride, useFipsEndpoint }: GetOutpostEndpointOptions) => string;
@@ -1,3 +0,0 @@
1
- import type { Pluggable } from "@smithy/types";
2
- import type { S3ControlResolvedConfig } from "../configurations";
3
- export declare const getProcessArnablesPlugin: (options: S3ControlResolvedConfig) => Pluggable<any, any>;
@@ -1,4 +0,0 @@
1
- export { getProcessArnablesPlugin } from "./getProcessArnablesPlugin";
2
- export { parseOutpostArnablesMiddleaware, parseOutpostArnablesMiddleawareOptions } from "./parse-outpost-arnables";
3
- export { updateArnablesRequestMiddleware, updateArnablesRequestMiddlewareOptions } from "./update-arnables-request";
4
- export { getOutpostEndpoint } from "./getOutpostEndpoint";
@@ -1,27 +0,0 @@
1
- import type { RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
- import type { S3ControlResolvedConfig } from "../configurations";
3
- /**
4
- * @internal
5
- */
6
- type ArnableInput = {
7
- Name?: string;
8
- Bucket?: string;
9
- AccountId?: string;
10
- };
11
- /**
12
- * Validate input `Name` or `Bucket` parameter is acceptable ARN format. If so, modify the input ARN to inferred
13
- * resource identifier, notify later middleware to redirect request to Outpost endpoint, signing service and signing
14
- * region.
15
- * @internal
16
- */
17
- export declare const parseOutpostArnablesMiddleaware: (options: S3ControlResolvedConfig) => SerializeMiddleware<ArnableInput, any>;
18
- /**
19
- * This middleware must go after endpoint resolution and before serialization.
20
- * The transform applied to the input.Bucket or input.Name ARN must not have occurred
21
- * by the time endpoint resolution happens, but must have completed by the time serialization
22
- * happens.
23
- *
24
- * @internal
25
- */
26
- export declare const parseOutpostArnablesMiddleawareOptions: RelativeMiddlewareOptions;
27
- export {};
@@ -1,19 +0,0 @@
1
- import type { Provider, RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export interface UpdateArnablesRequestMiddlewareConfig {
6
- isCustomEndpoint?: boolean;
7
- useFipsEndpoint: Provider<boolean>;
8
- }
9
- /**
10
- * After outpost request is constructed, redirect request to outpost endpoint and set `x-amz-account-id` and
11
- * `x-amz-outpost-id` headers.
12
- *
13
- * @internal
14
- */
15
- export declare const updateArnablesRequestMiddleware: (config: UpdateArnablesRequestMiddlewareConfig) => SerializeMiddleware<any, any>;
16
- /**
17
- * @internal
18
- */
19
- export declare const updateArnablesRequestMiddlewareOptions: RelativeMiddlewareOptions;
@@ -1,17 +0,0 @@
1
- import type { BuildHandlerOptions, BuildMiddleware, Pluggable, Provider } from "@smithy/types";
2
- import type { S3ControlResolvedConfig } from "./configurations";
3
- type InputType = {
4
- OutpostId?: string;
5
- };
6
- export interface RedirectFromPostIdMiddlewareConfig {
7
- isCustomEndpoint?: boolean;
8
- useFipsEndpoint: Provider<boolean>;
9
- }
10
- /**
11
- * If OutpostId is set, redirect hostname to Outpost one, and change signing service to `s3-outposts`.
12
- * Applied to S3Control.CreateBucket and S3Control.ListRegionalBuckets
13
- */
14
- export declare const redirectFromPostIdMiddleware: (config: RedirectFromPostIdMiddlewareConfig) => BuildMiddleware<InputType, any>;
15
- export declare const redirectFromPostIdMiddlewareOptions: BuildHandlerOptions;
16
- export declare const getRedirectFromPostIdPlugin: (options: S3ControlResolvedConfig) => Pluggable<any, any>;
17
- export {};
@@ -1,23 +0,0 @@
1
- import { Provider, RegionInfoProvider } from "@smithy/types";
2
- export { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
3
- export interface S3ControlInputConfig {
4
- useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
5
- }
6
- interface PreviouslyResolved {
7
- isCustomEndpoint?: boolean;
8
- region: Provider<string>;
9
- regionInfoProvider?: RegionInfoProvider;
10
- useFipsEndpoint: Provider<boolean>;
11
- useDualstackEndpoint: Provider<boolean>;
12
- }
13
- export interface S3ControlResolvedConfig {
14
- isCustomEndpoint?: boolean;
15
- useFipsEndpoint: Provider<boolean>;
16
- useDualstackEndpoint: Provider<boolean>;
17
- useArnRegion: Provider<boolean | undefined>;
18
- region: Provider<string>;
19
- regionInfoProvider?: RegionInfoProvider;
20
- }
21
- export declare function resolveS3ControlConfig<T>(
22
- input: T & PreviouslyResolved & S3ControlInputConfig
23
- ): T & S3ControlResolvedConfig;
@@ -1,5 +0,0 @@
1
- export declare const CONTEXT_OUTPOST_ID = "outpost_id";
2
- export declare const CONTEXT_ACCOUNT_ID = "account_id";
3
- export declare const CONTEXT_ARN_REGION = "outpost_arn_region";
4
- export declare const CONTEXT_SIGNING_SERVICE = "signing_service";
5
- export declare const CONTEXT_SIGNING_REGION = "signing_region";
@@ -1,13 +0,0 @@
1
- import {
2
- Pluggable,
3
- RelativeMiddlewareOptions,
4
- SerializeMiddleware,
5
- } from "@smithy/types";
6
- export declare const hostPrefixDeduplicationMiddleware: () => SerializeMiddleware<
7
- any,
8
- any
9
- >;
10
- export declare const hostPrefixDeduplicationMiddlewareOptions: RelativeMiddlewareOptions;
11
- export declare const getHostPrefixDeduplicationPlugin: <T>(
12
- config: T
13
- ) => Pluggable<any, any>;
@@ -1,10 +0,0 @@
1
- export * from "./configurations";
2
- export {
3
- parseOutpostArnablesMiddleaware,
4
- parseOutpostArnablesMiddleawareOptions,
5
- updateArnablesRequestMiddleware,
6
- updateArnablesRequestMiddlewareOptions,
7
- getProcessArnablesPlugin,
8
- } from "./process-arnables-plugin";
9
- export * from "./host-prefix-deduplication/hostPrefixDeduplicationMiddleware";
10
- export * from "./redirect-from-postid";
@@ -1,13 +0,0 @@
1
- export interface GetOutpostEndpointOptions {
2
- isCustomEndpoint?: boolean;
3
- regionOverride?: string;
4
- useFipsEndpoint: boolean;
5
- }
6
- export declare const getOutpostEndpoint: (
7
- hostname: string,
8
- {
9
- isCustomEndpoint,
10
- regionOverride,
11
- useFipsEndpoint,
12
- }: GetOutpostEndpointOptions
13
- ) => string;
@@ -1,5 +0,0 @@
1
- import { Pluggable } from "@smithy/types";
2
- import { S3ControlResolvedConfig } from "../configurations";
3
- export declare const getProcessArnablesPlugin: (
4
- options: S3ControlResolvedConfig
5
- ) => Pluggable<any, any>;
@@ -1,10 +0,0 @@
1
- export { getProcessArnablesPlugin } from "./getProcessArnablesPlugin";
2
- export {
3
- parseOutpostArnablesMiddleaware,
4
- parseOutpostArnablesMiddleawareOptions,
5
- } from "./parse-outpost-arnables";
6
- export {
7
- updateArnablesRequestMiddleware,
8
- updateArnablesRequestMiddlewareOptions,
9
- } from "./update-arnables-request";
10
- export { getOutpostEndpoint } from "./getOutpostEndpoint";
@@ -1,12 +0,0 @@
1
- import { RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
2
- import { S3ControlResolvedConfig } from "../configurations";
3
- type ArnableInput = {
4
- Name?: string;
5
- Bucket?: string;
6
- AccountId?: string;
7
- };
8
- export declare const parseOutpostArnablesMiddleaware: (
9
- options: S3ControlResolvedConfig
10
- ) => SerializeMiddleware<ArnableInput, any>;
11
- export declare const parseOutpostArnablesMiddleawareOptions: RelativeMiddlewareOptions;
12
- export {};
@@ -1,13 +0,0 @@
1
- import {
2
- Provider,
3
- RelativeMiddlewareOptions,
4
- SerializeMiddleware,
5
- } from "@smithy/types";
6
- export interface UpdateArnablesRequestMiddlewareConfig {
7
- isCustomEndpoint?: boolean;
8
- useFipsEndpoint: Provider<boolean>;
9
- }
10
- export declare const updateArnablesRequestMiddleware: (
11
- config: UpdateArnablesRequestMiddlewareConfig
12
- ) => SerializeMiddleware<any, any>;
13
- export declare const updateArnablesRequestMiddlewareOptions: RelativeMiddlewareOptions;
@@ -1,22 +0,0 @@
1
- import {
2
- BuildHandlerOptions,
3
- BuildMiddleware,
4
- Pluggable,
5
- Provider,
6
- } from "@smithy/types";
7
- import { S3ControlResolvedConfig } from "./configurations";
8
- type InputType = {
9
- OutpostId?: string;
10
- };
11
- export interface RedirectFromPostIdMiddlewareConfig {
12
- isCustomEndpoint?: boolean;
13
- useFipsEndpoint: Provider<boolean>;
14
- }
15
- export declare const redirectFromPostIdMiddleware: (
16
- config: RedirectFromPostIdMiddlewareConfig
17
- ) => BuildMiddleware<InputType, any>;
18
- export declare const redirectFromPostIdMiddlewareOptions: BuildHandlerOptions;
19
- export declare const getRedirectFromPostIdPlugin: (
20
- options: S3ControlResolvedConfig
21
- ) => Pluggable<any, any>;
22
- export {};