@aws-sdk/middleware-sdk-ec2 3.899.0 → 3.908.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/index.js +84 -124
- package/package.json +8 -8
package/dist-cjs/index.js
CHANGED
|
@@ -1,132 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var import_util_format_url = require("@aws-sdk/util-format-url");
|
|
30
|
-
var import_middleware_endpoint = require("@smithy/middleware-endpoint");
|
|
31
|
-
var import_protocol_http = require("@smithy/protocol-http");
|
|
32
|
-
var import_signature_v4 = require("@smithy/signature-v4");
|
|
33
|
-
var import_smithy_client = require("@smithy/smithy-client");
|
|
34
|
-
var version = "2016-11-15";
|
|
3
|
+
var utilFormatUrl = require('@aws-sdk/util-format-url');
|
|
4
|
+
var middlewareEndpoint = require('@smithy/middleware-endpoint');
|
|
5
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
6
|
+
var signatureV4 = require('@smithy/signature-v4');
|
|
7
|
+
var smithyClient = require('@smithy/smithy-client');
|
|
8
|
+
|
|
9
|
+
const version = "2016-11-15";
|
|
35
10
|
function copySnapshotPresignedUrlMiddleware(options) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
11
|
+
return (next, context) => async (args) => {
|
|
12
|
+
const { input } = args;
|
|
13
|
+
if (!input.PresignedUrl) {
|
|
14
|
+
const destinationRegion = await options.region();
|
|
15
|
+
const endpoint = await middlewareEndpoint.getEndpointFromInstructions(input, {
|
|
16
|
+
getEndpointParameterInstructions() {
|
|
17
|
+
return {
|
|
18
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
19
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
20
|
+
Region: { type: "builtInParams", name: "region" },
|
|
21
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
}, {
|
|
25
|
+
...options,
|
|
26
|
+
region: input.SourceRegion,
|
|
27
|
+
});
|
|
28
|
+
const resolvedEndpoint = typeof options.endpoint === "function" ? await options.endpoint() : middlewareEndpoint.toEndpointV1(endpoint);
|
|
29
|
+
const requestToSign = new protocolHttp.HttpRequest({
|
|
30
|
+
...resolvedEndpoint,
|
|
31
|
+
protocol: "https",
|
|
32
|
+
headers: {
|
|
33
|
+
host: resolvedEndpoint.hostname,
|
|
34
|
+
},
|
|
35
|
+
query: {
|
|
36
|
+
...Object.entries(input).reduce((acc, [k, v]) => {
|
|
37
|
+
acc[k] = String(v ?? "");
|
|
38
|
+
return acc;
|
|
39
|
+
}, {}),
|
|
40
|
+
Action: "CopySnapshot",
|
|
41
|
+
Version: version,
|
|
42
|
+
DestinationRegion: destinationRegion,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const signer = new signatureV4.SignatureV4({
|
|
46
|
+
credentials: options.credentials,
|
|
47
|
+
region: input.SourceRegion,
|
|
48
|
+
service: "ec2",
|
|
49
|
+
sha256: options.sha256,
|
|
50
|
+
uriEscapePath: options.signingEscapePath,
|
|
51
|
+
});
|
|
52
|
+
const presignedRequest = await signer.presign(requestToSign, {
|
|
53
|
+
expiresIn: 3600,
|
|
54
|
+
});
|
|
55
|
+
args = {
|
|
56
|
+
...args,
|
|
57
|
+
input: {
|
|
58
|
+
...args.input,
|
|
59
|
+
DestinationRegion: destinationRegion,
|
|
60
|
+
PresignedUrl: utilFormatUrl.formatUrl(presignedRequest),
|
|
61
|
+
},
|
|
53
62
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...resolvedEndpoint,
|
|
64
|
-
protocol: "https",
|
|
65
|
-
headers: {
|
|
66
|
-
host: resolvedEndpoint.hostname
|
|
67
|
-
},
|
|
68
|
-
query: {
|
|
69
|
-
// Values must be string instead of e.g. boolean
|
|
70
|
-
// because we need to sign the serialized form.
|
|
71
|
-
...Object.entries(input).reduce((acc, [k, v]) => {
|
|
72
|
-
acc[k] = String(v ?? "");
|
|
73
|
-
return acc;
|
|
74
|
-
}, {}),
|
|
75
|
-
Action: "CopySnapshot",
|
|
76
|
-
Version: version,
|
|
77
|
-
DestinationRegion: destinationRegion
|
|
63
|
+
if (protocolHttp.HttpRequest.isInstance(args.request)) {
|
|
64
|
+
const { request } = args;
|
|
65
|
+
if (!(request.body ?? "").includes("DestinationRegion=")) {
|
|
66
|
+
request.body += `&DestinationRegion=${destinationRegion}`;
|
|
67
|
+
}
|
|
68
|
+
if (!(request.body ?? "").includes("PresignedUrl=")) {
|
|
69
|
+
request.body += `&PresignedUrl=${smithyClient.extendedEncodeURIComponent(args.input.PresignedUrl)}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
78
72
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
credentials: options.credentials,
|
|
82
|
-
region: input.SourceRegion,
|
|
83
|
-
service: "ec2",
|
|
84
|
-
sha256: options.sha256,
|
|
85
|
-
uriEscapePath: options.signingEscapePath
|
|
86
|
-
});
|
|
87
|
-
const presignedRequest = await signer.presign(requestToSign, {
|
|
88
|
-
expiresIn: 3600
|
|
89
|
-
});
|
|
90
|
-
args = {
|
|
91
|
-
...args,
|
|
92
|
-
input: {
|
|
93
|
-
...args.input,
|
|
94
|
-
DestinationRegion: destinationRegion,
|
|
95
|
-
PresignedUrl: (0, import_util_format_url.formatUrl)(presignedRequest)
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
if (import_protocol_http.HttpRequest.isInstance(args.request)) {
|
|
99
|
-
const { request } = args;
|
|
100
|
-
if (!(request.body ?? "").includes("DestinationRegion=")) {
|
|
101
|
-
request.body += `&DestinationRegion=${destinationRegion}`;
|
|
102
|
-
}
|
|
103
|
-
if (!(request.body ?? "").includes("PresignedUrl=")) {
|
|
104
|
-
request.body += `&PresignedUrl=${(0, import_smithy_client.extendedEncodeURIComponent)(args.input.PresignedUrl)}`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return next(args);
|
|
109
|
-
};
|
|
73
|
+
return next(args);
|
|
74
|
+
};
|
|
110
75
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
toMiddleware: "endpointV2Middleware"
|
|
76
|
+
const copySnapshotPresignedUrlMiddlewareOptions = {
|
|
77
|
+
step: "serialize",
|
|
78
|
+
tags: ["CROSS_REGION_PRESIGNED_URL"],
|
|
79
|
+
name: "crossRegionPresignedUrlMiddleware",
|
|
80
|
+
override: true,
|
|
81
|
+
relation: "after",
|
|
82
|
+
toMiddleware: "endpointV2Middleware",
|
|
119
83
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}), "getCopySnapshotPresignedUrlPlugin");
|
|
125
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
-
|
|
127
|
-
0 && (module.exports = {
|
|
128
|
-
copySnapshotPresignedUrlMiddlewareOptions,
|
|
129
|
-
getCopySnapshotPresignedUrlPlugin,
|
|
130
|
-
copySnapshotPresignedUrlMiddleware
|
|
84
|
+
const getCopySnapshotPresignedUrlPlugin = (config) => ({
|
|
85
|
+
applyToStack: (clientStack) => {
|
|
86
|
+
clientStack.add(copySnapshotPresignedUrlMiddleware(config), copySnapshotPresignedUrlMiddlewareOptions);
|
|
87
|
+
},
|
|
131
88
|
});
|
|
132
89
|
|
|
90
|
+
exports.copySnapshotPresignedUrlMiddleware = copySnapshotPresignedUrlMiddleware;
|
|
91
|
+
exports.copySnapshotPresignedUrlMiddlewareOptions = copySnapshotPresignedUrlMiddlewareOptions;
|
|
92
|
+
exports.getCopySnapshotPresignedUrlPlugin = getCopySnapshotPresignedUrlPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-ec2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.908.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-sdk-ec2",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/types": "3.
|
|
30
|
-
"@aws-sdk/util-format-url": "3.
|
|
31
|
-
"@smithy/middleware-endpoint": "^4.
|
|
32
|
-
"@smithy/protocol-http": "^5.
|
|
33
|
-
"@smithy/signature-v4": "^5.
|
|
34
|
-
"@smithy/smithy-client": "^4.
|
|
35
|
-
"@smithy/types": "^4.
|
|
29
|
+
"@aws-sdk/types": "3.901.0",
|
|
30
|
+
"@aws-sdk/util-format-url": "3.901.0",
|
|
31
|
+
"@smithy/middleware-endpoint": "^4.3.1",
|
|
32
|
+
"@smithy/protocol-http": "^5.3.0",
|
|
33
|
+
"@smithy/signature-v4": "^5.3.0",
|
|
34
|
+
"@smithy/smithy-client": "^4.7.1",
|
|
35
|
+
"@smithy/types": "^4.6.0",
|
|
36
36
|
"tslib": "^2.6.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|