@cdkd/cli 0.332.0 → 0.333.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/asg-provider-DgbCqJIh.js +1406 -0
- package/dist/asg-provider-DgbCqJIh.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{db-instance-modify-retry-B1PdmL5X.js → db-instance-modify-retry-DIOZy8ML.js} +3 -3
- package/dist/{db-instance-modify-retry-B1PdmL5X.js.map → db-instance-modify-retry-DIOZy8ML.js.map} +1 -1
- package/dist/{deploy-engine-5GASWIYI.js → deploy-engine-1ZXSkp13.js} +2204 -2056
- package/dist/deploy-engine-1ZXSkp13.js.map +1 -0
- package/dist/iam-role-provider-D7lZBTKM.js +756 -0
- package/dist/iam-role-provider-D7lZBTKM.js.map +1 -0
- package/dist/index.d.ts +166 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/neptune-provider-B1o5gxWk.js +1644 -0
- package/dist/neptune-provider-B1o5gxWk.js.map +1 -0
- package/dist/{program-CaHG8EBB.js → program-BEkGI_kM.js} +5 -5
- package/dist/{program-CaHG8EBB.js.map → program-BEkGI_kM.js.map} +1 -1
- package/dist/{provider-classes-DdGvWb5T.js → provider-classes-Ce_PccaV.js} +35815 -31978
- package/dist/provider-classes-Ce_PccaV.js.map +1 -0
- package/dist/{rds-provider-BI5PcgWT.js → rds-provider-CpoJl-ki.js} +4 -4
- package/dist/{rds-provider-BI5PcgWT.js.map → rds-provider-CpoJl-ki.js.map} +1 -1
- package/dist/{created-resource-sink-DBYrPwKg.js → update-removal-B3ZdAPZ2.js} +119 -119
- package/dist/update-removal-B3ZdAPZ2.js.map +1 -0
- package/dist/{version-DXx2w7jk.js → version-CdcuSvWX.js} +2 -2
- package/dist/{version-DXx2w7jk.js.map → version-CdcuSvWX.js.map} +1 -1
- package/package.json +1 -1
- package/dist/asg-provider-CwwgTp0h.js +0 -1277
- package/dist/asg-provider-CwwgTp0h.js.map +0 -1
- package/dist/created-resource-sink-DBYrPwKg.js.map +0 -1
- package/dist/deploy-engine-5GASWIYI.js.map +0 -1
- package/dist/iam-role-provider-Cp9ASoIg.js +0 -698
- package/dist/iam-role-provider-Cp9ASoIg.js.map +0 -1
- package/dist/neptune-provider-C9IhSshh.js +0 -1438
- package/dist/neptune-provider-C9IhSshh.js.map +0 -1
- package/dist/provider-classes-DdGvWb5T.js.map +0 -1
|
@@ -0,0 +1,1644 @@
|
|
|
1
|
+
import { $ as safeMsg, E as generatedNameFor, n as describeAwsFailure, s as getLogger } from "./aws-failure-text-DiHodi76.js";
|
|
2
|
+
import { B as resolveExplicitPhysicalId, Ft as maskerOrIdentity, Gt as markAuxiliaryFailure, H as assertRegionMatch, I as normalizeAwsTagsToCfn, J as deleteAfterProtectionFlipWithFinalSnapshot, K as ProtectionFlipRegistry, Kt as markCreatedBeforeFailure, Mr as markRedactedCause, Nn as ProvisioningError, Nr as wrapMaskedAwsError, Q as isTerminalDbWaitStatus, V as RESOURCE_NOT_FOUND, W as markNotGone, Y as deleteWithProtectionCompensation, Z as isProceedDbStatus, fn as ambientClientDefaults, hr as relayedNameCollision, i as removedTemplateKeys, j as withoutServerErrorRetries, jr as markNonRetryable, nt as protectionFlipKey, rt as rdsFamilyProtectionSite, t as clearOnUpdateRemoval, tt as observeThenDisableProtection, u as reportCreatedResource } from "./update-removal-B3ZdAPZ2.js";
|
|
3
|
+
import { c as ambientRegion } from "./aws-client-defaults-BLXFsfMa.js";
|
|
4
|
+
import { $i as refuseMalformedDesiredTags, Dt as enclosingDeadlineRemainingMs, Ji as stringifyIfAssigned, La as isUsableAttemptedName, Vr as refuseRestoreFromItself, Zi as planTagDiff, gc as configBooleanRefusal, mc as coerceCfnBoolean, qi as definedAttributes, ta as tagPlanWarning } from "./deploy-engine-1ZXSkp13.js";
|
|
5
|
+
import { a as associatedRoleList, c as canonicalAssociatedRoles, i as associatedRoleKey, l as isRoleCallNotAvailableRefusal, n as modifyDbInstanceWhenAvailable, o as associatedRolesNamed, r as associatedRoleArns, s as associatedRolesReadback, t as isModifyNotAvailableRefusal, u as planAssociatedRoleChanges } from "./db-instance-modify-retry-DIOZy8ML.js";
|
|
6
|
+
import { DescribeSecurityGroupsCommand, EC2Client } from "@aws-sdk/client-ec2";
|
|
7
|
+
import { isDeepStrictEqual } from "node:util";
|
|
8
|
+
import { AddRoleToDBClusterCommand, AddTagsToResourceCommand, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBSubnetGroupCommand, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBSubnetGroupCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeDBSubnetGroupsCommand, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBSubnetGroupCommand, NeptuneClient, RemoveRoleFromDBClusterCommand, RemoveTagsFromResourceCommand, RestoreDBClusterFromSnapshotCommand, RestoreDBClusterToPointInTimeCommand } from "@aws-sdk/client-neptune";
|
|
9
|
+
|
|
10
|
+
// src/provisioning/providers/neptune/shared.ts
|
|
11
|
+
function clusterAttributes(cluster) {
|
|
12
|
+
return definedAttributes({
|
|
13
|
+
Endpoint: cluster?.Endpoint,
|
|
14
|
+
Port: stringifyIfAssigned(cluster?.Port),
|
|
15
|
+
ReadEndpoint: cluster?.ReaderEndpoint,
|
|
16
|
+
"Endpoint.Address": cluster?.Endpoint,
|
|
17
|
+
"Endpoint.Port": stringifyIfAssigned(cluster?.Port),
|
|
18
|
+
"ReadEndpoint.Address": cluster?.ReaderEndpoint,
|
|
19
|
+
ClusterResourceId: cluster?.DbClusterResourceId
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function instanceAttributes(instance) {
|
|
23
|
+
return definedAttributes({
|
|
24
|
+
Endpoint: instance?.Endpoint?.Address,
|
|
25
|
+
Port: stringifyIfAssigned(instance?.Endpoint?.Port),
|
|
26
|
+
"Endpoint.Address": instance?.Endpoint?.Address,
|
|
27
|
+
"Endpoint.Port": stringifyIfAssigned(instance?.Endpoint?.Port),
|
|
28
|
+
Arn: instance?.DBInstanceArn
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function isDbIdentifier(id) {
|
|
32
|
+
return id.length <= 63 && /^[A-Za-z](?:-?[A-Za-z0-9])*$/.test(id);
|
|
33
|
+
}
|
|
34
|
+
const CLUSTER_KEPT_ON_REMOVAL = [
|
|
35
|
+
"EngineVersion",
|
|
36
|
+
"PreferredBackupWindow",
|
|
37
|
+
"PreferredMaintenanceWindow",
|
|
38
|
+
"DBClusterParameterGroupName",
|
|
39
|
+
"DeletionProtection",
|
|
40
|
+
"IamAuthEnabled",
|
|
41
|
+
"BackupRetentionPeriod",
|
|
42
|
+
"DBPort",
|
|
43
|
+
"Port",
|
|
44
|
+
"CopyTagsToSnapshot"
|
|
45
|
+
];
|
|
46
|
+
const INSTANCE_KEPT_ON_REMOVAL = [
|
|
47
|
+
"DBParameterGroupName",
|
|
48
|
+
"PreferredMaintenanceWindow",
|
|
49
|
+
"AutoMinorVersionUpgrade"
|
|
50
|
+
];
|
|
51
|
+
function isPlainObject(value) {
|
|
52
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53
|
+
}
|
|
54
|
+
function stringList(value) {
|
|
55
|
+
if (value == null) return [];
|
|
56
|
+
if (!Array.isArray(value)) return void 0;
|
|
57
|
+
return value.every((item) => typeof item === "string") ? value : void 0;
|
|
58
|
+
}
|
|
59
|
+
function logExportChange(desired, previous) {
|
|
60
|
+
const enable = desired.filter((type) => !previous.includes(type));
|
|
61
|
+
const disable = previous.filter((type) => !desired.includes(type));
|
|
62
|
+
if (enable.length === 0 && disable.length === 0) return void 0;
|
|
63
|
+
return {
|
|
64
|
+
...enable.length > 0 && { EnableLogTypes: enable },
|
|
65
|
+
...disable.length > 0 && { DisableLogTypes: disable }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function serverlessScalingToSend(value) {
|
|
69
|
+
if (value == null) return void 0;
|
|
70
|
+
if (!isPlainObject(value)) return null;
|
|
71
|
+
const min = cfnCapacity(value["MinCapacity"]);
|
|
72
|
+
const max = cfnCapacity(value["MaxCapacity"]);
|
|
73
|
+
if (min === void 0 || max === void 0) return null;
|
|
74
|
+
return {
|
|
75
|
+
MinCapacity: min,
|
|
76
|
+
MaxCapacity: max
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function cfnCapacity(value) {
|
|
80
|
+
const capacity = typeof value === "number" || typeof value === "string" && value.trim() !== "" ? Number(value) : NaN;
|
|
81
|
+
return Number.isFinite(capacity) ? capacity : void 0;
|
|
82
|
+
}
|
|
83
|
+
function isMajorEngineChange(previous, desired) {
|
|
84
|
+
if (typeof previous !== "string" || typeof desired !== "string") return false;
|
|
85
|
+
const major = (version) => version.split(".").slice(0, 2).join(".");
|
|
86
|
+
return major(previous) !== major(desired);
|
|
87
|
+
}
|
|
88
|
+
function holdsPendingValue(value) {
|
|
89
|
+
if (value === void 0 || value === null) return false;
|
|
90
|
+
if (typeof value === "object") return Object.values(value).some(holdsPendingValue);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function isUnmovingDbStatus(status) {
|
|
94
|
+
return isProceedDbStatus(status) || status === "backing-up";
|
|
95
|
+
}
|
|
96
|
+
const SETTLE_MAX_WAIT_MS = 3e5;
|
|
97
|
+
const ROLE_AVAILABLE_MAX_WAIT_MS = 18e5;
|
|
98
|
+
const CLUSTER_AVAILABLE_MAX_WAIT_MS = 18e5;
|
|
99
|
+
function isRestoringClusterRefusal(error) {
|
|
100
|
+
return error instanceof Error && error.name === "InvalidDBClusterStateFault" && /(?:isn't|is not|isn’t) available for modification with status/i.test(error.message);
|
|
101
|
+
}
|
|
102
|
+
const DEADLINE_MARGIN_MS = 3e4;
|
|
103
|
+
const DEFAULT_CLUSTER_PORT = 8182;
|
|
104
|
+
const DEFAULT_STORAGE_KEY = "alias/aws/rds";
|
|
105
|
+
const DEFAULT_RESTORED_BACKUP_RETENTION = 1;
|
|
106
|
+
function restoreWaitMs() {
|
|
107
|
+
const remaining = enclosingDeadlineRemainingMs() - DEADLINE_MARGIN_MS;
|
|
108
|
+
return Number.isFinite(remaining) ? Math.max(CLUSTER_AVAILABLE_MAX_WAIT_MS, remaining) : CLUSTER_AVAILABLE_MAX_WAIT_MS;
|
|
109
|
+
}
|
|
110
|
+
const RESTORE_VALUE_REFUSALS = /* @__PURE__ */ new Set(["InvalidParameterValue", "InvalidParameterCombination"]);
|
|
111
|
+
function readClusterRestore(properties, resourceType, logicalId) {
|
|
112
|
+
const refuse = (key, expected) => {
|
|
113
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`Neptune DBCluster ${logicalId}: ${key} must be ${expected}; nothing was changed.`, resourceType, logicalId));
|
|
114
|
+
};
|
|
115
|
+
const identifier = (key) => {
|
|
116
|
+
const value = properties[key];
|
|
117
|
+
if (value == null) return void 0;
|
|
118
|
+
return typeof value === "string" ? value : refuse(key, "a string");
|
|
119
|
+
};
|
|
120
|
+
const snapshotIdentifier = identifier("SnapshotIdentifier") || void 0;
|
|
121
|
+
const sourceDBClusterIdentifier = identifier("SourceDBClusterIdentifier") || void 0;
|
|
122
|
+
if (sourceDBClusterIdentifier !== void 0) {
|
|
123
|
+
const declared = properties["RestoreToTime"];
|
|
124
|
+
const restoreToTime = declared == null ? void 0 : new Date(typeof declared !== "string" ? NaN : /(?:z|[+-]\d{2}:?\d{2})$/i.test(declared) ? declared : `${declared}Z`);
|
|
125
|
+
if (restoreToTime !== void 0 && Number.isNaN(restoreToTime.getTime())) return refuse("RestoreToTime", "a timestamp");
|
|
126
|
+
return {
|
|
127
|
+
kind: "point-in-time",
|
|
128
|
+
sourceDBClusterIdentifier,
|
|
129
|
+
restoreToTime
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return snapshotIdentifier === void 0 ? void 0 : {
|
|
133
|
+
kind: "snapshot",
|
|
134
|
+
snapshotIdentifier
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function ignoredRestoreKeys(restore) {
|
|
138
|
+
if (restore?.kind === "point-in-time") return ["SnapshotIdentifier", "AvailabilityZones"];
|
|
139
|
+
const pointInTimeKeys = [
|
|
140
|
+
"RestoreToTime",
|
|
141
|
+
"RestoreType",
|
|
142
|
+
"UseLatestRestorableTime"
|
|
143
|
+
];
|
|
144
|
+
return restore === void 0 ? [
|
|
145
|
+
"SnapshotIdentifier",
|
|
146
|
+
"SourceDBClusterIdentifier",
|
|
147
|
+
...pointInTimeKeys
|
|
148
|
+
] : ["SourceDBClusterIdentifier", ...pointInTimeKeys];
|
|
149
|
+
}
|
|
150
|
+
function declaresSnapshot(properties) {
|
|
151
|
+
return properties["SnapshotIdentifier"] != null && properties["SnapshotIdentifier"] !== "";
|
|
152
|
+
}
|
|
153
|
+
function isRestoredRecord(previous) {
|
|
154
|
+
return declaresSnapshot(previous) || previous["SourceDBClusterIdentifier"] != null && previous["SourceDBClusterIdentifier"] !== "";
|
|
155
|
+
}
|
|
156
|
+
function sentOnUpdate(properties, previous) {
|
|
157
|
+
return (key) => isRestoredRecord(previous) && isDeepStrictEqual(previous[key], properties[key]) ? void 0 : properties[key];
|
|
158
|
+
}
|
|
159
|
+
function restoreFollowUp(properties, restore, restoredEngineVersion) {
|
|
160
|
+
const nonEmpty = (members) => Object.keys(members).length > 0 ? members : void 0;
|
|
161
|
+
const declaredRetention = properties["BackupRetentionPeriod"];
|
|
162
|
+
const retention = declaredRetention != null ? Number(declaredRetention) : void 0;
|
|
163
|
+
const snapshotDeclared = declaresSnapshot(properties);
|
|
164
|
+
const pointInTime = restore.kind === "point-in-time";
|
|
165
|
+
const engineVersion = properties["EngineVersion"];
|
|
166
|
+
const engineChange = pointInTime && engineVersion != null && engineVersion !== restoredEngineVersion;
|
|
167
|
+
const majorUpgrade = engineChange && isMajorEngineChange(restoredEngineVersion, engineVersion);
|
|
168
|
+
return {
|
|
169
|
+
parity: nonEmpty({ ...snapshotDeclared && { BackupRetentionPeriod: retention ?? DEFAULT_RESTORED_BACKUP_RETENTION } }),
|
|
170
|
+
declared: [
|
|
171
|
+
nonEmpty({ ...!snapshotDeclared && retention !== void 0 && { BackupRetentionPeriod: retention } }),
|
|
172
|
+
nonEmpty({
|
|
173
|
+
...properties["PreferredBackupWindow"] != null && { PreferredBackupWindow: properties["PreferredBackupWindow"] },
|
|
174
|
+
...properties["PreferredMaintenanceWindow"] != null && { PreferredMaintenanceWindow: properties["PreferredMaintenanceWindow"] }
|
|
175
|
+
}),
|
|
176
|
+
nonEmpty({ ...pointInTime && properties["CopyTagsToSnapshot"] != null && { CopyTagsToSnapshot: properties["CopyTagsToSnapshot"] } }),
|
|
177
|
+
nonEmpty({
|
|
178
|
+
...pointInTime && properties["DBClusterParameterGroupName"] != null && { DBClusterParameterGroupName: properties["DBClusterParameterGroupName"] },
|
|
179
|
+
...engineChange && { EngineVersion: engineVersion },
|
|
180
|
+
...majorUpgrade && { AllowMajorVersionUpgrade: true },
|
|
181
|
+
...majorUpgrade && properties["DBInstanceParameterGroupName"] != null && { DBInstanceParameterGroupName: properties["DBInstanceParameterGroupName"] }
|
|
182
|
+
})
|
|
183
|
+
].filter((group) => group !== void 0)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
const CLUSTER_MODIFY_KEYS = [
|
|
187
|
+
"EngineVersion",
|
|
188
|
+
"DeletionProtection",
|
|
189
|
+
"BackupRetentionPeriod",
|
|
190
|
+
"PreferredBackupWindow",
|
|
191
|
+
"PreferredMaintenanceWindow",
|
|
192
|
+
"DBClusterParameterGroupName",
|
|
193
|
+
"IamAuthEnabled",
|
|
194
|
+
"VpcSecurityGroupIds",
|
|
195
|
+
"DBPort",
|
|
196
|
+
"Port",
|
|
197
|
+
"CopyTagsToSnapshot",
|
|
198
|
+
"NetworkType",
|
|
199
|
+
"ServerlessScalingConfiguration",
|
|
200
|
+
"EnableCloudwatchLogsExports"
|
|
201
|
+
];
|
|
202
|
+
const INSTANCE_MODIFY_KEYS = [
|
|
203
|
+
"DBInstanceClass",
|
|
204
|
+
"DBParameterGroupName",
|
|
205
|
+
"PreferredMaintenanceWindow",
|
|
206
|
+
"AutoMinorVersionUpgrade",
|
|
207
|
+
"DeletionProtection",
|
|
208
|
+
"PubliclyAccessible"
|
|
209
|
+
];
|
|
210
|
+
function markChangedUnsettled(keys, properties, previousProperties, context) {
|
|
211
|
+
for (const key of keys) if (!isDeepStrictEqual(properties[key], previousProperties[key])) context?.markUnsettled?.(key);
|
|
212
|
+
}
|
|
213
|
+
const CLUSTER_UNMEASURED_ON_REMOVAL = ["NetworkType", "ServerlessScalingConfiguration"];
|
|
214
|
+
function securityGroupListChanged(sent, previous) {
|
|
215
|
+
if (sent === void 0) return false;
|
|
216
|
+
const before = Array.isArray(previous) ? previous.filter((id) => typeof id === "string") : [];
|
|
217
|
+
return [...sent].sort().join(" ") !== [...before].sort().join(" ");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/provisioning/providers/neptune/core.ts
|
|
221
|
+
function getClient() {
|
|
222
|
+
if (!this.neptuneClient) {
|
|
223
|
+
this.neptuneClient = new NeptuneClient({
|
|
224
|
+
...ambientClientDefaults(),
|
|
225
|
+
...this.providerRegion ? { region: this.providerRegion } : {}
|
|
226
|
+
});
|
|
227
|
+
this.createClient = withoutServerErrorRetries(new NeptuneClient({
|
|
228
|
+
...ambientClientDefaults(),
|
|
229
|
+
...this.providerRegion ? { region: this.providerRegion } : {}
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
return this.neptuneClient;
|
|
233
|
+
}
|
|
234
|
+
function getEc2Client() {
|
|
235
|
+
if (!this.ec2Client) this.ec2Client = new EC2Client({
|
|
236
|
+
...ambientClientDefaults(),
|
|
237
|
+
...this.providerRegion ? { region: this.providerRegion } : {}
|
|
238
|
+
});
|
|
239
|
+
return this.ec2Client;
|
|
240
|
+
}
|
|
241
|
+
function getCreateClient() {
|
|
242
|
+
this.getClient();
|
|
243
|
+
return this.createClient;
|
|
244
|
+
}
|
|
245
|
+
async function create(logicalId, resourceType, properties, context) {
|
|
246
|
+
const mask = context?.maskSecrets;
|
|
247
|
+
switch (resourceType) {
|
|
248
|
+
case "AWS::Neptune::DBSubnetGroup": return this.createDBSubnetGroup(logicalId, resourceType, properties, mask);
|
|
249
|
+
case "AWS::Neptune::DBCluster": return this.createDBCluster(logicalId, resourceType, properties, mask, context?.replayingState === true);
|
|
250
|
+
case "AWS::Neptune::DBInstance": return this.createDBInstance(logicalId, resourceType, properties, mask, context?.replayingState === true);
|
|
251
|
+
default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async function update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
255
|
+
switch (resourceType) {
|
|
256
|
+
case "AWS::Neptune::DBSubnetGroup": return this.updateDBSubnetGroup(logicalId, physicalId, resourceType, properties, previousProperties, context?.maskSecrets);
|
|
257
|
+
case "AWS::Neptune::DBCluster": return this.updateDBCluster(logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
258
|
+
case "AWS::Neptune::DBInstance": return this.updateDBInstance(logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
259
|
+
default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function deleteImpl(logicalId, physicalId, resourceType, _properties, context) {
|
|
263
|
+
switch (resourceType) {
|
|
264
|
+
case "AWS::Neptune::DBSubnetGroup": return this.deleteDBSubnetGroup(logicalId, physicalId, resourceType, context);
|
|
265
|
+
case "AWS::Neptune::DBCluster": return this.deleteDBCluster(logicalId, physicalId, resourceType, context);
|
|
266
|
+
case "AWS::Neptune::DBInstance": return this.deleteDBInstance(logicalId, physicalId, resourceType, context);
|
|
267
|
+
default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function wrapCaughtError(mask, error, build) {
|
|
271
|
+
const m = maskerOrIdentity(mask);
|
|
272
|
+
const failure = describeAwsFailure(error);
|
|
273
|
+
if (!failure.redacted) return wrapMaskedAwsError(m, error, build);
|
|
274
|
+
this.logger.debug(m(build(m(failure.detail)).message));
|
|
275
|
+
const wrapped = build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`);
|
|
276
|
+
return error instanceof Error ? markRedactedCause(wrapped) : wrapped;
|
|
277
|
+
}
|
|
278
|
+
function wrapDeleteError(mask, error, build) {
|
|
279
|
+
const thrown = this.wrapCaughtError(mask, error, build);
|
|
280
|
+
return error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
|
|
281
|
+
}
|
|
282
|
+
async function applyTagDiff(arn, resourceType, logicalId, oldTagsRaw, newTagsRaw) {
|
|
283
|
+
const plan = planTagDiff(oldTagsRaw, newTagsRaw);
|
|
284
|
+
const tagWarning = tagPlanWarning(plan, resourceType, logicalId);
|
|
285
|
+
if (tagWarning !== void 0) this.logger.warn(tagWarning);
|
|
286
|
+
const tagsToAdd = [...plan.set].map(([Key, Value]) => ({
|
|
287
|
+
Key,
|
|
288
|
+
Value
|
|
289
|
+
}));
|
|
290
|
+
const tagsToRemove = plan.remove;
|
|
291
|
+
if (tagsToRemove.length > 0) {
|
|
292
|
+
await this.getClient().send(new RemoveTagsFromResourceCommand({
|
|
293
|
+
ResourceName: arn,
|
|
294
|
+
TagKeys: tagsToRemove
|
|
295
|
+
}));
|
|
296
|
+
this.logger.debug(`Removed ${tagsToRemove.length} tag(s) from Neptune resource ${arn}`);
|
|
297
|
+
}
|
|
298
|
+
if (tagsToAdd.length > 0) {
|
|
299
|
+
await this.getClient().send(new AddTagsToResourceCommand({
|
|
300
|
+
ResourceName: arn,
|
|
301
|
+
Tags: tagsToAdd
|
|
302
|
+
}));
|
|
303
|
+
this.logger.debug(`Added/updated ${tagsToAdd.length} tag(s) on Neptune resource ${arn}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function isNotFoundError(error, faultName) {
|
|
307
|
+
if (!(error instanceof Error)) return false;
|
|
308
|
+
const name = error.name ?? "";
|
|
309
|
+
const message = error.message.toLowerCase();
|
|
310
|
+
return name === faultName || message.includes("not found") || message.includes("does not exist");
|
|
311
|
+
}
|
|
312
|
+
async function isSameResource(journaledPhysicalId, record, resourceType, context) {
|
|
313
|
+
if (resourceType !== "AWS::Neptune::DBCluster" && resourceType !== "AWS::Neptune::DBInstance") return "unknown";
|
|
314
|
+
if (!isDbIdentifier(journaledPhysicalId) || !isDbIdentifier(record.physicalId)) return "unknown";
|
|
315
|
+
if (journaledPhysicalId.toLowerCase() === record.physicalId.toLowerCase()) return "same";
|
|
316
|
+
if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
|
|
317
|
+
const recordResourceId = await this.readDbResourceIdIfExists(resourceType, record.physicalId);
|
|
318
|
+
if (recordResourceId === void 0) return "unknown";
|
|
319
|
+
const journaledResourceId = await this.readDbResourceIdIfExists(resourceType, journaledPhysicalId);
|
|
320
|
+
if (journaledResourceId === void 0) return "different";
|
|
321
|
+
return journaledResourceId === recordResourceId ? "same" : "different";
|
|
322
|
+
}
|
|
323
|
+
async function resourceIdentity(physicalId, resourceType, context) {
|
|
324
|
+
if (resourceType !== "AWS::Neptune::DBCluster" && resourceType !== "AWS::Neptune::DBInstance") return;
|
|
325
|
+
if (!isDbIdentifier(physicalId)) return void 0;
|
|
326
|
+
if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
|
|
327
|
+
const live = await this.readDbResourceIdIfExists(resourceType, physicalId);
|
|
328
|
+
return live === void 0 ? RESOURCE_NOT_FOUND : live;
|
|
329
|
+
}
|
|
330
|
+
async function readDbResourceIdIfExists(resourceType, identifier) {
|
|
331
|
+
const isCluster = resourceType === "AWS::Neptune::DBCluster";
|
|
332
|
+
let found;
|
|
333
|
+
try {
|
|
334
|
+
if (isCluster) {
|
|
335
|
+
const cluster = await this.describeDBCluster(identifier);
|
|
336
|
+
found = cluster && {
|
|
337
|
+
identifier: cluster.DBClusterIdentifier,
|
|
338
|
+
engine: cluster.Engine,
|
|
339
|
+
resourceId: cluster.DbClusterResourceId
|
|
340
|
+
};
|
|
341
|
+
} else {
|
|
342
|
+
const instance = await this.describeDBInstance(identifier);
|
|
343
|
+
found = instance && {
|
|
344
|
+
identifier: instance.DBInstanceIdentifier,
|
|
345
|
+
engine: instance.Engine,
|
|
346
|
+
resourceId: instance.DbiResourceId
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
} catch (error) {
|
|
350
|
+
const notFound = isCluster ? "DBClusterNotFoundFault" : "DBInstanceNotFoundFault";
|
|
351
|
+
if (error?.name === notFound) return void 0;
|
|
352
|
+
throw error;
|
|
353
|
+
}
|
|
354
|
+
if (found === void 0) return void 0;
|
|
355
|
+
const api = isCluster ? "DescribeDBClusters" : "DescribeDBInstances";
|
|
356
|
+
if (found.identifier?.toLowerCase() !== identifier.toLowerCase()) throw new Error(`${api} answered for another identifier`);
|
|
357
|
+
if (found.engine !== "neptune") throw new Error(`${api} answered for a resource of another engine`);
|
|
358
|
+
if (typeof found.resourceId !== "string" || found.resourceId === "") throw new Error(`${api} returned no resource id`);
|
|
359
|
+
return found.resourceId;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// src/provisioning/providers/neptune/subnet-group.ts
|
|
363
|
+
async function createDBSubnetGroup(logicalId, resourceType, properties, mask) {
|
|
364
|
+
this.logger.debug(`Creating Neptune DBSubnetGroup ${logicalId}`);
|
|
365
|
+
const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
|
|
366
|
+
const dbSubnetGroupName = properties["DBSubnetGroupName"] || generatedNameFor("AWS::Neptune::DBSubnetGroup", logicalId);
|
|
367
|
+
try {
|
|
368
|
+
await this.getCreateClient().send(new CreateDBSubnetGroupCommand({
|
|
369
|
+
DBSubnetGroupName: dbSubnetGroupName,
|
|
370
|
+
DBSubnetGroupDescription: properties["DBSubnetGroupDescription"] || `Subnet group for ${logicalId}`,
|
|
371
|
+
SubnetIds: properties["SubnetIds"],
|
|
372
|
+
...tags.length > 0 && { Tags: tags }
|
|
373
|
+
}));
|
|
374
|
+
this.logger.debug(`Successfully created Neptune DBSubnetGroup ${logicalId}: ${dbSubnetGroupName}`);
|
|
375
|
+
return {
|
|
376
|
+
physicalId: dbSubnetGroupName,
|
|
377
|
+
attributes: { DBSubnetGroupName: dbSubnetGroupName }
|
|
378
|
+
};
|
|
379
|
+
} catch (error) {
|
|
380
|
+
const cause = error instanceof Error ? error : void 0;
|
|
381
|
+
throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create Neptune DBSubnetGroup ${logicalId}: ${text}`, resourceType, logicalId, dbSubnetGroupName, cause));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
async function updateDBSubnetGroup(logicalId, physicalId, resourceType, properties, previousProperties, mask) {
|
|
385
|
+
this.logger.debug(`Updating Neptune DBSubnetGroup ${logicalId}: ${physicalId}`);
|
|
386
|
+
refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
|
|
387
|
+
try {
|
|
388
|
+
const subnetIds = properties["SubnetIds"];
|
|
389
|
+
const sendSubnetIds = subnetIds !== void 0 && subnetIds.length > 0;
|
|
390
|
+
const modifyInput = {
|
|
391
|
+
DBSubnetGroupName: physicalId,
|
|
392
|
+
DBSubnetGroupDescription: clearOnUpdateRemoval(properties["DBSubnetGroupDescription"], previousProperties["DBSubnetGroupDescription"], `Subnet group for ${logicalId}`),
|
|
393
|
+
...sendSubnetIds && { SubnetIds: subnetIds }
|
|
394
|
+
};
|
|
395
|
+
await this.getClient().send(new ModifyDBSubnetGroupCommand(modifyInput));
|
|
396
|
+
const arn = (await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: physicalId }))).DBSubnetGroups?.[0]?.DBSubnetGroupArn;
|
|
397
|
+
if (arn) await this.applyTagDiff(arn, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
|
|
398
|
+
this.logger.debug(`Successfully updated Neptune DBSubnetGroup ${logicalId}`);
|
|
399
|
+
return {
|
|
400
|
+
physicalId,
|
|
401
|
+
wasReplaced: false,
|
|
402
|
+
attributes: { DBSubnetGroupName: physicalId }
|
|
403
|
+
};
|
|
404
|
+
} catch (error) {
|
|
405
|
+
const cause = error instanceof Error ? error : void 0;
|
|
406
|
+
throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to update Neptune DBSubnetGroup ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
async function deleteDBSubnetGroup(logicalId, physicalId, resourceType, context) {
|
|
410
|
+
this.logger.debug(`Deleting Neptune DBSubnetGroup ${logicalId}: ${physicalId}`);
|
|
411
|
+
try {
|
|
412
|
+
await this.getClient().send(new DeleteDBSubnetGroupCommand({ DBSubnetGroupName: physicalId }));
|
|
413
|
+
this.logger.debug(`Successfully deleted Neptune DBSubnetGroup ${logicalId}`);
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (this.isNotFoundError(error, "DBSubnetGroupNotFoundFault")) {
|
|
416
|
+
const clientRegion = await this.getClient().config.region();
|
|
417
|
+
assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
418
|
+
this.logger.debug(`Neptune DBSubnetGroup ${physicalId} does not exist, skipping deletion`);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const cause = error instanceof Error ? error : void 0;
|
|
422
|
+
throw this.wrapDeleteError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to delete Neptune DBSubnetGroup ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// src/provisioning/providers/neptune/cluster-create.ts
|
|
427
|
+
async function createDBCluster(logicalId, resourceType, properties, mask, replayingState) {
|
|
428
|
+
this.logger.debug(`Creating Neptune DBCluster ${logicalId}`);
|
|
429
|
+
const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
|
|
430
|
+
const { roles, logTypes, scaling } = this.readClusterBlocks(properties, resourceType, logicalId, {
|
|
431
|
+
creating: true,
|
|
432
|
+
stateBorne: replayingState
|
|
433
|
+
});
|
|
434
|
+
const restore = readClusterRestore(properties, resourceType, logicalId);
|
|
435
|
+
this.warnIgnoredRestoreProperties(logicalId, resourceType, properties, restore);
|
|
436
|
+
const dbClusterIdentifier = properties["DBClusterIdentifier"] || generatedNameFor("AWS::Neptune::DBCluster", logicalId);
|
|
437
|
+
if (!String(properties["SourceDBClusterIdentifier"]).startsWith("arn:")) refuseRestoreFromItself(resourceType, properties, dbClusterIdentifier, logicalId, { region: this.providerRegion });
|
|
438
|
+
const port = properties["DBPort"] != null ? Number(properties["DBPort"]) : properties["Port"] != null ? Number(properties["Port"]) : void 0;
|
|
439
|
+
const kmsKeyId = properties["KmsKeyId"];
|
|
440
|
+
const sharedInput = {
|
|
441
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
442
|
+
VpcSecurityGroupIds: properties["VpcSecurityGroupIds"],
|
|
443
|
+
DBSubnetGroupName: properties["DBSubnetGroupName"],
|
|
444
|
+
DBClusterParameterGroupName: properties["DBClusterParameterGroupName"],
|
|
445
|
+
EnableIAMDatabaseAuthentication: properties["IamAuthEnabled"],
|
|
446
|
+
DeletionProtection: properties["DeletionProtection"],
|
|
447
|
+
NetworkType: properties["NetworkType"],
|
|
448
|
+
...logTypes.length > 0 && { EnableCloudwatchLogsExports: logTypes },
|
|
449
|
+
...scaling != null && { ServerlessV2ScalingConfiguration: scaling },
|
|
450
|
+
...tags.length > 0 && { Tags: tags }
|
|
451
|
+
};
|
|
452
|
+
const restoreInput = {
|
|
453
|
+
...sharedInput,
|
|
454
|
+
Port: port ?? 8182,
|
|
455
|
+
KmsKeyId: kmsKeyId ?? (String(properties["StorageEncrypted"]).toLowerCase() === "true" ? "alias/aws/rds" : void 0)
|
|
456
|
+
};
|
|
457
|
+
let clusterCreated = false;
|
|
458
|
+
let createdResourceId;
|
|
459
|
+
try {
|
|
460
|
+
const response = await (restore === void 0 ? this.getCreateClient().send(new CreateDBClusterCommand({
|
|
461
|
+
...sharedInput,
|
|
462
|
+
Engine: "neptune",
|
|
463
|
+
EngineVersion: properties["EngineVersion"],
|
|
464
|
+
Port: port,
|
|
465
|
+
StorageEncrypted: properties["StorageEncrypted"],
|
|
466
|
+
KmsKeyId: kmsKeyId,
|
|
467
|
+
BackupRetentionPeriod: properties["BackupRetentionPeriod"] != null ? Number(properties["BackupRetentionPeriod"]) : void 0,
|
|
468
|
+
PreferredBackupWindow: properties["PreferredBackupWindow"],
|
|
469
|
+
PreferredMaintenanceWindow: properties["PreferredMaintenanceWindow"],
|
|
470
|
+
AvailabilityZones: properties["AvailabilityZones"],
|
|
471
|
+
CopyTagsToSnapshot: properties["CopyTagsToSnapshot"]
|
|
472
|
+
})) : restore.kind === "snapshot" ? this.getCreateClient().send(new RestoreDBClusterFromSnapshotCommand({
|
|
473
|
+
...restoreInput,
|
|
474
|
+
SnapshotIdentifier: restore.snapshotIdentifier,
|
|
475
|
+
Engine: "neptune",
|
|
476
|
+
EngineVersion: properties["EngineVersion"],
|
|
477
|
+
AvailabilityZones: properties["AvailabilityZones"],
|
|
478
|
+
CopyTagsToSnapshot: properties["CopyTagsToSnapshot"]
|
|
479
|
+
})) : this.getCreateClient().send(new RestoreDBClusterToPointInTimeCommand({
|
|
480
|
+
...restoreInput,
|
|
481
|
+
DBClusterParameterGroupName: void 0,
|
|
482
|
+
SourceDBClusterIdentifier: restore.sourceDBClusterIdentifier,
|
|
483
|
+
RestoreType: properties["RestoreType"],
|
|
484
|
+
...restore.restoreToTime !== void 0 && { RestoreToTime: restore.restoreToTime },
|
|
485
|
+
UseLatestRestorableTime: properties["UseLatestRestorableTime"]
|
|
486
|
+
})));
|
|
487
|
+
clusterCreated = true;
|
|
488
|
+
createdResourceId = response.DBCluster?.DbClusterResourceId;
|
|
489
|
+
reportCreatedResource(logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
490
|
+
const cluster = response.DBCluster;
|
|
491
|
+
if (!cluster) throw new Error("The create call did not return DBCluster");
|
|
492
|
+
this.logger.debug(`Successfully created Neptune DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
493
|
+
const followUp = restore === void 0 ? void 0 : restoreFollowUp(properties, restore, cluster.EngineVersion);
|
|
494
|
+
const followingUp = followUp !== void 0 && (followUp.parity !== void 0 || followUp.declared.length > 0);
|
|
495
|
+
if (followingUp || process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, void 0, restore === void 0 ? void 0 : restoreWaitMs());
|
|
496
|
+
try {
|
|
497
|
+
if (followUp !== void 0 && followingUp) await this.sendRestoreFollowUp(logicalId, resourceType, dbClusterIdentifier, followUp, mask);
|
|
498
|
+
await this.applyClusterRoles(logicalId, dbClusterIdentifier, roles, [], mask, void 0);
|
|
499
|
+
} catch (error) {
|
|
500
|
+
markAuxiliaryFailure(error, logicalId);
|
|
501
|
+
throw error;
|
|
502
|
+
}
|
|
503
|
+
const described = await this.describeDBCluster(dbClusterIdentifier);
|
|
504
|
+
return {
|
|
505
|
+
physicalId: dbClusterIdentifier,
|
|
506
|
+
attributes: clusterAttributes(described)
|
|
507
|
+
};
|
|
508
|
+
} catch (error) {
|
|
509
|
+
const thrown = error instanceof ProvisioningError ? error : this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create Neptune DBCluster ${logicalId}: ${text}`, resourceType, logicalId, dbClusterIdentifier, error instanceof Error ? error : void 0));
|
|
510
|
+
if (clusterCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
511
|
+
throw thrown;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
async function sendRestoreFollowUp(logicalId, resourceType, physicalId, followUp, mask) {
|
|
515
|
+
const send = (members) => modifyDbInstanceWhenAvailable({
|
|
516
|
+
send: () => this.getClient().send(new ModifyDBClusterCommand({
|
|
517
|
+
DBClusterIdentifier: physicalId,
|
|
518
|
+
...members,
|
|
519
|
+
ApplyImmediately: true
|
|
520
|
+
})),
|
|
521
|
+
readStatus: async () => (await this.describeDBCluster(physicalId))?.Status,
|
|
522
|
+
sleep: (ms) => this.sleep(ms),
|
|
523
|
+
logger: this.logger,
|
|
524
|
+
label: "Neptune DBCluster",
|
|
525
|
+
subject: "cluster",
|
|
526
|
+
isRefusal: (error) => isModifyNotAvailableRefusal(error) || isRestoringClusterRefusal(error),
|
|
527
|
+
logicalId,
|
|
528
|
+
remainingMs: enclosingDeadlineRemainingMs()
|
|
529
|
+
});
|
|
530
|
+
if (followUp.parity !== void 0) await send(followUp.parity);
|
|
531
|
+
const refused = async (members) => {
|
|
532
|
+
try {
|
|
533
|
+
await send(members);
|
|
534
|
+
return false;
|
|
535
|
+
} catch (error) {
|
|
536
|
+
if (error instanceof Error && RESTORE_VALUE_REFUSALS.has(error.name)) {
|
|
537
|
+
this.logger.debug(safeMsg`${error.name} after restoring ${logicalId}: ${(mask ?? String)(error.message)}`);
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
throw error;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
const { declared } = followUp;
|
|
544
|
+
if (declared.length > 0 && await refused(Object.assign({}, ...declared))) {
|
|
545
|
+
const keys = [];
|
|
546
|
+
for (const group of declared) if (declared.length === 1 || await refused(group)) keys.push(...Object.keys(group));
|
|
547
|
+
const refusedKeys = keys.filter((key) => key !== "AllowMajorVersionUpgrade");
|
|
548
|
+
if (refusedKeys.length > 0) this.logger.warn(safeMsg`${logicalId} (${resourceType}): AWS refused ${refusedKeys.join(", ")} after the restore, so the cluster keeps its restored values. The record holds the declared ones, so drift does not report the difference. An update leaves an unchanged window or EngineVersion out, as CloudFormation does; a refused BackupRetentionPeriod, CopyTagsToSnapshot or DBClusterParameterGroupName is sent again, so every update of this cluster fails until the template changes it.`);
|
|
549
|
+
}
|
|
550
|
+
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterAvailable(logicalId, physicalId, "being configured after a restore", restoreWaitMs());
|
|
551
|
+
}
|
|
552
|
+
function warnIgnoredRestoreProperties(logicalId, resourceType, properties, restore) {
|
|
553
|
+
const ignored = ignoredRestoreKeys(restore).filter((key) => properties[key] != null && properties[key] !== false);
|
|
554
|
+
if (ignored.length === 0) return;
|
|
555
|
+
const call = restore === void 0 ? "create" : restore.kind === "snapshot" ? "snapshot restore" : "point-in-time restore";
|
|
556
|
+
const retention = restore?.kind === "point-in-time" && declaresSnapshot(properties) ? " A declared SnapshotIdentifier still sets BackupRetentionPeriod, 1 when none is declared." : "";
|
|
557
|
+
this.logger.warn(safeMsg`${logicalId} (${resourceType}): this ${call} does not use ${ignored.join(", ")}, as in CloudFormation.${retention}`);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// src/provisioning/providers/neptune/cluster-update.ts
|
|
561
|
+
async function updateDBCluster(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
562
|
+
this.logger.debug(`Updating Neptune DBCluster ${logicalId}: ${physicalId}`);
|
|
563
|
+
refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
|
|
564
|
+
const { roles, logTypes, scaling } = this.readClusterBlocks(properties, resourceType, logicalId, {
|
|
565
|
+
creating: false,
|
|
566
|
+
stateBorne: context?.replayingState === true || context?.desiredFromAwsReadback === true,
|
|
567
|
+
physicalId
|
|
568
|
+
});
|
|
569
|
+
const logExportConfig = logExportChange(logTypes, stringList(previousProperties["EnableCloudwatchLogsExports"]) ?? []);
|
|
570
|
+
try {
|
|
571
|
+
const unrecorded = (key) => properties[key] != null && previousProperties[key] == null;
|
|
572
|
+
const live = unrecorded("EngineVersion") || unrecorded("NetworkType") || logExportConfig?.EnableLogTypes !== void 0 ? await this.describeDBCluster(physicalId) : void 0;
|
|
573
|
+
const majorUpgrade = isMajorEngineChange(previousProperties["EngineVersion"] ?? live?.EngineVersion, properties["EngineVersion"]);
|
|
574
|
+
const networkType = properties["NetworkType"];
|
|
575
|
+
const networkChange = networkType != null && networkType !== (previousProperties["NetworkType"] ?? live?.NetworkType);
|
|
576
|
+
markChangedUnsettled(CLUSTER_MODIFY_KEYS, properties, previousProperties, context);
|
|
577
|
+
const send = sentOnUpdate(properties, previousProperties);
|
|
578
|
+
const vpcSgIds = await this.dbClusterSecurityGroupsToSend(logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
579
|
+
await this.getClient().send(new ModifyDBClusterCommand({
|
|
580
|
+
DBClusterIdentifier: physicalId,
|
|
581
|
+
EngineVersion: send("EngineVersion"),
|
|
582
|
+
DeletionProtection: properties["DeletionProtection"],
|
|
583
|
+
BackupRetentionPeriod: properties["BackupRetentionPeriod"] != null ? Number(properties["BackupRetentionPeriod"]) : void 0,
|
|
584
|
+
PreferredBackupWindow: send("PreferredBackupWindow"),
|
|
585
|
+
PreferredMaintenanceWindow: send("PreferredMaintenanceWindow"),
|
|
586
|
+
DBClusterParameterGroupName: properties["DBClusterParameterGroupName"],
|
|
587
|
+
EnableIAMDatabaseAuthentication: properties["IamAuthEnabled"],
|
|
588
|
+
...vpcSgIds !== void 0 && { VpcSecurityGroupIds: vpcSgIds },
|
|
589
|
+
Port: properties["DBPort"] != null ? Number(properties["DBPort"]) : properties["Port"] != null ? Number(properties["Port"]) : void 0,
|
|
590
|
+
CopyTagsToSnapshot: properties["CopyTagsToSnapshot"],
|
|
591
|
+
...networkChange && { NetworkType: networkType },
|
|
592
|
+
...scaling != null && { ServerlessV2ScalingConfiguration: scaling },
|
|
593
|
+
...logExportConfig !== void 0 && { CloudwatchLogsExportConfiguration: logExportConfig },
|
|
594
|
+
...majorUpgrade && { AllowMajorVersionUpgrade: true },
|
|
595
|
+
...majorUpgrade && properties["DBInstanceParameterGroupName"] != null && { DBInstanceParameterGroupName: properties["DBInstanceParameterGroupName"] },
|
|
596
|
+
ApplyImmediately: true
|
|
597
|
+
}));
|
|
598
|
+
const addedLogTypes = (logExportConfig?.EnableLogTypes ?? []).filter((type) => !live?.EnabledCloudwatchLogsExports?.includes(type));
|
|
599
|
+
if (addedLogTypes.length > 0) context?.markAttempted?.("EnableCloudwatchLogsExports", addedLogTypes);
|
|
600
|
+
this.logger.debug(`Successfully updated Neptune DBCluster ${logicalId}`);
|
|
601
|
+
const described = await this.describeDBCluster(physicalId);
|
|
602
|
+
if (logExportConfig !== void 0 && process.env["CDKD_NO_WAIT"] !== "true") {
|
|
603
|
+
const { EnableLogTypes: enabled = [], DisableLogTypes: disabled = [] } = logExportConfig;
|
|
604
|
+
await this.waitForApplied(logicalId, "EnableCloudwatchLogsExports", async () => {
|
|
605
|
+
const live = (await this.describeDBCluster(physicalId))?.EnabledCloudwatchLogsExports;
|
|
606
|
+
return enabled.every((type) => live?.includes(type)) && !disabled.some((type) => live?.includes(type));
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
if (networkChange && process.env["CDKD_NO_WAIT"] !== "true") await this.waitForApplied(logicalId, "NetworkType", async () => (await this.describeDBCluster(physicalId))?.NetworkType === networkType);
|
|
610
|
+
await this.applyClusterRoles(logicalId, physicalId, roles, associatedRoleList(previousProperties["AssociatedRoles"]) ?? [], context?.maskSecrets, context);
|
|
611
|
+
if (process.env["CDKD_NO_WAIT"] !== "true" && securityGroupListChanged(vpcSgIds, previousProperties["VpcSecurityGroupIds"])) {
|
|
612
|
+
await this.waitForSecurityGroupsApplied(physicalId, logicalId, vpcSgIds ?? []);
|
|
613
|
+
for (const member of described?.DBClusterMembers ?? []) if (member.DBInstanceIdentifier) await this.waitForMemberAfterSecurityGroupChange(member.DBInstanceIdentifier, logicalId);
|
|
614
|
+
}
|
|
615
|
+
if (described?.DBClusterArn) {
|
|
616
|
+
markChangedUnsettled(["Tags"], properties, previousProperties, context);
|
|
617
|
+
await this.applyTagDiff(described.DBClusterArn, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
|
|
618
|
+
}
|
|
619
|
+
this.warnKeptRemovals(logicalId, resourceType, properties, previousProperties, CLUSTER_KEPT_ON_REMOVAL, context);
|
|
620
|
+
this.warnKeptRemovals(logicalId, resourceType, properties, previousProperties, CLUSTER_UNMEASURED_ON_REMOVAL, context, false);
|
|
621
|
+
return {
|
|
622
|
+
physicalId,
|
|
623
|
+
wasReplaced: false,
|
|
624
|
+
attributes: clusterAttributes(described)
|
|
625
|
+
};
|
|
626
|
+
} catch (error) {
|
|
627
|
+
if (error instanceof ProvisioningError) throw error;
|
|
628
|
+
const cause = error instanceof Error ? error : void 0;
|
|
629
|
+
throw this.wrapCaughtError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to update Neptune DBCluster ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
function readClusterBlocks(properties, resourceType, logicalId, origin) {
|
|
633
|
+
const refuse = (key, expected) => {
|
|
634
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`Neptune DBCluster ${logicalId}: ${key} must be ${expected}; nothing was changed.`, resourceType, logicalId, origin.physicalId));
|
|
635
|
+
};
|
|
636
|
+
const leaveOut = (key) => {
|
|
637
|
+
this.logger.warn(safeMsg`${logicalId} (${resourceType}): the recorded ${key} is unusable, so it is not sent.`);
|
|
638
|
+
};
|
|
639
|
+
const unusableList = (key, expected) => {
|
|
640
|
+
if (!(origin.creating && origin.stateBorne)) return refuse(key, expected);
|
|
641
|
+
leaveOut(key);
|
|
642
|
+
return [];
|
|
643
|
+
};
|
|
644
|
+
const roles = associatedRoleList(properties["AssociatedRoles"]) ?? unusableList("AssociatedRoles", "a list of objects with a RoleArn");
|
|
645
|
+
const logTypes = stringList(properties["EnableCloudwatchLogsExports"]) ?? unusableList("EnableCloudwatchLogsExports", "a list of strings");
|
|
646
|
+
const scaling = serverlessScalingToSend(properties["ServerlessScalingConfiguration"]);
|
|
647
|
+
if (scaling === null) {
|
|
648
|
+
if (!origin.stateBorne) return refuse("ServerlessScalingConfiguration", "an object with both a numeric MinCapacity and a numeric MaxCapacity");
|
|
649
|
+
leaveOut("ServerlessScalingConfiguration");
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
roles,
|
|
653
|
+
logTypes,
|
|
654
|
+
scaling
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
async function applyClusterRoles(logicalId, physicalId, desired, previous, mask, marks) {
|
|
658
|
+
const candidates = planAssociatedRoleChanges(desired, previous);
|
|
659
|
+
if (candidates.toAdd.length === 0 && candidates.toRemove.length === 0) return;
|
|
660
|
+
const waitBudgetMs = Math.min(ROLE_AVAILABLE_MAX_WAIT_MS, enclosingDeadlineRemainingMs() - DEADLINE_MARGIN_MS);
|
|
661
|
+
if (waitBudgetMs <= 0) throw new Error("the resource timeout leaves no more time to change the roles of the cluster; re-run the deploy, or with a longer --resource-timeout");
|
|
662
|
+
await this.waitForClusterAvailable(logicalId, physicalId, "changing its roles", waitBudgetMs);
|
|
663
|
+
const cluster = await this.describeDBCluster(physicalId);
|
|
664
|
+
if (cluster === void 0) throw new Error("DescribeDBClusters returned no cluster while planning its role changes; no role was attached or detached");
|
|
665
|
+
const { toAdd, toRemove } = planAssociatedRoleChanges(desired, previous, cluster.AssociatedRoles ?? []);
|
|
666
|
+
if (toAdd.length === 0 && toRemove.length === 0) return;
|
|
667
|
+
marks?.markUnsettled?.("AssociatedRoles");
|
|
668
|
+
const whenAvailable = (send) => modifyDbInstanceWhenAvailable({
|
|
669
|
+
send,
|
|
670
|
+
readStatus: async () => (await this.describeDBCluster(physicalId))?.Status,
|
|
671
|
+
sleep: (ms) => this.sleep(ms),
|
|
672
|
+
logger: this.logger,
|
|
673
|
+
label: "Neptune DBCluster",
|
|
674
|
+
subject: "cluster",
|
|
675
|
+
isRefusal: (error) => isRoleCallNotAvailableRefusal(error) || isModifyNotAvailableRefusal(error),
|
|
676
|
+
logicalId,
|
|
677
|
+
remainingMs: enclosingDeadlineRemainingMs()
|
|
678
|
+
});
|
|
679
|
+
for (const role of toRemove) {
|
|
680
|
+
marks?.markAttempted?.("AssociatedRoles", [associatedRoleKey(role)]);
|
|
681
|
+
await whenAvailable(() => this.getClient().send(new RemoveRoleFromDBClusterCommand({
|
|
682
|
+
DBClusterIdentifier: physicalId,
|
|
683
|
+
...role
|
|
684
|
+
})));
|
|
685
|
+
}
|
|
686
|
+
for (const role of toAdd) {
|
|
687
|
+
await whenAvailable(() => this.getClient().send(new AddRoleToDBClusterCommand({
|
|
688
|
+
DBClusterIdentifier: physicalId,
|
|
689
|
+
...role
|
|
690
|
+
})));
|
|
691
|
+
marks?.markAttempted?.("AssociatedRoles", [associatedRoleKey(role)]);
|
|
692
|
+
}
|
|
693
|
+
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterRolesSettled(logicalId, physicalId, new Set(toAdd.map(associatedRoleKey)), new Set(toRemove.map(associatedRoleKey)), mask);
|
|
694
|
+
}
|
|
695
|
+
async function waitForClusterRolesSettled(logicalId, physicalId, attached, detached, mask) {
|
|
696
|
+
const shown = (keys) => maskerOrIdentity(mask)(associatedRoleArns(keys));
|
|
697
|
+
let unsettled = [];
|
|
698
|
+
if (!await this.pollUntilSettled(async () => {
|
|
699
|
+
const roles = (await this.describeDBCluster(physicalId))?.AssociatedRoles ?? [];
|
|
700
|
+
const byKey = new Map(roles.map((role) => [associatedRoleKey(role), role]));
|
|
701
|
+
unsettled = [...[...attached].filter((key) => (byKey.get(key)?.Status ?? "PENDING") === "PENDING"), ...[...detached].filter((key) => byKey.has(key))];
|
|
702
|
+
if (unsettled.length > 0) return false;
|
|
703
|
+
const invalid = [...attached].filter((key) => byKey.get(key)?.Status === "INVALID");
|
|
704
|
+
if (invalid.length > 0) this.logger.warn(safeMsg`${logicalId}: Neptune reports ${shown(invalid)} as INVALID: the role is attached, but the cluster cannot assume it. Check the role's trust policy.`);
|
|
705
|
+
return true;
|
|
706
|
+
})) this.logger.warn(safeMsg`${logicalId}: the IAM roles of the Neptune cluster had not settled when cdkd stopped waiting (${shown(unsettled)}).`);
|
|
707
|
+
}
|
|
708
|
+
function warnKeptRemovals(logicalId, resourceType, properties, previousProperties, kept, context, measured = true) {
|
|
709
|
+
if (context?.desiredFromAwsReadback === true) return;
|
|
710
|
+
const removed = context?.removedProperties ?? new Set(removedTemplateKeys(previousProperties, properties));
|
|
711
|
+
const portStays = properties["DBPort"] != null || properties["Port"] != null;
|
|
712
|
+
const names = kept.filter((key) => removed.has(key) && !((key === "DBPort" || key === "Port") && portStays));
|
|
713
|
+
if (names.length === 0) return;
|
|
714
|
+
const one = names.length === 1;
|
|
715
|
+
const modify = resourceType === "AWS::Neptune::DBInstance" ? "ModifyDBInstance" : "ModifyDBCluster";
|
|
716
|
+
this.logger.warn(context?.replayingState === true ? safeMsg`${logicalId} (${resourceType}): ${one ? "property" : "properties"} ${names.join(", ")} ${one ? "is" : "are"} absent from the state being restored; ${modify} keeps a setting it is not sent, so the rollback leaves any value the failed deploy applied in place.` : safeMsg`${logicalId} (${resourceType}): ${one ? "property" : "properties"} ${names.join(", ")} ${one ? "was" : "were"} removed from the template; cdkd leaves the current AWS ${one ? "value" : "values"} in place${measured ? ", as CloudFormation does" : ""}. Declare ${one ? "it" : "them"} to change ${one ? "it" : "them"}.`);
|
|
717
|
+
}
|
|
718
|
+
function readPublicAccess(properties, resourceType, logicalId, physicalId, stateBorne) {
|
|
719
|
+
const refusal = configBooleanRefusal(properties, "PubliclyAccessible", logicalId);
|
|
720
|
+
if (refusal === void 0) return coerceCfnBoolean(properties["PubliclyAccessible"]);
|
|
721
|
+
if (!stateBorne) throw markNonRetryable(new ProvisioningError(safeMsg`Neptune DBInstance ${refusal}; nothing was changed.`, resourceType, logicalId, physicalId));
|
|
722
|
+
this.logger.warn(safeMsg`${logicalId} (${resourceType}): the recorded PubliclyAccessible is unusable, so it is not sent.`);
|
|
723
|
+
}
|
|
724
|
+
function warnPublicAccessKept(logicalId, resourceType, properties, previousProperties, context) {
|
|
725
|
+
if (context?.desiredFromAwsReadback === true) return;
|
|
726
|
+
if (!(context?.removedProperties ?? new Set(removedTemplateKeys(previousProperties, properties))).has("PubliclyAccessible")) return;
|
|
727
|
+
if (coerceCfnBoolean(previousProperties["PubliclyAccessible"]) !== true) return;
|
|
728
|
+
this.logger.warn(context?.replayingState === true ? safeMsg`${logicalId} (${resourceType}): PubliclyAccessible is absent from the state being restored, and ModifyDBInstance keeps a setting it is not sent, so the instance stays publicly accessible after this rollback, as CloudFormation leaves it. Set PubliclyAccessible: false to close it.` : safeMsg`${logicalId} (${resourceType}): PubliclyAccessible was removed from the template; the instance stays publicly accessible, as CloudFormation leaves it. Set PubliclyAccessible: false to close it.`);
|
|
729
|
+
}
|
|
730
|
+
async function dbClusterSecurityGroupsToSend(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
731
|
+
const desired = properties["VpcSecurityGroupIds"];
|
|
732
|
+
if (desired !== void 0) return desired.length > 0 ? desired : void 0;
|
|
733
|
+
const previous = previousProperties["VpcSecurityGroupIds"];
|
|
734
|
+
if (context?.desiredFromAwsReadback === true) return void 0;
|
|
735
|
+
if (!Array.isArray(previous) || previous.length === 0) return void 0;
|
|
736
|
+
let groupId;
|
|
737
|
+
let missing;
|
|
738
|
+
let awsError;
|
|
739
|
+
try {
|
|
740
|
+
const subnetGroupName = (await this.describeDBCluster(physicalId))?.DBSubnetGroup;
|
|
741
|
+
const vpcId = subnetGroupName ? (await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: subnetGroupName }))).DBSubnetGroups?.[0]?.VpcId : void 0;
|
|
742
|
+
if (!subnetGroupName) missing = "the cluster reports no DB subnet group";
|
|
743
|
+
else if (!vpcId) missing = `DB subnet group ${subnetGroupName} reports no VPC`;
|
|
744
|
+
else {
|
|
745
|
+
groupId = (await this.getEc2Client().send(new DescribeSecurityGroupsCommand({ Filters: [{
|
|
746
|
+
Name: "vpc-id",
|
|
747
|
+
Values: [vpcId]
|
|
748
|
+
}, {
|
|
749
|
+
Name: "group-name",
|
|
750
|
+
Values: ["default"]
|
|
751
|
+
}] }))).SecurityGroups?.[0]?.GroupId;
|
|
752
|
+
if (!groupId) missing = `VPC ${vpcId} has no security group named default`;
|
|
753
|
+
}
|
|
754
|
+
} catch (error) {
|
|
755
|
+
awsError = error;
|
|
756
|
+
}
|
|
757
|
+
if (groupId === void 0) {
|
|
758
|
+
const mask = context?.maskSecrets ?? ((text) => text);
|
|
759
|
+
const failure = missing === void 0 ? describeAwsFailure(awsError) : void 0;
|
|
760
|
+
if (failure?.redacted === true) this.logger.debug(safeMsg`${logicalId}: the VPC default security group lookup failed: ${mask(failure.detail)}`);
|
|
761
|
+
const shown = mask(failure?.summary ?? "");
|
|
762
|
+
const refusal = new ProvisioningError(`Failed to update Neptune DBCluster ${logicalId}: VpcSecurityGroupIds was removed from the template, so the cluster moves to its VPC's default security group (as CloudFormation does), but cdkd could not find that group: ${missing ?? shown}. Declare VpcSecurityGroupIds in the template to choose the cluster's security groups.`, resourceType, logicalId, physicalId, awsError instanceof Error ? awsError : void 0);
|
|
763
|
+
if (missing !== void 0) throw markNonRetryable(refusal);
|
|
764
|
+
throw awsError instanceof Error && (failure?.redacted === true || shown !== (failure?.summary ?? "")) ? markRedactedCause(refusal) : refusal;
|
|
765
|
+
}
|
|
766
|
+
this.logger.warn(safeMsg`${logicalId}: VpcSecurityGroupIds was removed from the template; attaching the VPC's default security group ${groupId}, as CloudFormation does.`);
|
|
767
|
+
return [groupId];
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/provisioning/providers/neptune/cluster-delete.ts
|
|
771
|
+
async function deleteDBCluster(logicalId, physicalId, resourceType, context) {
|
|
772
|
+
await deleteWithProtectionCompensation({
|
|
773
|
+
registry: this.protectionFlips,
|
|
774
|
+
key: protectionFlipKey(resourceType, physicalId, context?.expectedRegion),
|
|
775
|
+
run: (flip) => this.deleteDBClusterOnce(logicalId, physicalId, resourceType, context, flip),
|
|
776
|
+
compensation: {
|
|
777
|
+
logicalId,
|
|
778
|
+
physicalId,
|
|
779
|
+
logger: this.logger,
|
|
780
|
+
site: rdsFamilyProtectionSite({
|
|
781
|
+
cliService: "neptune",
|
|
782
|
+
serviceLabel: "Neptune",
|
|
783
|
+
kind: "cluster",
|
|
784
|
+
physicalId,
|
|
785
|
+
region: context?.expectedRegion,
|
|
786
|
+
notFoundFault: "DBClusterNotFoundFault",
|
|
787
|
+
isNotFound: (error) => this.isNotFoundError(error, "DBClusterNotFoundFault")
|
|
788
|
+
}),
|
|
789
|
+
reEnable: async () => {
|
|
790
|
+
await this.getClient().send(new ModifyDBClusterCommand({
|
|
791
|
+
DBClusterIdentifier: physicalId,
|
|
792
|
+
DeletionProtection: true,
|
|
793
|
+
ApplyImmediately: true
|
|
794
|
+
}));
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
async function deleteDBClusterOnce(logicalId, physicalId, resourceType, context, flip) {
|
|
800
|
+
this.logger.debug(`Deleting Neptune DBCluster ${logicalId}`);
|
|
801
|
+
try {
|
|
802
|
+
if (context?.removeProtection === true) try {
|
|
803
|
+
await observeThenDisableProtection({
|
|
804
|
+
flip,
|
|
805
|
+
logger: this.logger,
|
|
806
|
+
physicalId,
|
|
807
|
+
mask: context?.maskSecrets,
|
|
808
|
+
guardName: "DeletionProtection",
|
|
809
|
+
observe: async () => (await this.describeDBCluster(physicalId))?.DeletionProtection === true,
|
|
810
|
+
disable: async () => {
|
|
811
|
+
await this.getClient().send(new ModifyDBClusterCommand({
|
|
812
|
+
DBClusterIdentifier: physicalId,
|
|
813
|
+
DeletionProtection: false,
|
|
814
|
+
ApplyImmediately: true
|
|
815
|
+
}));
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
this.logger.debug(`Disabled DeletionProtection on Neptune DBCluster ${logicalId} before delete`);
|
|
819
|
+
} catch (disableError) {
|
|
820
|
+
if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for Neptune DBCluster ${logicalId}: ${describeAwsFailure(disableError).detail}`));
|
|
821
|
+
}
|
|
822
|
+
const finalSnapshotId = context?.finalSnapshotIdentifier;
|
|
823
|
+
const sendDelete = () => this.getClient().send(new DeleteDBClusterCommand({
|
|
824
|
+
DBClusterIdentifier: physicalId,
|
|
825
|
+
...finalSnapshotId ? {
|
|
826
|
+
SkipFinalSnapshot: false,
|
|
827
|
+
FinalDBSnapshotIdentifier: finalSnapshotId
|
|
828
|
+
} : { SkipFinalSnapshot: true }
|
|
829
|
+
}));
|
|
830
|
+
if (finalSnapshotId && flip.flippedOffByThisRun && !flip.deleteAccepted) await this.deleteAfterProtectionFlip(logicalId, physicalId, sendDelete);
|
|
831
|
+
else await sendDelete();
|
|
832
|
+
flip.deleteAccepted = true;
|
|
833
|
+
if (finalSnapshotId) this.logger.info(`Deleting Neptune DBCluster ${logicalId} with a final snapshot (DeletionPolicy: Snapshot)`);
|
|
834
|
+
this.logger.debug(`Successfully initiated deletion of Neptune DBCluster ${logicalId}`);
|
|
835
|
+
await this.waitForClusterDeleted(logicalId, physicalId);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
if (this.isNotFoundError(error, "DBClusterNotFoundFault")) {
|
|
838
|
+
const clientRegion = await this.getClient().config.region();
|
|
839
|
+
assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
840
|
+
if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Neptune DB cluster ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
|
|
841
|
+
else this.logger.debug(`Neptune DBCluster ${logicalId} does not exist, skipping deletion`);
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
const cause = error instanceof Error ? error : void 0;
|
|
845
|
+
throw this.wrapDeleteError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to delete Neptune DBCluster ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
async function deleteAfterProtectionFlip(logicalId, physicalId, send) {
|
|
849
|
+
await deleteAfterProtectionFlipWithFinalSnapshot({
|
|
850
|
+
stateFault: "InvalidDBClusterStateFault",
|
|
851
|
+
send,
|
|
852
|
+
noun: "cluster",
|
|
853
|
+
label: "Neptune DBCluster",
|
|
854
|
+
logicalId,
|
|
855
|
+
read: async () => {
|
|
856
|
+
const current = await this.describeDBCluster(physicalId);
|
|
857
|
+
return current === void 0 ? void 0 : {
|
|
858
|
+
deletionProtection: current.DeletionProtection,
|
|
859
|
+
status: current.Status
|
|
860
|
+
};
|
|
861
|
+
},
|
|
862
|
+
sleep: (ms) => this.sleep(ms),
|
|
863
|
+
logger: this.logger,
|
|
864
|
+
remainingMs: enclosingDeadlineRemainingMs()
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// src/provisioning/providers/neptune/instance.ts
|
|
869
|
+
async function createDBInstance(logicalId, resourceType, properties, mask, replayingState) {
|
|
870
|
+
this.logger.debug(`Creating Neptune DBInstance ${logicalId}`);
|
|
871
|
+
const tags = refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId);
|
|
872
|
+
const publiclyAccessible = this.readPublicAccess(properties, resourceType, logicalId, void 0, replayingState);
|
|
873
|
+
const dbInstanceIdentifier = properties["DBInstanceIdentifier"] || generatedNameFor("AWS::Neptune::DBInstance", logicalId);
|
|
874
|
+
let instanceCreated = false;
|
|
875
|
+
let createdResourceId;
|
|
876
|
+
try {
|
|
877
|
+
const response = await this.getCreateClient().send(new CreateDBInstanceCommand({
|
|
878
|
+
DBInstanceIdentifier: dbInstanceIdentifier,
|
|
879
|
+
DBInstanceClass: properties["DBInstanceClass"],
|
|
880
|
+
Engine: "neptune",
|
|
881
|
+
DBClusterIdentifier: properties["DBClusterIdentifier"],
|
|
882
|
+
DBSubnetGroupName: properties["DBSubnetGroupName"],
|
|
883
|
+
DBParameterGroupName: properties["DBParameterGroupName"],
|
|
884
|
+
AvailabilityZone: properties["AvailabilityZone"],
|
|
885
|
+
PreferredMaintenanceWindow: properties["PreferredMaintenanceWindow"],
|
|
886
|
+
AutoMinorVersionUpgrade: properties["AutoMinorVersionUpgrade"],
|
|
887
|
+
DeletionProtection: properties["DeletionProtection"],
|
|
888
|
+
PubliclyAccessible: publiclyAccessible,
|
|
889
|
+
...tags.length > 0 && { Tags: tags }
|
|
890
|
+
}));
|
|
891
|
+
instanceCreated = true;
|
|
892
|
+
createdResourceId = response.DBInstance?.DbiResourceId;
|
|
893
|
+
reportCreatedResource(logicalId, resourceType, dbInstanceIdentifier, createdResourceId);
|
|
894
|
+
if (!response.DBInstance) throw new Error("CreateDBInstance did not return DBInstance");
|
|
895
|
+
this.logger.debug(`Successfully created Neptune DBInstance ${logicalId}: ${dbInstanceIdentifier}`);
|
|
896
|
+
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForInstanceAvailable(logicalId, dbInstanceIdentifier);
|
|
897
|
+
const described = await this.describeDBInstance(dbInstanceIdentifier);
|
|
898
|
+
return {
|
|
899
|
+
physicalId: dbInstanceIdentifier,
|
|
900
|
+
attributes: instanceAttributes(described)
|
|
901
|
+
};
|
|
902
|
+
} catch (error) {
|
|
903
|
+
const thrown = error instanceof ProvisioningError ? error : this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create Neptune DBInstance ${logicalId}: ${text}`, resourceType, logicalId, dbInstanceIdentifier, error instanceof Error ? error : void 0));
|
|
904
|
+
if (instanceCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbInstanceIdentifier, createdResourceId);
|
|
905
|
+
throw thrown;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
async function updateDBInstance(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
909
|
+
const mask = context?.maskSecrets;
|
|
910
|
+
this.logger.debug(`Updating Neptune DBInstance ${logicalId}: ${physicalId}`);
|
|
911
|
+
refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
|
|
912
|
+
const publiclyAccessible = this.readPublicAccess(properties, resourceType, logicalId, physicalId, context?.replayingState === true || context?.desiredFromAwsReadback === true);
|
|
913
|
+
try {
|
|
914
|
+
markChangedUnsettled(INSTANCE_MODIFY_KEYS, properties, previousProperties, context);
|
|
915
|
+
await modifyDbInstanceWhenAvailable({
|
|
916
|
+
send: () => this.getClient().send(new ModifyDBInstanceCommand({
|
|
917
|
+
DBInstanceIdentifier: physicalId,
|
|
918
|
+
DBInstanceClass: properties["DBInstanceClass"],
|
|
919
|
+
DBParameterGroupName: properties["DBParameterGroupName"],
|
|
920
|
+
PreferredMaintenanceWindow: properties["PreferredMaintenanceWindow"],
|
|
921
|
+
AutoMinorVersionUpgrade: properties["AutoMinorVersionUpgrade"],
|
|
922
|
+
DeletionProtection: properties["DeletionProtection"],
|
|
923
|
+
PubliclyAccessible: publiclyAccessible,
|
|
924
|
+
AllowMajorVersionUpgrade: properties["AllowMajorVersionUpgrade"],
|
|
925
|
+
ApplyImmediately: true
|
|
926
|
+
})),
|
|
927
|
+
readStatus: async () => (await this.describeDBInstance(physicalId))?.DBInstanceStatus,
|
|
928
|
+
sleep: (ms) => this.sleep(ms),
|
|
929
|
+
logger: this.logger,
|
|
930
|
+
label: "Neptune DBInstance",
|
|
931
|
+
logicalId,
|
|
932
|
+
remainingMs: enclosingDeadlineRemainingMs()
|
|
933
|
+
});
|
|
934
|
+
this.logger.debug(`Successfully updated Neptune DBInstance ${logicalId}`);
|
|
935
|
+
if (publiclyAccessible !== void 0 && publiclyAccessible !== coerceCfnBoolean(previousProperties["PubliclyAccessible"]) && process.env["CDKD_NO_WAIT"] !== "true") await this.waitForApplied(logicalId, "PubliclyAccessible", async () => (await this.describeDBInstance(physicalId))?.PubliclyAccessible === publiclyAccessible);
|
|
936
|
+
const described = await this.describeDBInstance(physicalId);
|
|
937
|
+
if (described?.DBInstanceArn) {
|
|
938
|
+
markChangedUnsettled(["Tags"], properties, previousProperties, context);
|
|
939
|
+
await this.applyTagDiff(described.DBInstanceArn, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
|
|
940
|
+
}
|
|
941
|
+
this.warnKeptRemovals(logicalId, resourceType, properties, previousProperties, INSTANCE_KEPT_ON_REMOVAL, context);
|
|
942
|
+
this.warnPublicAccessKept(logicalId, resourceType, properties, previousProperties, context);
|
|
943
|
+
return {
|
|
944
|
+
physicalId,
|
|
945
|
+
wasReplaced: false,
|
|
946
|
+
attributes: instanceAttributes(described)
|
|
947
|
+
};
|
|
948
|
+
} catch (error) {
|
|
949
|
+
const cause = error instanceof Error ? error : void 0;
|
|
950
|
+
throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to update Neptune DBInstance ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
async function deleteDBInstance(logicalId, physicalId, resourceType, context) {
|
|
954
|
+
await deleteWithProtectionCompensation({
|
|
955
|
+
registry: this.protectionFlips,
|
|
956
|
+
key: protectionFlipKey(resourceType, physicalId, context?.expectedRegion),
|
|
957
|
+
run: (flip) => this.deleteDBInstanceOnce(logicalId, physicalId, resourceType, context, flip),
|
|
958
|
+
compensation: {
|
|
959
|
+
logicalId,
|
|
960
|
+
physicalId,
|
|
961
|
+
logger: this.logger,
|
|
962
|
+
site: rdsFamilyProtectionSite({
|
|
963
|
+
cliService: "neptune",
|
|
964
|
+
serviceLabel: "Neptune",
|
|
965
|
+
kind: "instance",
|
|
966
|
+
physicalId,
|
|
967
|
+
region: context?.expectedRegion,
|
|
968
|
+
notFoundFault: "DBInstanceNotFoundFault",
|
|
969
|
+
isNotFound: (error) => this.isNotFoundError(error, "DBInstanceNotFoundFault")
|
|
970
|
+
}),
|
|
971
|
+
reEnable: async () => {
|
|
972
|
+
await this.getClient().send(new ModifyDBInstanceCommand({
|
|
973
|
+
DBInstanceIdentifier: physicalId,
|
|
974
|
+
DeletionProtection: true,
|
|
975
|
+
ApplyImmediately: true
|
|
976
|
+
}));
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
async function deleteDBInstanceOnce(logicalId, physicalId, resourceType, context, flip) {
|
|
982
|
+
this.logger.debug(`Deleting Neptune DBInstance ${logicalId}: ${physicalId}`);
|
|
983
|
+
try {
|
|
984
|
+
if (context?.removeProtection === true) try {
|
|
985
|
+
await observeThenDisableProtection({
|
|
986
|
+
flip,
|
|
987
|
+
logger: this.logger,
|
|
988
|
+
physicalId,
|
|
989
|
+
mask: context?.maskSecrets,
|
|
990
|
+
guardName: "DeletionProtection",
|
|
991
|
+
observe: async () => (await this.describeDBInstance(physicalId))?.DeletionProtection === true,
|
|
992
|
+
disable: async () => {
|
|
993
|
+
await this.getClient().send(new ModifyDBInstanceCommand({
|
|
994
|
+
DBInstanceIdentifier: physicalId,
|
|
995
|
+
DeletionProtection: false,
|
|
996
|
+
ApplyImmediately: true
|
|
997
|
+
}));
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
this.logger.debug(`Disabled DeletionProtection on Neptune DBInstance ${logicalId} before delete`);
|
|
1001
|
+
} catch (disableError) {
|
|
1002
|
+
if (!this.isNotFoundError(disableError, "DBInstanceNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for ${physicalId}: ${describeAwsFailure(disableError).detail}`));
|
|
1003
|
+
}
|
|
1004
|
+
await this.getClient().send(new DeleteDBInstanceCommand({
|
|
1005
|
+
DBInstanceIdentifier: physicalId,
|
|
1006
|
+
SkipFinalSnapshot: true
|
|
1007
|
+
}));
|
|
1008
|
+
flip.deleteAccepted = true;
|
|
1009
|
+
this.logger.debug(`Successfully initiated deletion of Neptune DBInstance ${logicalId}`);
|
|
1010
|
+
await this.waitForInstanceDeleted(physicalId);
|
|
1011
|
+
} catch (error) {
|
|
1012
|
+
if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) {
|
|
1013
|
+
const clientRegion = await this.getClient().config.region();
|
|
1014
|
+
assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
1015
|
+
if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` Neptune DB instance ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
|
|
1016
|
+
else this.logger.debug(`Neptune DBInstance ${physicalId} does not exist, skipping deletion`);
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
const cause = error instanceof Error ? error : void 0;
|
|
1020
|
+
throw this.wrapDeleteError(context?.maskSecrets, error, (text) => new ProvisioningError(`Failed to delete Neptune DBInstance ${logicalId}: ${text}`, resourceType, logicalId, physicalId, cause));
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/provisioning/providers/neptune/waits.ts
|
|
1025
|
+
async function waitForApplied(logicalId, what, applied) {
|
|
1026
|
+
if (await this.pollUntilSettled(applied)) return;
|
|
1027
|
+
this.logger.warn(safeMsg`${logicalId}: the new ${what} did not read back when cdkd stopped waiting; AWS accepted it, so cdkd drift may report the old value as the baseline. Once it applies, run cdkd drift --accept.`);
|
|
1028
|
+
}
|
|
1029
|
+
async function pollUntilSettled(settled) {
|
|
1030
|
+
const capMs = Math.min(SETTLE_MAX_WAIT_MS, enclosingDeadlineRemainingMs() - DEADLINE_MARGIN_MS);
|
|
1031
|
+
const startTime = Date.now();
|
|
1032
|
+
let delay = 2e3;
|
|
1033
|
+
for (;;) {
|
|
1034
|
+
if (await settled()) return true;
|
|
1035
|
+
if (Date.now() - startTime + delay >= capMs) return false;
|
|
1036
|
+
await this.sleep(delay);
|
|
1037
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
async function describeDBCluster(dbClusterIdentifier) {
|
|
1041
|
+
return (await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: dbClusterIdentifier }))).DBClusters?.[0];
|
|
1042
|
+
}
|
|
1043
|
+
async function describeDBInstance(dbInstanceIdentifier) {
|
|
1044
|
+
return (await this.getClient().send(new DescribeDBInstancesCommand({ DBInstanceIdentifier: dbInstanceIdentifier }))).DBInstances?.[0];
|
|
1045
|
+
}
|
|
1046
|
+
async function waitForMemberAfterSecurityGroupChange(dbInstanceIdentifier, clusterLogicalId, maxWaitMs = 18e5) {
|
|
1047
|
+
const startTime = Date.now();
|
|
1048
|
+
let delay = 5e3;
|
|
1049
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1050
|
+
let status;
|
|
1051
|
+
try {
|
|
1052
|
+
status = (await this.describeDBInstance(dbInstanceIdentifier))?.DBInstanceStatus;
|
|
1053
|
+
} catch (error) {
|
|
1054
|
+
if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) return;
|
|
1055
|
+
throw error;
|
|
1056
|
+
}
|
|
1057
|
+
if (status !== "modifying") return;
|
|
1058
|
+
await this.sleep(delay);
|
|
1059
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1060
|
+
}
|
|
1061
|
+
throw new Error(safeMsg`Timed out waiting for a member instance of Neptune DBCluster ${clusterLogicalId} to finish applying its new VPC security groups`);
|
|
1062
|
+
}
|
|
1063
|
+
function requireClusterWhileWaiting(cluster, logicalId) {
|
|
1064
|
+
if (cluster === void 0) throw new Error(safeMsg`DescribeDBClusters returned no cluster for Neptune DBCluster ${logicalId} while waiting for its new VPC security groups`);
|
|
1065
|
+
if (isTerminalDbWaitStatus(cluster.Status)) throw new Error(safeMsg`Neptune DBCluster ${logicalId} entered status ${cluster.Status ?? ""} while applying its new VPC security groups`);
|
|
1066
|
+
return cluster;
|
|
1067
|
+
}
|
|
1068
|
+
async function waitForSecurityGroupsApplied(dbClusterIdentifier, logicalId, expected, maxWaitMs = 18e5) {
|
|
1069
|
+
const want = [...new Set(expected)].sort().join(" ");
|
|
1070
|
+
const startTime = Date.now();
|
|
1071
|
+
let delay = 5e3;
|
|
1072
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1073
|
+
const cluster = this.requireClusterWhileWaiting(await this.describeDBCluster(dbClusterIdentifier), logicalId);
|
|
1074
|
+
const groups = cluster.VpcSecurityGroups ?? [];
|
|
1075
|
+
const ids = groups.map((group) => group.VpcSecurityGroupId ?? "").sort().join(" ");
|
|
1076
|
+
if (cluster.Status !== "modifying" && groups.every((group) => group.Status === "active") && ids === want) return;
|
|
1077
|
+
this.logger.debug(safeMsg`Neptune DBCluster ${logicalId} security groups not settled yet (status ${cluster.Status ?? "unknown"})`);
|
|
1078
|
+
await this.sleep(delay);
|
|
1079
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1080
|
+
}
|
|
1081
|
+
throw new Error(`Timed out waiting for Neptune DBCluster ${logicalId} to apply its new VPC security groups`);
|
|
1082
|
+
}
|
|
1083
|
+
async function waitForClusterAvailable(logicalId, dbClusterIdentifier, during = "being created", maxWaitMs = CLUSTER_AVAILABLE_MAX_WAIT_MS) {
|
|
1084
|
+
const startTime = Date.now();
|
|
1085
|
+
let delay = 5e3;
|
|
1086
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1087
|
+
const status = (await this.describeDBCluster(dbClusterIdentifier))?.Status;
|
|
1088
|
+
this.logger.debug(`Neptune DBCluster ${dbClusterIdentifier} status: ${status}`);
|
|
1089
|
+
if (status === "available") return;
|
|
1090
|
+
if (isTerminalDbWaitStatus(status)) throw new Error(safeMsg`Neptune DBCluster ${logicalId} entered status ${status ?? ""} while ${during}, which it does not leave on its own`);
|
|
1091
|
+
await this.sleep(delay);
|
|
1092
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1093
|
+
}
|
|
1094
|
+
throw new Error(`Timed out waiting for Neptune DBCluster ${dbClusterIdentifier} to become available`);
|
|
1095
|
+
}
|
|
1096
|
+
async function waitForClusterDeleted(logicalId, dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
1097
|
+
const startTime = Date.now();
|
|
1098
|
+
let delay = 5e3;
|
|
1099
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1100
|
+
try {
|
|
1101
|
+
const cluster = await this.describeDBCluster(dbClusterIdentifier);
|
|
1102
|
+
const status = cluster?.Status;
|
|
1103
|
+
this.logger.debug(`Neptune DBCluster ${logicalId} status: ${status}`);
|
|
1104
|
+
if (!cluster) return;
|
|
1105
|
+
} catch (error) {
|
|
1106
|
+
if (this.isNotFoundError(error, "DBClusterNotFoundFault")) return;
|
|
1107
|
+
throw error;
|
|
1108
|
+
}
|
|
1109
|
+
await this.sleep(delay);
|
|
1110
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1111
|
+
}
|
|
1112
|
+
throw new Error(`Timed out waiting for Neptune DBCluster ${logicalId} to be deleted`);
|
|
1113
|
+
}
|
|
1114
|
+
async function waitForInstanceAvailable(logicalId, dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
1115
|
+
const startTime = Date.now();
|
|
1116
|
+
let delay = 1e4;
|
|
1117
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1118
|
+
const status = (await this.describeDBInstance(dbInstanceIdentifier))?.DBInstanceStatus;
|
|
1119
|
+
this.logger.debug(`Neptune DBInstance ${dbInstanceIdentifier} status: ${status}`);
|
|
1120
|
+
if (status === "available") return;
|
|
1121
|
+
if (isTerminalDbWaitStatus(status)) throw new Error(safeMsg`Neptune DBInstance ${logicalId} entered status ${status ?? ""} while being created, which it does not leave on its own`);
|
|
1122
|
+
await this.sleep(delay);
|
|
1123
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1124
|
+
}
|
|
1125
|
+
throw new Error(`Timed out waiting for Neptune DBInstance ${dbInstanceIdentifier} to become available`);
|
|
1126
|
+
}
|
|
1127
|
+
async function waitForInstanceDeleted(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
1128
|
+
const startTime = Date.now();
|
|
1129
|
+
let delay = 1e4;
|
|
1130
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
1131
|
+
try {
|
|
1132
|
+
const instance = await this.describeDBInstance(dbInstanceIdentifier);
|
|
1133
|
+
const status = instance?.DBInstanceStatus;
|
|
1134
|
+
this.logger.debug(`Neptune DBInstance ${dbInstanceIdentifier} status: ${status}`);
|
|
1135
|
+
if (!instance) return;
|
|
1136
|
+
} catch (error) {
|
|
1137
|
+
if (this.isNotFoundError(error, "DBInstanceNotFoundFault")) return;
|
|
1138
|
+
throw error;
|
|
1139
|
+
}
|
|
1140
|
+
await this.sleep(delay);
|
|
1141
|
+
delay = Math.min(delay * 2, 1e4);
|
|
1142
|
+
}
|
|
1143
|
+
throw new Error(`Timed out waiting for Neptune DBInstance ${dbInstanceIdentifier} to be deleted`);
|
|
1144
|
+
}
|
|
1145
|
+
function sleep(ms) {
|
|
1146
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// src/provisioning/providers/neptune/read-state.ts
|
|
1150
|
+
function getDriftUnknownPaths(resourceType) {
|
|
1151
|
+
if (resourceType === "AWS::Neptune::DBCluster") return [
|
|
1152
|
+
"AvailabilityZones",
|
|
1153
|
+
"DBInstanceParameterGroupName",
|
|
1154
|
+
"RestoreToTime",
|
|
1155
|
+
"RestoreType",
|
|
1156
|
+
"SnapshotIdentifier",
|
|
1157
|
+
"SourceDBClusterIdentifier",
|
|
1158
|
+
"UseLatestRestorableTime"
|
|
1159
|
+
];
|
|
1160
|
+
if (resourceType === "AWS::Neptune::DBInstance") return ["AllowMajorVersionUpgrade"];
|
|
1161
|
+
return [];
|
|
1162
|
+
}
|
|
1163
|
+
function getDriftUnorderedPaths(resourceType) {
|
|
1164
|
+
return resourceType === "AWS::Neptune::DBCluster" ? [
|
|
1165
|
+
"AssociatedRoles",
|
|
1166
|
+
"EnableCloudwatchLogsExports",
|
|
1167
|
+
"VpcSecurityGroupIds"
|
|
1168
|
+
] : [];
|
|
1169
|
+
}
|
|
1170
|
+
function canonicalizeDriftProperties(resourceType, properties) {
|
|
1171
|
+
if (resourceType !== "AWS::Neptune::DBCluster") return properties;
|
|
1172
|
+
const out = { ...properties };
|
|
1173
|
+
if (Array.isArray(out["AssociatedRoles"])) out["AssociatedRoles"] = canonicalAssociatedRoles(out["AssociatedRoles"]);
|
|
1174
|
+
const logs = out["EnableCloudwatchLogsExports"];
|
|
1175
|
+
if (Array.isArray(logs) && stringList(logs) !== void 0) out["EnableCloudwatchLogsExports"] = [...new Set(logs)];
|
|
1176
|
+
return out;
|
|
1177
|
+
}
|
|
1178
|
+
function canonicalizeUnsettledProperties(resourceType, properties) {
|
|
1179
|
+
return this.canonicalizeDriftProperties(resourceType, properties);
|
|
1180
|
+
}
|
|
1181
|
+
async function readUnsettled(physicalId, logicalId, resourceType, names, recordedProperties, desiredProperties, attemptedItems) {
|
|
1182
|
+
const live = await this.readCurrentState(physicalId, logicalId, resourceType);
|
|
1183
|
+
if (resourceType !== "AWS::Neptune::DBCluster") return live;
|
|
1184
|
+
if (live === void 0 || live === RESOURCE_NOT_FOUND) return live;
|
|
1185
|
+
const attempted = (key) => [...attemptedItems?.get(key) ?? []].filter(isUsableAttemptedName);
|
|
1186
|
+
const out = { ...live };
|
|
1187
|
+
if (names.has("AssociatedRoles")) out["AssociatedRoles"] = associatedRolesNamed(live["AssociatedRoles"], recordedProperties?.["AssociatedRoles"], desiredProperties?.["AssociatedRoles"], attemptedItems?.get("AssociatedRoles"));
|
|
1188
|
+
if (names.has("EnableCloudwatchLogsExports")) {
|
|
1189
|
+
const named = /* @__PURE__ */ new Set([
|
|
1190
|
+
...stringList(recordedProperties?.["EnableCloudwatchLogsExports"]) ?? [],
|
|
1191
|
+
...stringList(desiredProperties?.["EnableCloudwatchLogsExports"]) ?? [],
|
|
1192
|
+
...attempted("EnableCloudwatchLogsExports")
|
|
1193
|
+
]);
|
|
1194
|
+
out["EnableCloudwatchLogsExports"] = (live["EnableCloudwatchLogsExports"] ?? []).filter((type) => named.has(type));
|
|
1195
|
+
}
|
|
1196
|
+
return out;
|
|
1197
|
+
}
|
|
1198
|
+
async function unsettledInTransition(physicalId, _logicalId, resourceType, names, _recordedProperties, desiredProperties) {
|
|
1199
|
+
if (desiredProperties !== void 0) return /* @__PURE__ */ new Set();
|
|
1200
|
+
try {
|
|
1201
|
+
if (resourceType === "AWS::Neptune::DBCluster") {
|
|
1202
|
+
const cluster = await this.describeDBCluster(physicalId);
|
|
1203
|
+
return isUnmovingDbStatus(cluster?.Status) && !holdsPendingValue(cluster?.PendingModifiedValues) ? /* @__PURE__ */ new Set() : names;
|
|
1204
|
+
}
|
|
1205
|
+
if (resourceType === "AWS::Neptune::DBInstance") {
|
|
1206
|
+
const instance = await this.describeDBInstance(physicalId);
|
|
1207
|
+
return isUnmovingDbStatus(instance?.DBInstanceStatus) && !holdsPendingValue(instance?.PendingModifiedValues) ? /* @__PURE__ */ new Set() : names;
|
|
1208
|
+
}
|
|
1209
|
+
return /* @__PURE__ */ new Set();
|
|
1210
|
+
} catch {
|
|
1211
|
+
return names;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
async function readCurrentState(physicalId, _logicalId, resourceType) {
|
|
1215
|
+
switch (resourceType) {
|
|
1216
|
+
case "AWS::Neptune::DBInstance": return this.readCurrentStateDBInstance(physicalId);
|
|
1217
|
+
case "AWS::Neptune::DBCluster": return this.readCurrentStateDBCluster(physicalId);
|
|
1218
|
+
case "AWS::Neptune::DBSubnetGroup": return this.readCurrentStateDBSubnetGroup(physicalId);
|
|
1219
|
+
default: return;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
async function readCurrentStateDBInstance(physicalId) {
|
|
1223
|
+
let inst;
|
|
1224
|
+
try {
|
|
1225
|
+
inst = await this.describeDBInstance(physicalId);
|
|
1226
|
+
} catch (err) {
|
|
1227
|
+
if (err?.name === "DBInstanceNotFoundFault") return RESOURCE_NOT_FOUND;
|
|
1228
|
+
if (this.isNotFoundError(err, "DBInstanceNotFoundFault")) return void 0;
|
|
1229
|
+
throw err;
|
|
1230
|
+
}
|
|
1231
|
+
if (!inst) return RESOURCE_NOT_FOUND;
|
|
1232
|
+
const result = {};
|
|
1233
|
+
if (inst.DBInstanceIdentifier !== void 0) result["DBInstanceIdentifier"] = inst.DBInstanceIdentifier;
|
|
1234
|
+
if (inst.DBInstanceClass !== void 0) result["DBInstanceClass"] = inst.DBInstanceClass;
|
|
1235
|
+
if (inst.DBClusterIdentifier !== void 0) result["DBClusterIdentifier"] = inst.DBClusterIdentifier;
|
|
1236
|
+
if (inst.DBSubnetGroup?.DBSubnetGroupName !== void 0) result["DBSubnetGroupName"] = inst.DBSubnetGroup.DBSubnetGroupName;
|
|
1237
|
+
if (inst.AvailabilityZone !== void 0) result["AvailabilityZone"] = inst.AvailabilityZone;
|
|
1238
|
+
if (inst.PreferredMaintenanceWindow !== void 0) result["PreferredMaintenanceWindow"] = inst.PreferredMaintenanceWindow;
|
|
1239
|
+
if (inst.AutoMinorVersionUpgrade !== void 0) result["AutoMinorVersionUpgrade"] = inst.AutoMinorVersionUpgrade;
|
|
1240
|
+
if (inst.DeletionProtection !== void 0) result["DeletionProtection"] = inst.DeletionProtection;
|
|
1241
|
+
if (inst.PubliclyAccessible !== void 0) result["PubliclyAccessible"] = inst.PubliclyAccessible;
|
|
1242
|
+
const pg = inst.DBParameterGroups?.[0]?.DBParameterGroupName;
|
|
1243
|
+
if (pg !== void 0) result["DBParameterGroupName"] = pg;
|
|
1244
|
+
if (inst.DBInstanceArn) await this.attachTags(result, inst.DBInstanceArn);
|
|
1245
|
+
return result;
|
|
1246
|
+
}
|
|
1247
|
+
async function readCurrentStateDBCluster(physicalId) {
|
|
1248
|
+
let cluster;
|
|
1249
|
+
try {
|
|
1250
|
+
cluster = await this.describeDBCluster(physicalId);
|
|
1251
|
+
} catch (err) {
|
|
1252
|
+
if (err?.name === "DBClusterNotFoundFault") return RESOURCE_NOT_FOUND;
|
|
1253
|
+
if (this.isNotFoundError(err, "DBClusterNotFoundFault")) return void 0;
|
|
1254
|
+
throw err;
|
|
1255
|
+
}
|
|
1256
|
+
if (!cluster) return RESOURCE_NOT_FOUND;
|
|
1257
|
+
const result = {};
|
|
1258
|
+
if (cluster.DBClusterIdentifier !== void 0) result["DBClusterIdentifier"] = cluster.DBClusterIdentifier;
|
|
1259
|
+
if (cluster.EngineVersion !== void 0) result["EngineVersion"] = cluster.EngineVersion;
|
|
1260
|
+
if (cluster.Port !== void 0) {
|
|
1261
|
+
result["Port"] = cluster.Port;
|
|
1262
|
+
result["DBPort"] = cluster.Port;
|
|
1263
|
+
}
|
|
1264
|
+
result["VpcSecurityGroupIds"] = (cluster.VpcSecurityGroups ?? []).map((sg) => sg.VpcSecurityGroupId).filter((id) => !!id);
|
|
1265
|
+
if (cluster.DBSubnetGroup !== void 0) result["DBSubnetGroupName"] = cluster.DBSubnetGroup;
|
|
1266
|
+
if (cluster.StorageEncrypted !== void 0) result["StorageEncrypted"] = cluster.StorageEncrypted;
|
|
1267
|
+
if (cluster.KmsKeyId !== void 0) result["KmsKeyId"] = cluster.KmsKeyId;
|
|
1268
|
+
if (cluster.BackupRetentionPeriod !== void 0) result["BackupRetentionPeriod"] = cluster.BackupRetentionPeriod;
|
|
1269
|
+
if (cluster.PreferredBackupWindow !== void 0) result["PreferredBackupWindow"] = cluster.PreferredBackupWindow;
|
|
1270
|
+
if (cluster.PreferredMaintenanceWindow !== void 0) result["PreferredMaintenanceWindow"] = cluster.PreferredMaintenanceWindow;
|
|
1271
|
+
if (cluster.DBClusterParameterGroup !== void 0) result["DBClusterParameterGroupName"] = cluster.DBClusterParameterGroup;
|
|
1272
|
+
if (cluster.IAMDatabaseAuthenticationEnabled !== void 0) result["IamAuthEnabled"] = cluster.IAMDatabaseAuthenticationEnabled;
|
|
1273
|
+
if (cluster.DeletionProtection !== void 0) result["DeletionProtection"] = cluster.DeletionProtection;
|
|
1274
|
+
if (cluster.CopyTagsToSnapshot !== void 0) result["CopyTagsToSnapshot"] = cluster.CopyTagsToSnapshot;
|
|
1275
|
+
if (cluster.NetworkType !== void 0) result["NetworkType"] = cluster.NetworkType;
|
|
1276
|
+
const { MinCapacity: min, MaxCapacity: max } = cluster.ServerlessV2ScalingConfiguration ?? {};
|
|
1277
|
+
if (min !== void 0 || max !== void 0) result["ServerlessScalingConfiguration"] = {
|
|
1278
|
+
...min !== void 0 && { MinCapacity: min },
|
|
1279
|
+
...max !== void 0 && { MaxCapacity: max }
|
|
1280
|
+
};
|
|
1281
|
+
result["EnableCloudwatchLogsExports"] = cluster.EnabledCloudwatchLogsExports ?? [];
|
|
1282
|
+
result["AssociatedRoles"] = associatedRolesReadback(cluster.AssociatedRoles);
|
|
1283
|
+
if (cluster.DBClusterArn) await this.attachTags(result, cluster.DBClusterArn);
|
|
1284
|
+
return result;
|
|
1285
|
+
}
|
|
1286
|
+
async function readCurrentStateDBSubnetGroup(physicalId) {
|
|
1287
|
+
let resp;
|
|
1288
|
+
try {
|
|
1289
|
+
resp = await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: physicalId }));
|
|
1290
|
+
} catch (err) {
|
|
1291
|
+
if (err?.name === "DBSubnetGroupNotFoundFault") return RESOURCE_NOT_FOUND;
|
|
1292
|
+
if (this.isNotFoundError(err, "DBSubnetGroupNotFoundFault")) return void 0;
|
|
1293
|
+
throw err;
|
|
1294
|
+
}
|
|
1295
|
+
const sg = resp.DBSubnetGroups?.[0];
|
|
1296
|
+
if (!sg) return RESOURCE_NOT_FOUND;
|
|
1297
|
+
const result = {};
|
|
1298
|
+
if (sg.DBSubnetGroupName !== void 0) result["DBSubnetGroupName"] = sg.DBSubnetGroupName;
|
|
1299
|
+
if (sg.DBSubnetGroupDescription !== void 0) result["DBSubnetGroupDescription"] = sg.DBSubnetGroupDescription;
|
|
1300
|
+
result["SubnetIds"] = (sg.Subnets ?? []).map((s) => s.SubnetIdentifier).filter((id) => !!id);
|
|
1301
|
+
if (sg.DBSubnetGroupArn) await this.attachTags(result, sg.DBSubnetGroupArn);
|
|
1302
|
+
return result;
|
|
1303
|
+
}
|
|
1304
|
+
async function attachTags(result, arn) {
|
|
1305
|
+
try {
|
|
1306
|
+
const tagsResp = await this.getClient().send(new ListTagsForResourceCommand({ ResourceName: arn }));
|
|
1307
|
+
result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
|
|
1308
|
+
} catch (err) {
|
|
1309
|
+
this.logger.debug(`Neptune ListTagsForResource(${arn}) failed: ${describeAwsFailure(err).detail}`);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
// src/provisioning/providers/neptune/import.ts
|
|
1314
|
+
async function importImpl(input) {
|
|
1315
|
+
switch (input.resourceType) {
|
|
1316
|
+
case "AWS::Neptune::DBInstance": return this.importDBInstance(input);
|
|
1317
|
+
case "AWS::Neptune::DBCluster": return this.importDBCluster(input);
|
|
1318
|
+
case "AWS::Neptune::DBSubnetGroup": return this.importDBSubnetGroup(input);
|
|
1319
|
+
default: return null;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
async function importDBInstance(input) {
|
|
1323
|
+
const explicit = resolveExplicitPhysicalId(input, "DBInstanceIdentifier");
|
|
1324
|
+
if (explicit) try {
|
|
1325
|
+
const described = (await this.getClient().send(new DescribeDBInstancesCommand({ DBInstanceIdentifier: explicit }))).DBInstances?.[0];
|
|
1326
|
+
return {
|
|
1327
|
+
physicalId: explicit,
|
|
1328
|
+
attributes: instanceAttributes(described)
|
|
1329
|
+
};
|
|
1330
|
+
} catch (err) {
|
|
1331
|
+
if (err.name === "DBInstanceNotFoundFault") return null;
|
|
1332
|
+
throw err;
|
|
1333
|
+
}
|
|
1334
|
+
return null;
|
|
1335
|
+
}
|
|
1336
|
+
async function importDBCluster(input) {
|
|
1337
|
+
const explicit = resolveExplicitPhysicalId(input, "DBClusterIdentifier");
|
|
1338
|
+
if (explicit) try {
|
|
1339
|
+
const resp = await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: explicit }));
|
|
1340
|
+
return {
|
|
1341
|
+
physicalId: explicit,
|
|
1342
|
+
attributes: clusterAttributes(resp.DBClusters?.[0])
|
|
1343
|
+
};
|
|
1344
|
+
} catch (err) {
|
|
1345
|
+
if (err.name === "DBClusterNotFoundFault") return null;
|
|
1346
|
+
throw err;
|
|
1347
|
+
}
|
|
1348
|
+
return null;
|
|
1349
|
+
}
|
|
1350
|
+
async function importDBSubnetGroup(input) {
|
|
1351
|
+
const explicit = resolveExplicitPhysicalId(input, "DBSubnetGroupName");
|
|
1352
|
+
if (explicit) try {
|
|
1353
|
+
await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: explicit }));
|
|
1354
|
+
return {
|
|
1355
|
+
physicalId: explicit,
|
|
1356
|
+
attributes: {}
|
|
1357
|
+
};
|
|
1358
|
+
} catch (err) {
|
|
1359
|
+
if (err.name === "DBSubnetGroupNotFoundFault") return null;
|
|
1360
|
+
throw err;
|
|
1361
|
+
}
|
|
1362
|
+
return null;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
// src/provisioning/providers/neptune-provider.ts
|
|
1366
|
+
var NeptuneProvider = class {
|
|
1367
|
+
neptuneClient;
|
|
1368
|
+
createClient;
|
|
1369
|
+
ec2Client;
|
|
1370
|
+
providerRegion;
|
|
1371
|
+
logger = getLogger().child("NeptuneProvider");
|
|
1372
|
+
protectionFlips = new ProtectionFlipRegistry();
|
|
1373
|
+
handledProperties = /* @__PURE__ */ new Map([
|
|
1374
|
+
["AWS::Neptune::DBSubnetGroup", /* @__PURE__ */ new Set([
|
|
1375
|
+
"DBSubnetGroupName",
|
|
1376
|
+
"DBSubnetGroupDescription",
|
|
1377
|
+
"SubnetIds",
|
|
1378
|
+
"Tags"
|
|
1379
|
+
])],
|
|
1380
|
+
["AWS::Neptune::DBCluster", /* @__PURE__ */ new Set([
|
|
1381
|
+
"DBClusterIdentifier",
|
|
1382
|
+
"EngineVersion",
|
|
1383
|
+
"DBPort",
|
|
1384
|
+
"Port",
|
|
1385
|
+
"VpcSecurityGroupIds",
|
|
1386
|
+
"DBSubnetGroupName",
|
|
1387
|
+
"StorageEncrypted",
|
|
1388
|
+
"KmsKeyId",
|
|
1389
|
+
"BackupRetentionPeriod",
|
|
1390
|
+
"PreferredBackupWindow",
|
|
1391
|
+
"PreferredMaintenanceWindow",
|
|
1392
|
+
"DBClusterParameterGroupName",
|
|
1393
|
+
"IamAuthEnabled",
|
|
1394
|
+
"DeletionProtection",
|
|
1395
|
+
"Tags",
|
|
1396
|
+
"AssociatedRoles",
|
|
1397
|
+
"AvailabilityZones",
|
|
1398
|
+
"CopyTagsToSnapshot",
|
|
1399
|
+
"DBInstanceParameterGroupName",
|
|
1400
|
+
"EnableCloudwatchLogsExports",
|
|
1401
|
+
"NetworkType",
|
|
1402
|
+
"ServerlessScalingConfiguration",
|
|
1403
|
+
"RestoreToTime",
|
|
1404
|
+
"RestoreType",
|
|
1405
|
+
"SnapshotIdentifier",
|
|
1406
|
+
"SourceDBClusterIdentifier",
|
|
1407
|
+
"UseLatestRestorableTime"
|
|
1408
|
+
])],
|
|
1409
|
+
["AWS::Neptune::DBInstance", /* @__PURE__ */ new Set([
|
|
1410
|
+
"DBInstanceIdentifier",
|
|
1411
|
+
"DBInstanceClass",
|
|
1412
|
+
"DBClusterIdentifier",
|
|
1413
|
+
"DBSubnetGroupName",
|
|
1414
|
+
"DBParameterGroupName",
|
|
1415
|
+
"AvailabilityZone",
|
|
1416
|
+
"PreferredMaintenanceWindow",
|
|
1417
|
+
"AutoMinorVersionUpgrade",
|
|
1418
|
+
"DeletionProtection",
|
|
1419
|
+
"Tags",
|
|
1420
|
+
"AllowMajorVersionUpgrade",
|
|
1421
|
+
"PubliclyAccessible"
|
|
1422
|
+
])]
|
|
1423
|
+
]);
|
|
1424
|
+
unhandledByDesign = /* @__PURE__ */ new Map([["AWS::Neptune::DBCluster", /* @__PURE__ */ new Map([["GlobalClusterIdentifier", "Cloud Control owns a global-cluster member: NeptuneProvider has no detach, and a member cannot be deleted while attached (deletesThroughSdkProvider keeps its delete there too)"]])], ["AWS::Neptune::DBInstance", /* @__PURE__ */ new Map([["DBSnapshotIdentifier", "The CloudFormation schema documents it as not supported, and CreateDBInstance has no such member: a Neptune instance is not restored from a snapshot, its cluster is"]])]]);
|
|
1425
|
+
removalHandledInUpdate = /* @__PURE__ */ new Map([["AWS::Neptune::DBCluster", /* @__PURE__ */ new Set([
|
|
1426
|
+
"DBClusterIdentifier",
|
|
1427
|
+
"DBSubnetGroupName",
|
|
1428
|
+
"StorageEncrypted",
|
|
1429
|
+
"KmsKeyId",
|
|
1430
|
+
"AvailabilityZones",
|
|
1431
|
+
"VpcSecurityGroupIds",
|
|
1432
|
+
"Tags",
|
|
1433
|
+
"AssociatedRoles",
|
|
1434
|
+
"EnableCloudwatchLogsExports",
|
|
1435
|
+
"DBInstanceParameterGroupName",
|
|
1436
|
+
"RestoreToTime",
|
|
1437
|
+
"RestoreType",
|
|
1438
|
+
"SnapshotIdentifier",
|
|
1439
|
+
"SourceDBClusterIdentifier",
|
|
1440
|
+
"UseLatestRestorableTime",
|
|
1441
|
+
...CLUSTER_KEPT_ON_REMOVAL,
|
|
1442
|
+
...CLUSTER_UNMEASURED_ON_REMOVAL
|
|
1443
|
+
])], ["AWS::Neptune::DBInstance", /* @__PURE__ */ new Set([
|
|
1444
|
+
"DBInstanceIdentifier",
|
|
1445
|
+
"DBClusterIdentifier",
|
|
1446
|
+
"DBSubnetGroupName",
|
|
1447
|
+
"AvailabilityZone",
|
|
1448
|
+
"DBInstanceClass",
|
|
1449
|
+
"DeletionProtection",
|
|
1450
|
+
"Tags",
|
|
1451
|
+
"AllowMajorVersionUpgrade",
|
|
1452
|
+
"PubliclyAccessible",
|
|
1453
|
+
...INSTANCE_KEPT_ON_REMOVAL
|
|
1454
|
+
])]]);
|
|
1455
|
+
constructor(options) {
|
|
1456
|
+
this.providerRegion = options?.region ?? ambientRegion();
|
|
1457
|
+
}
|
|
1458
|
+
getClient() {
|
|
1459
|
+
return getClient.call(this);
|
|
1460
|
+
}
|
|
1461
|
+
getEc2Client() {
|
|
1462
|
+
return getEc2Client.call(this);
|
|
1463
|
+
}
|
|
1464
|
+
getCreateClient() {
|
|
1465
|
+
return getCreateClient.call(this);
|
|
1466
|
+
}
|
|
1467
|
+
create(logicalId, resourceType, properties, context) {
|
|
1468
|
+
return create.call(this, logicalId, resourceType, properties, context);
|
|
1469
|
+
}
|
|
1470
|
+
update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
1471
|
+
return update.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
1472
|
+
}
|
|
1473
|
+
delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
1474
|
+
return deleteImpl.call(this, logicalId, physicalId, resourceType, _properties, context);
|
|
1475
|
+
}
|
|
1476
|
+
createDBSubnetGroup(logicalId, resourceType, properties, mask) {
|
|
1477
|
+
return createDBSubnetGroup.call(this, logicalId, resourceType, properties, mask);
|
|
1478
|
+
}
|
|
1479
|
+
updateDBSubnetGroup(logicalId, physicalId, resourceType, properties, previousProperties, mask) {
|
|
1480
|
+
return updateDBSubnetGroup.call(this, logicalId, physicalId, resourceType, properties, previousProperties, mask);
|
|
1481
|
+
}
|
|
1482
|
+
deleteDBSubnetGroup(logicalId, physicalId, resourceType, context) {
|
|
1483
|
+
return deleteDBSubnetGroup.call(this, logicalId, physicalId, resourceType, context);
|
|
1484
|
+
}
|
|
1485
|
+
createDBCluster(logicalId, resourceType, properties, mask, replayingState) {
|
|
1486
|
+
return createDBCluster.call(this, logicalId, resourceType, properties, mask, replayingState);
|
|
1487
|
+
}
|
|
1488
|
+
sendRestoreFollowUp(logicalId, resourceType, physicalId, followUp, mask) {
|
|
1489
|
+
return sendRestoreFollowUp.call(this, logicalId, resourceType, physicalId, followUp, mask);
|
|
1490
|
+
}
|
|
1491
|
+
warnIgnoredRestoreProperties(logicalId, resourceType, properties, restore) {
|
|
1492
|
+
return warnIgnoredRestoreProperties.call(this, logicalId, resourceType, properties, restore);
|
|
1493
|
+
}
|
|
1494
|
+
updateDBCluster(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
1495
|
+
return updateDBCluster.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
1496
|
+
}
|
|
1497
|
+
deleteDBCluster(logicalId, physicalId, resourceType, context) {
|
|
1498
|
+
return deleteDBCluster.call(this, logicalId, physicalId, resourceType, context);
|
|
1499
|
+
}
|
|
1500
|
+
deleteDBClusterOnce(logicalId, physicalId, resourceType, context, flip) {
|
|
1501
|
+
return deleteDBClusterOnce.call(this, logicalId, physicalId, resourceType, context, flip);
|
|
1502
|
+
}
|
|
1503
|
+
createDBInstance(logicalId, resourceType, properties, mask, replayingState) {
|
|
1504
|
+
return createDBInstance.call(this, logicalId, resourceType, properties, mask, replayingState);
|
|
1505
|
+
}
|
|
1506
|
+
updateDBInstance(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
1507
|
+
return updateDBInstance.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
1508
|
+
}
|
|
1509
|
+
deleteDBInstance(logicalId, physicalId, resourceType, context) {
|
|
1510
|
+
return deleteDBInstance.call(this, logicalId, physicalId, resourceType, context);
|
|
1511
|
+
}
|
|
1512
|
+
deleteDBInstanceOnce(logicalId, physicalId, resourceType, context, flip) {
|
|
1513
|
+
return deleteDBInstanceOnce.call(this, logicalId, physicalId, resourceType, context, flip);
|
|
1514
|
+
}
|
|
1515
|
+
wrapCaughtError(mask, error, build) {
|
|
1516
|
+
return wrapCaughtError.call(this, mask, error, build);
|
|
1517
|
+
}
|
|
1518
|
+
wrapDeleteError(mask, error, build) {
|
|
1519
|
+
return wrapDeleteError.call(this, mask, error, build);
|
|
1520
|
+
}
|
|
1521
|
+
applyTagDiff(arn, resourceType, logicalId, oldTagsRaw, newTagsRaw) {
|
|
1522
|
+
return applyTagDiff.call(this, arn, resourceType, logicalId, oldTagsRaw, newTagsRaw);
|
|
1523
|
+
}
|
|
1524
|
+
isNotFoundError(error, faultName) {
|
|
1525
|
+
return isNotFoundError.call(this, error, faultName);
|
|
1526
|
+
}
|
|
1527
|
+
isSameResource(journaledPhysicalId, record, resourceType, context) {
|
|
1528
|
+
return isSameResource.call(this, journaledPhysicalId, record, resourceType, context);
|
|
1529
|
+
}
|
|
1530
|
+
resourceIdentity(physicalId, resourceType, context) {
|
|
1531
|
+
return resourceIdentity.call(this, physicalId, resourceType, context);
|
|
1532
|
+
}
|
|
1533
|
+
readDbResourceIdIfExists(resourceType, identifier) {
|
|
1534
|
+
return readDbResourceIdIfExists.call(this, resourceType, identifier);
|
|
1535
|
+
}
|
|
1536
|
+
readClusterBlocks(properties, resourceType, logicalId, origin) {
|
|
1537
|
+
return readClusterBlocks.call(this, properties, resourceType, logicalId, origin);
|
|
1538
|
+
}
|
|
1539
|
+
applyClusterRoles(logicalId, physicalId, desired, previous, mask, marks) {
|
|
1540
|
+
return applyClusterRoles.call(this, logicalId, physicalId, desired, previous, mask, marks);
|
|
1541
|
+
}
|
|
1542
|
+
waitForClusterRolesSettled(logicalId, physicalId, attached, detached, mask) {
|
|
1543
|
+
return waitForClusterRolesSettled.call(this, logicalId, physicalId, attached, detached, mask);
|
|
1544
|
+
}
|
|
1545
|
+
waitForApplied(logicalId, what, applied) {
|
|
1546
|
+
return waitForApplied.call(this, logicalId, what, applied);
|
|
1547
|
+
}
|
|
1548
|
+
pollUntilSettled(settled) {
|
|
1549
|
+
return pollUntilSettled.call(this, settled);
|
|
1550
|
+
}
|
|
1551
|
+
describeDBCluster(dbClusterIdentifier) {
|
|
1552
|
+
return describeDBCluster.call(this, dbClusterIdentifier);
|
|
1553
|
+
}
|
|
1554
|
+
warnKeptRemovals(logicalId, resourceType, properties, previousProperties, kept, context, measured = true) {
|
|
1555
|
+
return warnKeptRemovals.call(this, logicalId, resourceType, properties, previousProperties, kept, context, measured);
|
|
1556
|
+
}
|
|
1557
|
+
readPublicAccess(properties, resourceType, logicalId, physicalId, stateBorne) {
|
|
1558
|
+
return readPublicAccess.call(this, properties, resourceType, logicalId, physicalId, stateBorne);
|
|
1559
|
+
}
|
|
1560
|
+
warnPublicAccessKept(logicalId, resourceType, properties, previousProperties, context) {
|
|
1561
|
+
return warnPublicAccessKept.call(this, logicalId, resourceType, properties, previousProperties, context);
|
|
1562
|
+
}
|
|
1563
|
+
dbClusterSecurityGroupsToSend(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
1564
|
+
return dbClusterSecurityGroupsToSend.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
1565
|
+
}
|
|
1566
|
+
describeDBInstance(dbInstanceIdentifier) {
|
|
1567
|
+
return describeDBInstance.call(this, dbInstanceIdentifier);
|
|
1568
|
+
}
|
|
1569
|
+
waitForMemberAfterSecurityGroupChange(dbInstanceIdentifier, clusterLogicalId, maxWaitMs = 18e5) {
|
|
1570
|
+
return waitForMemberAfterSecurityGroupChange.call(this, dbInstanceIdentifier, clusterLogicalId, maxWaitMs);
|
|
1571
|
+
}
|
|
1572
|
+
requireClusterWhileWaiting(cluster, logicalId) {
|
|
1573
|
+
return requireClusterWhileWaiting.call(this, cluster, logicalId);
|
|
1574
|
+
}
|
|
1575
|
+
waitForSecurityGroupsApplied(dbClusterIdentifier, logicalId, expected, maxWaitMs = 18e5) {
|
|
1576
|
+
return waitForSecurityGroupsApplied.call(this, dbClusterIdentifier, logicalId, expected, maxWaitMs);
|
|
1577
|
+
}
|
|
1578
|
+
deleteAfterProtectionFlip(logicalId, physicalId, send) {
|
|
1579
|
+
return deleteAfterProtectionFlip.call(this, logicalId, physicalId, send);
|
|
1580
|
+
}
|
|
1581
|
+
waitForClusterAvailable(logicalId, dbClusterIdentifier, during = "being created", maxWaitMs = CLUSTER_AVAILABLE_MAX_WAIT_MS) {
|
|
1582
|
+
return waitForClusterAvailable.call(this, logicalId, dbClusterIdentifier, during, maxWaitMs);
|
|
1583
|
+
}
|
|
1584
|
+
waitForClusterDeleted(logicalId, dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
1585
|
+
return waitForClusterDeleted.call(this, logicalId, dbClusterIdentifier, maxWaitMs);
|
|
1586
|
+
}
|
|
1587
|
+
waitForInstanceAvailable(logicalId, dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
1588
|
+
return waitForInstanceAvailable.call(this, logicalId, dbInstanceIdentifier, maxWaitMs);
|
|
1589
|
+
}
|
|
1590
|
+
waitForInstanceDeleted(dbInstanceIdentifier, maxWaitMs = 18e5) {
|
|
1591
|
+
return waitForInstanceDeleted.call(this, dbInstanceIdentifier, maxWaitMs);
|
|
1592
|
+
}
|
|
1593
|
+
sleep(ms) {
|
|
1594
|
+
return sleep.call(this, ms);
|
|
1595
|
+
}
|
|
1596
|
+
getDriftUnknownPaths(resourceType) {
|
|
1597
|
+
return getDriftUnknownPaths.call(this, resourceType);
|
|
1598
|
+
}
|
|
1599
|
+
getDriftUnorderedPaths(resourceType) {
|
|
1600
|
+
return getDriftUnorderedPaths.call(this, resourceType);
|
|
1601
|
+
}
|
|
1602
|
+
canonicalizeDriftProperties(resourceType, properties) {
|
|
1603
|
+
return canonicalizeDriftProperties.call(this, resourceType, properties);
|
|
1604
|
+
}
|
|
1605
|
+
canonicalizeUnsettledProperties(resourceType, properties) {
|
|
1606
|
+
return canonicalizeUnsettledProperties.call(this, resourceType, properties);
|
|
1607
|
+
}
|
|
1608
|
+
readUnsettled(physicalId, logicalId, resourceType, names, recordedProperties, desiredProperties, attemptedItems) {
|
|
1609
|
+
return readUnsettled.call(this, physicalId, logicalId, resourceType, names, recordedProperties, desiredProperties, attemptedItems);
|
|
1610
|
+
}
|
|
1611
|
+
unsettledInTransition(physicalId, _logicalId, resourceType, names, _recordedProperties, desiredProperties) {
|
|
1612
|
+
return unsettledInTransition.call(this, physicalId, _logicalId, resourceType, names, _recordedProperties, desiredProperties);
|
|
1613
|
+
}
|
|
1614
|
+
import(input) {
|
|
1615
|
+
return importImpl.call(this, input);
|
|
1616
|
+
}
|
|
1617
|
+
readCurrentState(physicalId, _logicalId, resourceType) {
|
|
1618
|
+
return readCurrentState.call(this, physicalId, _logicalId, resourceType);
|
|
1619
|
+
}
|
|
1620
|
+
readCurrentStateDBInstance(physicalId) {
|
|
1621
|
+
return readCurrentStateDBInstance.call(this, physicalId);
|
|
1622
|
+
}
|
|
1623
|
+
readCurrentStateDBCluster(physicalId) {
|
|
1624
|
+
return readCurrentStateDBCluster.call(this, physicalId);
|
|
1625
|
+
}
|
|
1626
|
+
readCurrentStateDBSubnetGroup(physicalId) {
|
|
1627
|
+
return readCurrentStateDBSubnetGroup.call(this, physicalId);
|
|
1628
|
+
}
|
|
1629
|
+
attachTags(result, arn) {
|
|
1630
|
+
return attachTags.call(this, result, arn);
|
|
1631
|
+
}
|
|
1632
|
+
importDBInstance(input) {
|
|
1633
|
+
return importDBInstance.call(this, input);
|
|
1634
|
+
}
|
|
1635
|
+
importDBCluster(input) {
|
|
1636
|
+
return importDBCluster.call(this, input);
|
|
1637
|
+
}
|
|
1638
|
+
importDBSubnetGroup(input) {
|
|
1639
|
+
return importDBSubnetGroup.call(this, input);
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
export { NeptuneProvider };
|
|
1644
|
+
//# sourceMappingURL=neptune-provider-B1o5gxWk.js.map
|