@aws-sdk/middleware-sdk-ec2 3.183.0 → 3.186.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 +8 -0
- package/dist-es/fixture.js +24 -17
- package/dist-es/index.js +57 -50
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-sdk-ec2
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/middleware-sdk-ec2
|
package/dist-es/fixture.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
update(data) { }
|
|
4
|
-
digest() {
|
|
5
|
-
return Promise.resolve(new Uint8Array(5));
|
|
1
|
+
var MockSha256 = (function () {
|
|
2
|
+
function MockSha256(secret) {
|
|
6
3
|
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
MockSha256.prototype.update = function (data) { };
|
|
5
|
+
MockSha256.prototype.digest = function () {
|
|
6
|
+
return Promise.resolve(new Uint8Array(5));
|
|
7
|
+
};
|
|
8
|
+
return MockSha256;
|
|
9
|
+
}());
|
|
10
|
+
export { MockSha256 };
|
|
11
|
+
export var region = function () { return Promise.resolve("mock-region"); };
|
|
12
|
+
export var endpoint = function () {
|
|
13
|
+
return Promise.resolve({
|
|
14
|
+
protocol: "https:",
|
|
15
|
+
path: "/",
|
|
16
|
+
hostname: "ec2.mock-region.amazonaws.com",
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export var credentials = function () {
|
|
20
|
+
return Promise.resolve({
|
|
21
|
+
accessKeyId: "akid",
|
|
22
|
+
secretAccessKey: "secret",
|
|
23
|
+
sessionToken: "session",
|
|
24
|
+
});
|
|
25
|
+
};
|
package/dist-es/index.js
CHANGED
|
@@ -1,64 +1,71 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
2
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
2
3
|
import { SignatureV4 } from "@aws-sdk/signature-v4";
|
|
3
4
|
import { formatUrl } from "@aws-sdk/util-format-url";
|
|
4
|
-
|
|
5
|
+
var version = "2016-11-15";
|
|
5
6
|
export function copySnapshotPresignedUrlMiddleware(options) {
|
|
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
|
-
|
|
7
|
+
var _this = this;
|
|
8
|
+
return function (next) {
|
|
9
|
+
return function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
10
|
+
var input, region, resolvedEndpoint, regionInfo, request, signer, presignedRequest;
|
|
11
|
+
return __generator(this, function (_a) {
|
|
12
|
+
switch (_a.label) {
|
|
13
|
+
case 0:
|
|
14
|
+
input = args.input;
|
|
15
|
+
if (!!input.PresignedUrl) return [3, 7];
|
|
16
|
+
return [4, options.region()];
|
|
17
|
+
case 1:
|
|
18
|
+
region = _a.sent();
|
|
19
|
+
return [4, options.endpoint()];
|
|
20
|
+
case 2:
|
|
21
|
+
resolvedEndpoint = _a.sent();
|
|
22
|
+
if (!(typeof options.regionInfoProvider === "function")) return [3, 4];
|
|
23
|
+
return [4, options.regionInfoProvider(input.SourceRegion)];
|
|
24
|
+
case 3:
|
|
25
|
+
regionInfo = _a.sent();
|
|
26
|
+
resolvedEndpoint.hostname = (regionInfo === null || regionInfo === void 0 ? void 0 : regionInfo.hostname) || "ec2.".concat(input.SourceRegion, ".amazonaws.com");
|
|
27
|
+
return [3, 5];
|
|
28
|
+
case 4:
|
|
29
|
+
resolvedEndpoint.hostname = "ec2.".concat(input.SourceRegion, ".amazonaws.com");
|
|
30
|
+
_a.label = 5;
|
|
31
|
+
case 5:
|
|
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
|
+
}
|
|
31
57
|
});
|
|
32
|
-
|
|
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);
|
|
58
|
+
}); };
|
|
52
59
|
};
|
|
53
60
|
}
|
|
54
|
-
export
|
|
61
|
+
export var copySnapshotPresignedUrlMiddlewareOptions = {
|
|
55
62
|
step: "initialize",
|
|
56
63
|
tags: ["CROSS_REGION_PRESIGNED_URL"],
|
|
57
64
|
name: "crossRegionPresignedUrlMiddleware",
|
|
58
65
|
override: true,
|
|
59
66
|
};
|
|
60
|
-
export
|
|
61
|
-
applyToStack: (clientStack)
|
|
67
|
+
export var getCopySnapshotPresignedUrlPlugin = function (config) { return ({
|
|
68
|
+
applyToStack: function (clientStack) {
|
|
62
69
|
clientStack.add(copySnapshotPresignedUrlMiddleware(config), copySnapshotPresignedUrlMiddlewareOptions);
|
|
63
70
|
},
|
|
64
|
-
});
|
|
71
|
+
}); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-ec2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.186.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.186.0",
|
|
24
|
+
"@aws-sdk/signature-v4": "3.186.0",
|
|
25
|
+
"@aws-sdk/types": "3.186.0",
|
|
26
|
+
"@aws-sdk/util-format-url": "3.186.0",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|