cdk-real-drift 0.2.5 → 0.2.6

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
@@ -583,7 +583,13 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
583
583
  `elasticache:DescribeReplicationGroups` + `elasticache:DescribeCacheClusters`
584
584
  (supplement an `AWS::ElastiCache::ReplicationGroup` with its writeOnly
585
585
  `PreferredMaintenanceWindow` / `NotificationTopicArn` / `EngineVersion`, read
586
- from the member cache cluster), `ecs:DescribeServices` (supplements an
586
+ from the member cache cluster),
587
+ `elasticache:DescribeCacheParameterGroups` + `elasticache:DescribeCacheParameters`
588
+ (read an `AWS::ElastiCache::ParameterGroup`'s `Properties` as the `Source=user`
589
+ MODIFIED set only — the Cloud Control read returns the full effective set, so the
590
+ ~60 inherited engine defaults would otherwise surface as first-run drift; an
591
+ out-of-band parameter change is `Source=user` and still detected),
592
+ `ecs:DescribeServices` (supplements an
587
593
  `AWS::ECS::Service` with its writeOnly `ServiceConnectConfiguration` /
588
594
  `VolumeConfigurations`, read from the PRIMARY deployment),
589
595
  `elasticache:DescribeUsers` + `memorydb:DescribeUsers` (supplement an
@@ -633,6 +639,10 @@ permissions), plus, for the SDK-written types: `s3:PutBucketPolicy` /
633
639
  the whole `ConnectionInput` is re-supplied; a connection with an inline password
634
640
  is refused, never overwritten, so the un-read credential is never cleared),
635
641
  `logs:PutMetricFilter`, `route53:ChangeResourceRecordSets`,
642
+ `elasticache:ModifyCacheParameterGroup` / `ResetCacheParameterGroup` (revert an
643
+ `AWS::ElastiCache::ParameterGroup` — a changed declared parameter is modified back
644
+ to its desired value; an out-of-band-added undeclared parameter is reset to the
645
+ family default),
636
646
  `ses:UpdateReceiptRule` (reverts an `AWS::SES::ReceiptRule` — the whole rule is
637
647
  re-supplied in place, since Cloud Control has no handler for the type),
638
648
  `cloudwatch:PutAnomalyDetector` (reverts an `AWS::CloudWatch::AnomalyDetector`
package/dist/cli.js CHANGED
@@ -31,7 +31,7 @@ import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetTableComm
31
31
  import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
32
32
  import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
33
33
  import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
34
- import { DescribeCacheClustersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient } from "@aws-sdk/client-elasticache";
34
+ import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
35
35
  import { DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient } from "@aws-sdk/client-memorydb";
36
36
  import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
37
37
  import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
@@ -6572,6 +6572,37 @@ const readDaxParameterGroup = async ({ physicalId, region }) => {
6572
6572
  if (Object.keys(values).length > 0) model.ParameterNameValues = values;
6573
6573
  return model;
6574
6574
  };
6575
+ const readElastiCacheParameterGroup = async ({ physicalId, region }) => {
6576
+ const name = str$1(physicalId);
6577
+ if (!name) return void 0;
6578
+ const c = new ElastiCacheClient({
6579
+ region,
6580
+ ...READ_RETRY
6581
+ });
6582
+ const g = (await c.send(new DescribeCacheParameterGroupsCommand({ CacheParameterGroupName: name }))).CacheParameterGroups?.[0];
6583
+ if (!g) throw new ResourceGoneError(`ElastiCache ParameterGroup ${name} absent`);
6584
+ const model = {};
6585
+ if (str$1(g.CacheParameterGroupName)) model.CacheParameterGroupName = g.CacheParameterGroupName;
6586
+ if (str$1(g.CacheParameterGroupFamily)) model.CacheParameterGroupFamily = g.CacheParameterGroupFamily;
6587
+ if (str$1(g.Description)) model.Description = g.Description;
6588
+ const values = {};
6589
+ let marker;
6590
+ do {
6591
+ const p = await c.send(new DescribeCacheParametersCommand({
6592
+ CacheParameterGroupName: name,
6593
+ Source: "user",
6594
+ Marker: marker
6595
+ }));
6596
+ for (const param of p.Parameters ?? []) {
6597
+ const pName = str$1(param.ParameterName);
6598
+ const pValue = param.ParameterValue;
6599
+ if (pName !== void 0 && typeof pValue === "string") values[pName] = pValue;
6600
+ }
6601
+ marker = str$1(p.Marker);
6602
+ } while (marker !== void 0);
6603
+ if (Object.keys(values).length > 0) model.Properties = values;
6604
+ return model;
6605
+ };
6575
6606
  const readDaxSubnetGroup = async ({ physicalId, region }) => {
6576
6607
  const name = str$1(physicalId);
6577
6608
  if (!name) return void 0;
@@ -7141,6 +7172,7 @@ const SDK_OVERRIDES = {
7141
7172
  "AWS::EC2::ClientVpnTargetNetworkAssociation": readEc2ClientVpnTargetNetworkAssociation,
7142
7173
  "AWS::DAX::Cluster": readDaxCluster,
7143
7174
  "AWS::DAX::ParameterGroup": readDaxParameterGroup,
7175
+ "AWS::ElastiCache::ParameterGroup": readElastiCacheParameterGroup,
7144
7176
  "AWS::DAX::SubnetGroup": readDaxSubnetGroup,
7145
7177
  "AWS::CloudWatch::AnomalyDetector": readCloudWatchAnomalyDetector,
7146
7178
  "AWS::CodeBuild::ReportGroup": readCodeBuildReportGroup,
@@ -9556,6 +9588,37 @@ const writeDaxParameterGroup = async (ctx, ops) => {
9556
9588
  ParameterNameValues: values
9557
9589
  }));
9558
9590
  };
