cdk-real-drift 0.25.5 → 0.26.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/README.md CHANGED
@@ -902,7 +902,8 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
902
902
  `lambda:GetPolicy`, `budgets:ViewBudget`, `ec2:DescribeAddresses`,
903
903
  `ec2:DescribeLaunchTemplateVersions`, `ec2:DescribeNetworkAcls`,
904
904
  `route53:ListResourceRecordSets`, `route53:ListHostedZonesByName` (resolves a
905
- RecordSet declared via `HostedZoneName` instead of `HostedZoneId` to its zone
905
+ RecordSet — or a RecordSetGroup, which is read member-by-member via the same
906
+ listing — declared via `HostedZoneName` instead of `HostedZoneId` to its zone
906
907
  id),
907
908
  `ses:DescribeReceiptRuleSet`, `ses:DescribeReceiptRule`, `ses:ListReceiptFilters`
908
909
  (the SES inbound receipt-rule family — `ReceiptRuleSet` / `ReceiptRule` /
package/dist/cli.js CHANGED
@@ -4073,6 +4073,7 @@ const JSON_STRING_PROPS = { "AWS::Config::ConfigRule": new Set(["InputParameters
4073
4073
  const JSON_STRING_DEFAULT_FILLS = { "AWS::CE::CostCategory": { Rules: { Type: "REGULAR" } } };
4074
4074
  const CASE_INSENSITIVE_PATHS = {
4075
4075
  "AWS::Route53::RecordSet": new Set(["Name", "AliasTarget.DNSName"]),
4076
+ "AWS::Route53::RecordSetGroup": new Set(["RecordSets.*.Name", "RecordSets.*.AliasTarget.DNSName"]),
4076
4077
  "AWS::Batch::ComputeEnvironment": new Set(["Type"]),
4077
4078
  "AWS::Batch::JobDefinition": new Set(["Type"]),
4078
4079
  "AWS::EMRServerless::Application": new Set(["Type"]),
@@ -4648,6 +4649,7 @@ const UNORDERED_ARRAY_PROPS = {
4648
4649
  ]),
4649
4650
  "AWS::WAFv2::IPSet": new Set(["Addresses"]),
4650
4651
  "AWS::Route53::RecordSet": new Set(["ResourceRecords"]),
4652
+ "AWS::Route53::RecordSetGroup": new Set(["RecordSets.*.ResourceRecords"]),
4651
4653
  "AWS::CodeDeploy::DeploymentGroup": new Set(["AutoRollbackConfiguration.Events"]),
4652
4654
  "AWS::RDS::DBInstance": new Set(["EnableCloudwatchLogsExports"]),
4653
4655
  "AWS::RDS::DBCluster": new Set(["EnableCloudwatchLogsExports"]),
@@ -13164,10 +13166,13 @@ const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
13164
13166
  startId = r.NextRecordIdentifier;
13165
13167
  }
13166
13168
  if (!rec) throw new ResourceGoneError(`Route53 RecordSet ${name} ${type} absent from zone ${hostedZoneId}`);
13169
+ return projectRoute53RecordModel(rec, declared, byName ? { HostedZoneName: zoneName } : { HostedZoneId: hostedZoneId });
13170
+ };
13171
+ function projectRoute53RecordModel(rec, declared, zoneField) {
13167
13172
  const model = {
13168
13173
  Name: alignTrailingDot(rec.Name === void 0 ? void 0 : unescapeRoute53Name(rec.Name), declared.Name),
13169
13174
  Type: rec.Type,
13170
- ...byName ? { HostedZoneName: zoneName } : { HostedZoneId: hostedZoneId }
13175
+ ...zoneField
13171
13176
  };
13172
13177
  if (rec.TTL !== void 0) model.TTL = String(rec.TTL);
13173
13178
  const records = rec.ResourceRecords?.map((rr) => rr.Value).filter((v) => !!v);
@@ -13208,6 +13213,39 @@ const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
13208
13213
  ...cidr.LocationName !== void 0 && { LocationName: cidr.LocationName }
13209
13214
  };
13210
13215
  return model;
13216
+ }
13217
+ const readRoute53RecordSetGroup = async ({ declared, region }) => {
13218
+ const c = new Route53Client({
13219
+ region,
13220
+ ...READ_RETRY
13221
+ });
13222
+ const declaredZoneId = str$1(declared.HostedZoneId);
13223
+ const zoneName = str$1(declared.HostedZoneName);
13224
+ const byName = !declaredZoneId && !!zoneName;
13225
+ const hostedZoneId = declaredZoneId ?? (zoneName ? await resolveHostedZoneIdByName(c, zoneName) : void 0);
13226
+ const declSets = Array.isArray(declared.RecordSets) ? declared.RecordSets : void 0;
13227
+ if (!hostedZoneId || !declSets) return void 0;
13228
+ const live = await pageResourceRecordSets(c, hostedZoneId);
13229
+ const canon = (s) => unescapeRoute53Name(s).replace(/\.$/, "").toLowerCase();
13230
+ const projected = [];
13231
+ for (const d of declSets) {
13232
+ if (!d || typeof d !== "object") continue;
13233
+ const name = str$1(d.Name);
13234
+ const type = str$1(d.Type);
13235
+ if (!name || !type) continue;
13236
+ const declSetId = str$1(d.SetIdentifier);
13237
+ const rec = live.find((x) => x.Type === type && !!x.Name && canon(x.Name) === canon(name) && (x.SetIdentifier ?? void 0) === declSetId);
13238
+ if (!rec) continue;
13239
+ projected.push(projectRoute53RecordModel(rec, d, {
13240
+ ...str$1(d.HostedZoneId) !== void 0 && { HostedZoneId: d.HostedZoneId },
13241
+ ...str$1(d.HostedZoneName) !== void 0 && { HostedZoneName: d.HostedZoneName }
13242
+ }));
13243
+ }
13244
+ return {
13245
+ ...declaredZoneId !== void 0 && { HostedZoneId: declaredZoneId },
13246
+ ...byName && { HostedZoneName: zoneName },
13247
+ RecordSets: projected
13248
+ };
13211
13249
  };
13212
13250
  const readGlueTable = async ({ physicalId, declared, region }) => {
13213
13251
  const idParts = physicalId.split("|");
@@ -14113,6 +14151,7 @@ const SDK_OVERRIDES = {
14113
14151
  "AWS::MediaConvert::Queue": readMediaConvertQueue,
14114
14152
  "AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
14115
14153
  "AWS::Route53::RecordSet": readRoute53RecordSet,
14154
+ "AWS::Route53::RecordSetGroup": readRoute53RecordSetGroup,
14116
14155
  "AWS::Glue::Table": readGlueTable,
14117
14156
  "AWS::Glue::Classifier": readGlueClassifier,
14118
14157
  "AWS::Glue::Workflow": readGlueWorkflow,
@@ -18979,12 +19018,10 @@ const RR_ROUTING_FIELDS = [
18979
19018
  "GeoProximityLocation",
18980
19019
  "CidrRoutingConfig"
18981
19020
  ];
18982
- const writeRoute53RecordSet = async (ctx, ops) => {
18983
- const m = await desiredModel("AWS::Route53::RecordSet", ctx, ops);
18984
- const zone = str(m.HostedZoneId) ?? str(ctx.declared["HostedZoneId"]);
18985
- const name = str(m.Name) ?? str(ctx.declared["Name"]);
18986
- const type = str(m.Type) ?? str(ctx.declared["Type"]);
18987
- if (!zone || !name || !type) throw new Error("cannot resolve Route53 record target for revert");
19021
+ function buildRoute53RrSet(m) {
19022
+ const name = str(m.Name);
19023
+ const type = str(m.Type);
19024
+ if (!name || !type) return void 0;
18988
19025
  const rrset = {
18989
19026
  Name: name,
18990
19027
  Type: type
@@ -18993,6 +19030,17 @@ const writeRoute53RecordSet = async (ctx, ops) => {
18993
19030
  if (Array.isArray(m.ResourceRecords)) rrset.ResourceRecords = m.ResourceRecords.map((v) => ({ Value: v }));
18994
19031
  if (m.AliasTarget !== void 0) rrset.AliasTarget = m.AliasTarget;
18995
19032
  for (const k of RR_ROUTING_FIELDS) if (m[k] !== void 0) rrset[k] = m[k];
19033
+ return rrset;
19034
+ }
19035
+ const writeRoute53RecordSet = async (ctx, ops) => {
19036
+ const m = await desiredModel("AWS::Route53::RecordSet", ctx, ops);
19037
+ const zone = str(m.HostedZoneId) ?? str(ctx.declared["HostedZoneId"]);
19038
+ const rrset = buildRoute53RrSet({
19039
+ ...m,
19040
+ Name: str(m.Name) ?? str(ctx.declared["Name"]),
19041
+ Type: str(m.Type) ?? str(ctx.declared["Type"])
19042
+ });
19043
+ if (!zone || !rrset) throw new Error("cannot resolve Route53 record target for revert");
18996
19044
  await new Route53Client({
18997
19045
  region: ctx.region,
18998
19046
  ...CLIENT_TIMEOUTS
@@ -19004,6 +19052,37 @@ const writeRoute53RecordSet = async (ctx, ops) => {
19004
19052
  }] }
19005
19053
  }));
19006
19054
  };
19055
+ const writeRoute53RecordSetGroup = async (ctx, ops) => {
19056
+ const m = await desiredModel("AWS::Route53::RecordSetGroup", ctx, ops);
19057
+ let zone = str(m.HostedZoneId) ?? str(ctx.declared["HostedZoneId"]);
19058
+ if (!zone) {
19059
+ const zoneName = str(m.HostedZoneName) ?? str(ctx.declared["HostedZoneName"]);
19060
+ if (zoneName) zone = await resolveHostedZoneIdByName(new Route53Client({
19061
+ region: ctx.region,
19062
+ ...CLIENT_TIMEOUTS
19063
+ }), zoneName);
19064
+ }
19065
+ const sets = Array.isArray(m.RecordSets) ? m.RecordSets : [];
19066
+ if (!zone || sets.length === 0) throw new Error("cannot resolve Route53 record-set-group target for revert");
19067
+ const wholeArray = ops.some((o) => o.path === "/RecordSets");
19068
+ const touched = /* @__PURE__ */ new Set();
19069
+ for (const o of ops) {
19070
+ const i = /^\/RecordSets\/(\d+)(\/|$)/.exec(o.path)?.[1];
19071
+ if (i !== void 0) touched.add(Number(i));
19072
+ }
19073
+ const changes = (wholeArray ? sets : [...touched].map((i) => sets[i]).filter((s) => !!s)).map((member) => buildRoute53RrSet(member)).filter((r) => r !== void 0).map((rrset) => ({
19074
+ Action: "UPSERT",
19075
+ ResourceRecordSet: rrset
19076
+ }));
19077
+ if (changes.length === 0) throw new Error("Route53 record-set-group revert: no member resolved from the revert ops");
19078
+ await new Route53Client({
19079
+ region: ctx.region,
19080
+ ...CLIENT_TIMEOUTS
19081
+ }).send(new ChangeResourceRecordSetsCommand({
19082
+ HostedZoneId: zone,
19083
+ ChangeBatch: { Changes: changes }
19084
+ }));
19085
+ };
19007
19086
  const configInputParametersString = (v) => {
19008
19087
  let model = v;
19009
19088
  if (typeof v === "string") try {
@@ -20214,6 +20293,7 @@ const SDK_WRITERS = {
20214
20293
  "AWS::DLM::LifecyclePolicy": writeDlmLifecyclePolicy,
20215
20294
  "AWS::Logs::MetricFilter": writeMetricFilter,
20216
20295
  "AWS::Route53::RecordSet": writeRoute53RecordSet,
20296
+ "AWS::Route53::RecordSetGroup": writeRoute53RecordSetGroup,
20217
20297
  "AWS::DocDB::DBCluster": writeDocDbCluster,
20218
20298
  "AWS::DocDB::DBInstance": writeDocDbInstance,
20219
20299
  "AWS::ServiceDiscovery::HttpNamespace": writeServiceDiscoveryHttpNamespace,