cdk-real-drift 0.2.11 → 0.2.12

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
@@ -596,6 +596,11 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
596
596
  `AWS::ElastiCache::User` / `AWS::MemoryDB::User` with its writeOnly
597
597
  `AccessString` — the Redis/Valkey ACL; an out-of-band permission grant is
598
598
  otherwise invisible to the Cloud Control read),
599
+ `memorydb:DescribeParameters` + `memorydb:DescribeParameterGroups` (supplement an
600
+ `AWS::MemoryDB::ParameterGroup` with its writeOnly `Parameters` — folding the
601
+ family-default fill by diffing the managed `default.<family>` group; the MemoryDB
602
+ provider does not apply declared parameters on CREATE, so this surfaces the
603
+ never-applied tuning that was otherwise an invisible readGap),
599
604
  `redshift-serverless:GetWorkgroup` (supplements an
600
605
  `AWS::RedshiftServerless::Workgroup` with its writeOnly `ConfigParameters` /
601
606
  `SecurityGroupIds` / `SubnetIds`, which the Cloud Control read returns only
@@ -643,6 +648,10 @@ is refused, never overwritten, so the un-read credential is never cleared),
643
648
  `AWS::ElastiCache::ParameterGroup` — a changed declared parameter is modified back
644
649
  to its desired value; an out-of-band-added undeclared parameter is reset to the
645
650
  family default),
651
+ `memorydb:UpdateParameterGroup` / `ResetParameterGroup` (revert an
652
+ `AWS::MemoryDB::ParameterGroup` — a declared parameter is applied to its desired
653
+ value, which also materializes tuning the provider never applied on CREATE; an
654
+ out-of-band-added undeclared parameter is reset to the family default),
646
655
  `ses:UpdateReceiptRule` (reverts an `AWS::SES::ReceiptRule` — the whole rule is
647
656
  re-supplied in place, since Cloud Control has no handler for the type),
648
657
  `cloudwatch:PutAnomalyDetector` (reverts an `AWS::CloudWatch::AnomalyDetector`
package/dist/cli.js CHANGED
@@ -32,7 +32,7 @@ import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53
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
34
  import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
35
- import { DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient } from "@aws-sdk/client-memorydb";
35
+ import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$1, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } 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";
38
38
  import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationSubnetGroupsCommand } from "@aws-sdk/client-database-migration-service";
@@ -42,7 +42,7 @@ import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-r
42
42
  import { BuildBotLocaleCommand, CreateIntentCommand, CreateSlotCommand, CreateSlotTypeCommand, DeleteIntentCommand, DeleteSlotCommand, DeleteSlotTypeCommand, DescribeBotLocaleCommand, DescribeIntentCommand, DescribeSlotCommand, DescribeSlotTypeCommand, LexModelsV2Client, ListBotLocalesCommand, ListIntentsCommand, ListSlotTypesCommand, ListSlotsCommand, UpdateBotLocaleCommand, UpdateIntentCommand, UpdateSlotCommand, UpdateSlotTypeCommand } from "@aws-sdk/client-lex-models-v2";
43
43
  import { GetScheduleCommand, SchedulerClient } from "@aws-sdk/client-scheduler";
44
44
  import { DescribeReceiptRuleCommand, DescribeReceiptRuleSetCommand, ListReceiptFiltersCommand, SESClient, UpdateReceiptRuleCommand } from "@aws-sdk/client-ses";