9591
+ const writeElastiCacheParameterGroup = async (ctx, ops) => {
9592
+ const name = str(ctx.physicalId) ?? str(ctx.declared["CacheParameterGroupName"]);
9593
+ if (!name) throw new Error("cannot resolve ElastiCache parameter-group name for revert");
9594
+ const desiredValues = (await desiredModel("AWS::ElastiCache::ParameterGroup", ctx, ops)).Properties ?? {};
9595
+ const modifyKeys = /* @__PURE__ */ new Set();
9596
+ const resetKeys = /* @__PURE__ */ new Set();
9597
+ for (const op of ops) {
9598
+ const segs = op.path.replace(/^\//, "").split("/");
9599
+ if (segs[0] !== "Properties") continue;
9600
+ const key = segs[1]?.replace(/~1/g, "/").replace(/~0/g, "~");
9601
+ if (op.op === "remove") {
9602
+ if (key !== void 0) resetKeys.add(key);
9603
+ } else if (key !== void 0) modifyKeys.add(key);
9604
+ else for (const k of Object.keys(desiredValues)) modifyKeys.add(k);
9605
+ }
9606
+ const c = new ElastiCacheClient({ region: ctx.region });
9607
+ const modify = [...modifyKeys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
9608
+ ParameterName: k,
9609
+ ParameterValue: desiredValues[k]
9610
+ }));
9611
+ if (modify.length > 0) await c.send(new ModifyCacheParameterGroupCommand({
9612
+ CacheParameterGroupName: name,
9613
+ ParameterNameValues: modify
9614
+ }));
9615
+ const reset = [...resetKeys].map((k) => ({ ParameterName: k }));
9616
+ if (reset.length > 0) await c.send(new ResetCacheParameterGroupCommand({
9617
+ CacheParameterGroupName: name,
9618
+ ResetAllParameters: false,
9619
+ ParameterNameValues: reset
9620
+ }));
9621
+ };
9559
9622
  const CLIENT_VPN_SCALAR_PARAMS = new Set([
9560
9623
  "Description",
9561
9624
  "SplitTunnel",
@@ -9930,6 +9993,7 @@ const SDK_WRITERS = {
9930
9993
  "AWS::CodeBuild::ReportGroup": writeCodeBuildReportGroup,
9931
9994
  "AWS::DAX::Cluster": writeDaxCluster,
9932
9995
  "AWS::DAX::ParameterGroup": writeDaxParameterGroup,
9996
+ "AWS::ElastiCache::ParameterGroup": writeElastiCacheParameterGroup,
9933
9997
  "AWS::EC2::ClientVpnEndpoint": writeEc2ClientVpnEndpoint,
9934
9998
  "AWS::OpenSearchService::Domain": writeOpenSearchDomain,
9935
9999
  "AWS::CloudFront::Distribution": writeCloudFrontDistribution,