@aws-sdk/middleware-sdk-ec2 3.171.0 → 3.183.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 +16 -0
- package/dist-es/fixture.js +17 -24
- package/dist-es/index.js +50 -57
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-ec2
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-ec2
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.171.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.170.0...v3.171.0) (2022-09-14)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @aws-sdk/middleware-sdk-ec2
|
package/dist-es/fixture.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
MockSha256.prototype.digest = function () {
|
|
1
|
+
export class MockSha256 {
|
|
2
|
+
constructor(secret) { }
|
|
3
|
+
update(data) { }
|
|
4
|
+
digest() {
|
|
6
5
|
return Promise.resolve(new Uint8Array(5));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.resolve({
|
|
21
|
-
accessKeyId: "akid",
|
|
22
|
-
secretAccessKey: "secret",
|
|
23
|
-
sessionToken: "session",
|
|
24
|
-
});
|
|
25
|
-
};
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export const region = () => Promise.resolve("mock-region");
|
|
9
|
+
export const endpoint = () => Promise.resolve({
|
|
10
|
+
protocol: "https:",
|
|
11
|
+
path: "/",
|
|
12
|
+
hostname: "ec2.mock-region.amazonaws.com",
|
|
13
|
+
});
|
|
14
|
+
export const credentials = () => Promise.resolve({
|
|
15
|
+
accessKeyId: "akid",
|
|
16
|
+
secretAccessKey: "secret",
|
|
17
|
+
sessionToken: "session",
|
|
18
|
+
});
|
package/dist-es/index.js
CHANGED
|
@@ -1,71 +1,64 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { SignatureV4 } from "@aws-sdk/signature-v4";
|
|
4
3
|
import { formatUrl } from "@aws-sdk/util-format-url";
|
|
5
|
-
|
|
4
|
+
const version = "2016-11-15";
|
|
6
5
|
export function copySnapshotPresignedUrlMiddleware(options) {
|
|
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
|
-
request = new HttpRequest(__assign(__assign({}, resolvedEndpoint), { protocol: "https", headers: {
|
|
33
|
-
host: resolvedEndpoint.hostname,
|
|
34
|
-
}, query: {
|
|
35
|
-
Action: "CopySnapshot",
|
|
36
|
-
Version: version,
|
|
37
|
-
SourceRegion: input.SourceRegion,
|
|
38
|
-
SourceSnapshotId: input.SourceSnapshotId,
|
|
39
|
-
DestinationRegion: region,
|
|
40
|
-
} }));
|
|
41
|
-
signer = new SignatureV4({
|
|
42
|
-
credentials: options.credentials,
|
|
43
|
-
region: input.SourceRegion,
|
|
44
|
-
service: "ec2",
|
|
45
|
-
sha256: options.sha256,
|
|
46
|
-
uriEscapePath: options.signingEscapePath,
|
|
47
|
-
});
|
|
48
|
-
return [4, signer.presign(request, {
|
|
49
|
-
expiresIn: 3600,
|
|
50
|
-
})];
|
|
51
|
-
case 6:
|
|
52
|
-
presignedRequest = _a.sent();
|
|
53
|
-
args = __assign(__assign({}, args), { input: __assign(__assign({}, args.input), { DestinationRegion: region, PresignedUrl: formatUrl(presignedRequest) }) });
|
|
54
|
-
_a.label = 7;
|
|
55
|
-
case 7: return [2, next(args)];
|
|
56
|
-
}
|
|
6
|
+
return (next) => async (args) => {
|
|
7
|
+
const { input } = args;
|
|
8
|
+
if (!input.PresignedUrl) {
|
|
9
|
+
const region = await options.region();
|
|
10
|
+
const resolvedEndpoint = await options.endpoint();
|
|
11
|
+
if (typeof options.regionInfoProvider === "function") {
|
|
12
|
+
const regionInfo = await options.regionInfoProvider(input.SourceRegion);
|
|
13
|
+
resolvedEndpoint.hostname = regionInfo?.hostname || `ec2.${input.SourceRegion}.amazonaws.com`;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
resolvedEndpoint.hostname = `ec2.${input.SourceRegion}.amazonaws.com`;
|
|
17
|
+
}
|
|
18
|
+
const request = new HttpRequest({
|
|
19
|
+
...resolvedEndpoint,
|
|
20
|
+
protocol: "https",
|
|
21
|
+
headers: {
|
|
22
|
+
host: resolvedEndpoint.hostname,
|
|
23
|
+
},
|
|
24
|
+
query: {
|
|
25
|
+
Action: "CopySnapshot",
|
|
26
|
+
Version: version,
|
|
27
|
+
SourceRegion: input.SourceRegion,
|
|
28
|
+
SourceSnapshotId: input.SourceSnapshotId,
|
|
29
|
+
DestinationRegion: region,
|
|
30
|
+
},
|
|
57
31
|
});
|
|
58
|
-
|
|
32
|
+
const signer = new SignatureV4({
|
|
33
|
+
credentials: options.credentials,
|
|
34
|
+
region: input.SourceRegion,
|
|
35
|
+
service: "ec2",
|
|
36
|
+
sha256: options.sha256,
|
|
37
|
+
uriEscapePath: options.signingEscapePath,
|
|
38
|
+
});
|
|
39
|
+
const presignedRequest = await signer.presign(request, {
|
|
40
|
+
expiresIn: 3600,
|
|
41
|
+
});
|
|
42
|
+
args = {
|
|
43
|
+
...args,
|
|
44
|
+
input: {
|
|
45
|
+
...args.input,
|
|
46
|
+
DestinationRegion: region,
|
|
47
|
+
PresignedUrl: formatUrl(presignedRequest),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return next(args);
|
|
59
52
|
};
|
|
60
53
|
}
|
|
61
|
-
export
|
|
54
|
+
export const copySnapshotPresignedUrlMiddlewareOptions = {
|
|
62
55
|
step: "initialize",
|
|
63
56
|
tags: ["CROSS_REGION_PRESIGNED_URL"],
|
|
64
57
|
name: "crossRegionPresignedUrlMiddleware",
|
|
65
58
|
override: true,
|
|
66
59
|
};
|
|
67
|
-
export
|
|
68
|
-
applyToStack:
|
|
60
|
+
export const getCopySnapshotPresignedUrlPlugin = (config) => ({
|
|
61
|
+
applyToStack: (clientStack) => {
|
|
69
62
|
clientStack.add(copySnapshotPresignedUrlMiddleware(config), copySnapshotPresignedUrlMiddlewareOptions);
|
|
70
63
|
},
|
|
71
|
-
});
|
|
64
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-ec2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.183.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,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/protocol-http": "3.
|
|
24
|
-
"@aws-sdk/signature-v4": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
26
|
-
"@aws-sdk/util-format-url": "3.
|
|
23
|
+
"@aws-sdk/protocol-http": "3.183.0",
|
|
24
|
+
"@aws-sdk/signature-v4": "3.183.0",
|
|
25
|
+
"@aws-sdk/types": "3.183.0",
|
|
26
|
+
"@aws-sdk/util-format-url": "3.183.0",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|