45
- import { DescribeParametersCommand as DescribeParametersCommand$1, SSMClient } from "@aws-sdk/client-ssm";
45
+ import { DescribeParametersCommand as DescribeParametersCommand$2, SSMClient } from "@aws-sdk/client-ssm";
46
46
  import { GetNamespaceCommand, GetServiceCommand, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
47
47
  import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
48
48
  import { createHash } from "node:crypto";
@@ -7209,7 +7209,7 @@ const supplementSsmParameter = async ({ physicalId, declared, region }) => {
7209
7209
  const p = (await new SSMClient({
7210
7210
  region,
7211
7211
  ...READ_RETRY
7212
- }).send(new DescribeParametersCommand$1({ ParameterFilters: [{
7212
+ }).send(new DescribeParametersCommand$2({ ParameterFilters: [{
7213
7213
  Key: "Name",
7214
7214
  Option: "Equals",
7215
7215
  Values: [name]
@@ -7306,6 +7306,56 @@ const supplementMemoryDbUser = async ({ physicalId, declared, region }) => {
7306
7306
  }).send(new DescribeUsersCommand$1({ UserName: userName }))).Users?.[0]?.AccessString);
7307
7307
  return access !== void 0 ? { AccessString: access } : void 0;
7308
7308
  };
7309
+ const readMemoryDbParamMap = async (c, groupName) => {
7310
+ const out = {};
7311
+ let token;
7312
+ do {
7313
+ const r = await c.send(new DescribeParametersCommand$1({
7314
+ ParameterGroupName: groupName,
7315
+ NextToken: token
7316
+ }));
7317
+ for (const p of r.Parameters ?? []) {
7318
+ const n = str$1(p.Name);
7319
+ const v = str$1(p.Value);
7320
+ if (n !== void 0 && v !== void 0) out[n] = v;
7321
+ }
7322
+ token = str$1(r.NextToken);
7323
+ } while (token !== void 0);
7324
+ return out;
7325
+ };
7326
+ const readMemoryDbFamilyDefaults = async (c, family) => {
7327
+ let token;
7328
+ do {
7329
+ const r = await c.send(new DescribeParameterGroupsCommand$1({ NextToken: token }));
7330
+ for (const g of r.ParameterGroups ?? []) {
7331
+ const name = str$1(g.Name);
7332
+ if (name?.startsWith("default.") && str$1(g.Family) === family) return readMemoryDbParamMap(c, name);
7333
+ }
7334
+ token = str$1(r.NextToken);
7335
+ } while (token !== void 0);
7336
+ return {};
7337
+ };
7338
+ const supplementMemoryDbParameterGroup = async ({ physicalId, declared, region }) => {
7339
+ const name = str$1(declared.ParameterGroupName) ?? str$1(physicalId);
7340
+ if (!name) return void 0;
7341
+ const c = new MemoryDBClient({
7342
+ region,
7343
+ ...READ_RETRY
7344
+ });
7345
+ const live = await readMemoryDbParamMap(c, name);
7346
+ if (Object.keys(live).length === 0) return void 0;
7347
+ const family = str$1(declared.Family);
7348
+ const defaults = family ? await readMemoryDbFamilyDefaults(c, family) : {};
7349
+ const haveDefaults = Object.keys(defaults).length > 0;
7350
+ const declaredParams = typeof declared.Parameters === "object" && declared.Parameters !== null ? declared.Parameters : {};
7351
+ const projected = {};
7352
+ for (const [k, v] of Object.entries(live)) {
7353
+ const isDeclared = Object.prototype.hasOwnProperty.call(declaredParams, k);
7354
+ const isModified = haveDefaults && v !== defaults[k];
7355
+ if (isDeclared || isModified) projected[k] = v;
7356
+ }
7357
+ return Object.keys(projected).length > 0 ? { Parameters: projected } : void 0;
7358
+ };
7309
7359
  const supplementRedshiftServerlessWorkgroup = async ({ physicalId, declared, region }) => {
7310
7360
  const workgroupName = str$1(declared.WorkgroupName) ?? str$1(physicalId);
7311
7361
  if (!workgroupName) return void 0;
@@ -7552,6 +7602,7 @@ const SDK_SUPPLEMENTS = {
7552
7602
  "AWS::ECS::Service": supplementEcsService,
7553
7603
  "AWS::ElastiCache::User": supplementElastiCacheUser,
7554
7604
  "AWS::MemoryDB::User": supplementMemoryDbUser,
7605
+ "AWS::MemoryDB::ParameterGroup": supplementMemoryDbParameterGroup,
7555
7606
  "AWS::RedshiftServerless::Workgroup": supplementRedshiftServerlessWorkgroup
7556
7607
  };
7557
7608
 
@@ -7731,6 +7782,7 @@ const OVERRIDE_READABLE_WRITEONLY = {
7731
7782
  "AWS::ECS::Service": ["ServiceConnectConfiguration", "VolumeConfigurations"],
7732
7783
  "AWS::ElastiCache::User": ["AccessString"],
7733
7784
  "AWS::MemoryDB::User": ["AccessString"],
7785
+ "AWS::MemoryDB::ParameterGroup": ["Parameters"],
7734
7786
  "AWS::RedshiftServerless::Workgroup": [
7735
7787
  "ConfigParameters",
7736
7788
  "SecurityGroupIds",
@@ -9633,6 +9685,37 @@ const writeElastiCacheParameterGroup = async (ctx, ops) => {
9633
9685
  ParameterNameValues: reset
9634
9686
  }));
9635
9687
  };
9688
+ const writeMemoryDbParameterGroup = async (ctx, ops) => {
9689
+ const name = str(ctx.physicalId) ?? str(ctx.declared["ParameterGroupName"]);
9690
+ if (!name) throw new Error("cannot resolve MemoryDB parameter-group name for revert");
9691
+ const desiredValues = (await desiredModel("AWS::MemoryDB::ParameterGroup", ctx, ops)).Parameters ?? {};
9692
+ const modifyKeys = /* @__PURE__ */ new Set();
9693
+ const resetKeys = /* @__PURE__ */ new Set();
9694
+ for (const op of ops) {
9695
+ const segs = op.path.replace(/^\//, "").split("/");
9696
+ if (segs[0] !== "Parameters") continue;
9697
+ const key = segs[1]?.replace(/~1/g, "/").replace(/~0/g, "~");
9698
+ if (op.op === "remove") {
9699
+ if (key !== void 0) resetKeys.add(key);
9700
+ } else if (key !== void 0) modifyKeys.add(key);
9701
+ else for (const k of Object.keys(desiredValues)) modifyKeys.add(k);
9702
+ }
9703
+ const c = new MemoryDBClient({ region: ctx.region });
9704
+ const modify = [...modifyKeys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
9705
+ ParameterName: k,
9706
+ ParameterValue: desiredValues[k]
9707
+ }));
9708
+ if (modify.length > 0) await c.send(new UpdateParameterGroupCommand$1({
9709
+ ParameterGroupName: name,
9710
+ ParameterNameValues: modify
9711
+ }));
9712
+ const reset = [...resetKeys];
9713
+ if (reset.length > 0) await c.send(new ResetParameterGroupCommand({
9714
+ ParameterGroupName: name,
9715
+ AllParameters: false,
9716
+ ParameterNames: reset
9717
+ }));
9718
+ };
9636
9719
  const CLIENT_VPN_SCALAR_PARAMS = new Set([
9637
9720
  "Description",
9638
9721
  "SplitTunnel",
@@ -10008,6 +10091,7 @@ const SDK_WRITERS = {
10008
10091
  "AWS::DAX::Cluster": writeDaxCluster,
10009
10092
  "AWS::DAX::ParameterGroup": writeDaxParameterGroup,
10010
10093
  "AWS::ElastiCache::ParameterGroup": writeElastiCacheParameterGroup,
10094
+ "AWS::MemoryDB::ParameterGroup": writeMemoryDbParameterGroup,
10011
10095
  "AWS::EC2::ClientVpnEndpoint": writeEc2ClientVpnEndpoint,
10012
10096
  "AWS::OpenSearchService::Domain": writeOpenSearchDomain,
10013
10097
  "AWS::CloudFront::Distribution": writeCloudFrontDistribution,