@aws-sdk/middleware-sdk-rds 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 +61 -52
- 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-rds
|
|
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-rds
|
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,82 +1,91 @@
|
|
|
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
|
-
|
|
5
|
+
var regARN = /arn:[\w+=/,.@-]+:[\w+=/,.@-]+:([\w+=/,.@-]*)?:[0-9]+:[\w+=/,.@-]+(:[\w+=/,.@-]+)?(:[\w+=/,.@-]+)?/;
|
|
6
|
+
var sourceIdToCommandKeyMap = {
|
|
6
7
|
SourceDBSnapshotIdentifier: "CopyDBSnapshot",
|
|
7
8
|
SourceDBInstanceIdentifier: "CreateDBInstanceReadReplica",
|
|
8
9
|
ReplicationSourceIdentifier: "CreateDBCluster",
|
|
9
10
|
SourceDBClusterSnapshotIdentifier: "CopyDBClusterSnapshot",
|
|
10
11
|
SourceDBInstanceArn: "StartDBInstanceAutomatedBackupsReplication",
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
var version = "2014-10-31";
|
|
13
14
|
export function crossRegionPresignedUrlMiddleware(options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
var _this = this;
|
|
16
|
+
return function (next) {
|
|
17
|
+
return function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
18
|
+
var input, region, sourceIdKey, command, sourceRegion, resolvedEndpoint, request, signer, presignedRequest;
|
|
19
|
+
var _a;
|
|
20
|
+
return __generator(this, function (_b) {
|
|
21
|
+
switch (_b.label) {
|
|
22
|
+
case 0:
|
|
23
|
+
input = args.input;
|
|
24
|
+
return [4, options.region()];
|
|
25
|
+
case 1:
|
|
26
|
+
region = _b.sent();
|
|
27
|
+
sourceIdKey = Object.keys(sourceIdToCommandKeyMap).filter(function (sourceKeyId) {
|
|
28
|
+
return input.hasOwnProperty(sourceKeyId);
|
|
29
|
+
})[0];
|
|
30
|
+
if (!sourceIdKey)
|
|
31
|
+
return [2, next(args)];
|
|
32
|
+
command = sourceIdToCommandKeyMap[sourceIdKey];
|
|
33
|
+
if (!(!input.PreSignedUrl && isARN(input[sourceIdKey]) && region !== getEndpointFromARN(input[sourceIdKey]))) return [3, 4];
|
|
34
|
+
sourceRegion = getEndpointFromARN(input[sourceIdKey]);
|
|
35
|
+
return [4, options.endpoint()];
|
|
36
|
+
case 2:
|
|
37
|
+
resolvedEndpoint = _b.sent();
|
|
38
|
+
resolvedEndpoint.hostname = "rds.".concat(sourceRegion, ".amazonaws.com");
|
|
39
|
+
request = new HttpRequest(__assign(__assign({}, resolvedEndpoint), { protocol: "https", headers: {
|
|
40
|
+
host: resolvedEndpoint.hostname,
|
|
41
|
+
}, query: (_a = {
|
|
42
|
+
Action: command,
|
|
43
|
+
Version: version,
|
|
44
|
+
KmsKeyId: input.KmsKeyId,
|
|
45
|
+
DestinationRegion: region
|
|
46
|
+
},
|
|
47
|
+
_a[sourceIdKey] = input[sourceIdKey],
|
|
48
|
+
_a) }));
|
|
49
|
+
signer = new SignatureV4({
|
|
50
|
+
credentials: options.credentials,
|
|
51
|
+
region: sourceRegion,
|
|
52
|
+
service: "rds",
|
|
53
|
+
sha256: options.sha256,
|
|
54
|
+
uriEscapePath: options.signingEscapePath,
|
|
55
|
+
});
|
|
56
|
+
return [4, signer.presign(request, {
|
|
57
|
+
expiresIn: 3600,
|
|
58
|
+
})];
|
|
59
|
+
case 3:
|
|
60
|
+
presignedRequest = _b.sent();
|
|
61
|
+
args = __assign(__assign({}, args), { input: __assign(__assign({}, args.input), { PreSignedUrl: formatUrl(presignedRequest) }) });
|
|
62
|
+
_b.label = 4;
|
|
63
|
+
case 4: return [2, next(args)];
|
|
64
|
+
}
|
|
38
65
|
});
|
|
39
|
-
|
|
40
|
-
credentials: options.credentials,
|
|
41
|
-
region: sourceRegion,
|
|
42
|
-
service: "rds",
|
|
43
|
-
sha256: options.sha256,
|
|
44
|
-
uriEscapePath: options.signingEscapePath,
|
|
45
|
-
});
|
|
46
|
-
const presignedRequest = await signer.presign(request, {
|
|
47
|
-
expiresIn: 3600,
|
|
48
|
-
});
|
|
49
|
-
args = {
|
|
50
|
-
...args,
|
|
51
|
-
input: {
|
|
52
|
-
...args.input,
|
|
53
|
-
PreSignedUrl: formatUrl(presignedRequest),
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return next(args);
|
|
66
|
+
}); };
|
|
58
67
|
};
|
|
59
68
|
}
|
|
60
|
-
export
|
|
69
|
+
export var crossRegionPresignedUrlMiddlewareOptions = {
|
|
61
70
|
step: "initialize",
|
|
62
71
|
tags: ["CROSS_REGION_PRESIGNED_URL"],
|
|
63
72
|
name: "crossRegionPresignedUrlMiddleware",
|
|
64
73
|
override: true,
|
|
65
74
|
};
|
|
66
|
-
export
|
|
67
|
-
applyToStack: (clientStack)
|
|
75
|
+
export var getCrossRegionPresignedUrlPlugin = function (config) { return ({
|
|
76
|
+
applyToStack: function (clientStack) {
|
|
68
77
|
clientStack.add(crossRegionPresignedUrlMiddleware(config), crossRegionPresignedUrlMiddlewareOptions);
|
|
69
78
|
},
|
|
70
|
-
});
|
|
79
|
+
}); };
|
|
71
80
|
function isARN(id) {
|
|
72
81
|
if (!id)
|
|
73
82
|
return false;
|
|
74
83
|
return regARN.test(id);
|
|
75
84
|
}
|
|
76
85
|
function getEndpointFromARN(arn) {
|
|
77
|
-
|
|
86
|
+
var arnArr = arn.split(":");
|
|
78
87
|
if (arnArr.length < 4) {
|
|
79
|
-
throw new Error(
|
|
88
|
+
throw new Error("Cannot infer endpoint from '".concat(arn, "'"));
|
|
80
89
|
}
|
|
81
90
|
return arnArr[3];
|
|
82
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-rds",
|
|
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": {
|