diff --git a/API.md b/API.md index 67011c9..aeca033 100644 --- a/API.md +++ b/API.md @@ -4659,6 +4659,70 @@ The minute of the hour (from 0-59) for maintenance to be performed. --- +### MemcachedEngineProps + +Properties of the Memcached engine for serverless cache. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const memcachedEngineProps: aws_elasticache.MemcachedEngineProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| engineVersion | @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineVersion | The engine version of the Memcached engine. | + +--- + +##### `engineVersion`Required + +```typescript +public readonly engineVersion: MemcachedEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineVersion + +The engine version of the Memcached engine. + +--- + +### MemcachedEngineVersionProps + +Properties for the Memcached engine version. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const memcachedEngineVersionProps: aws_elasticache.MemcachedEngineVersionProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + ### NamespaceAttributes Attributes for importing a Redshift Serverless Namespace. @@ -5475,6 +5539,70 @@ The username of the user. --- +### RedisEngineProps + +Properties of the Redis engine for serverless cache. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const redisEngineProps: aws_elasticache.RedisEngineProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| engineVersion | @open-constructs/aws-cdk.aws_elasticache.RedisEngineVersion | The engine version of the Redis engine. | + +--- + +##### `engineVersion`Required + +```typescript +public readonly engineVersion: RedisEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.RedisEngineVersion + +The engine version of the Redis engine. + +--- + +### RedisEngineVersionProps + +Properties for the Redis engine version. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const redisEngineVersionProps: aws_elasticache.RedisEngineVersionProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + ### RepositoryAttributes Represents the attributes of an existing CodeArtifact repository. @@ -5715,8 +5843,7 @@ const serverlessCacheProps: aws_elasticache.ServerlessCacheProps = { ... } | **Name** | **Type** | **Description** | | --- | --- | --- | -| engine | @open-constructs/aws-cdk.aws_elasticache.Engine | The engine the serverless cache is compatible with. | -| majorEngineVersion | @open-constructs/aws-cdk.aws_elasticache.MajorVersion | The version number of the engine the serverless cache is compatible with. | +| serverlessCacheEngine | @open-constructs/aws-cdk.aws_elasticache.ServerlessCacheEngine | The engine the serverless cache is compatible with. | | vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC to place the serverless cache in. | | cacheUsageLimits | @open-constructs/aws-cdk.aws_elasticache.CacheUsageLimits | The usage limits for storage and ElastiCache Processing Units for the cache. | | dailySnapshotTime | @open-constructs/aws-cdk.aws_elasticache.DailySnapshotTime | The daily time when a cache snapshot will be created. | @@ -5732,30 +5859,18 @@ const serverlessCacheProps: aws_elasticache.ServerlessCacheProps = { ... } --- -##### `engine`Required +##### `serverlessCacheEngine`Required ```typescript -public readonly engine: Engine; +public readonly serverlessCacheEngine: ServerlessCacheEngine; ``` -- *Type:* @open-constructs/aws-cdk.aws_elasticache.Engine +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ServerlessCacheEngine The engine the serverless cache is compatible with. --- -##### `majorEngineVersion`Required - -```typescript -public readonly majorEngineVersion: MajorVersion; -``` - -- *Type:* @open-constructs/aws-cdk.aws_elasticache.MajorVersion - -The version number of the engine the serverless cache is compatible with. - ---- - ##### `vpc`Required ```typescript @@ -6008,6 +6123,70 @@ with the first character as a letter, and it can't end with a hyphen or contain --- +### ValkeyEngineProps + +Properties of the Valkey engine for serverless cache. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const valkeyEngineProps: aws_elasticache.ValkeyEngineProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| engineVersion | @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion | The engine version of the Valkey engine. | + +--- + +##### `engineVersion`Required + +```typescript +public readonly engineVersion: ValkeyEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion + +The engine version of the Valkey engine. + +--- + +### ValkeyEngineVersionProps + +Properties for the Valkey engine version. + +#### Initializer + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +const valkeyEngineVersionProps: aws_elasticache.ValkeyEngineVersionProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + ### WorkgroupAttributes Attributes for importing a Redshift Serverless Workgroup. @@ -6665,6 +6844,77 @@ Converts a day, hour, and minute into a timestamp as used by FSx for Lustre's we +### MemcachedEngineVersion + +Memcached engine version for serverless cache. + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| of | Creates a MemcachedEngineVersion. | + +--- + +##### `of` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.MemcachedEngineVersion.of(props: MemcachedEngineVersionProps) +``` + +Creates a MemcachedEngineVersion. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineVersionProps + +The properties for the Memcached engine version. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + +#### Constants + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| VER_1_6 | @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineVersion | Version 1.6. | + +--- + +##### `VER_1_6`Required + +```typescript +public readonly VER_1_6: MemcachedEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineVersion + +Version 1.6. + +--- + ### MultiAz1ThroughputCapacityPerHaPair The throughput capacity for the Multi-AZ 1 deployment type. @@ -6936,6 +7186,77 @@ The throughput capacity of 768 MBps per HA pair. --- +### RedisEngineVersion + +Redis engine version for serverless cache. + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| of | Creates a RedisEngineVersion. | + +--- + +##### `of` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.RedisEngineVersion.of(props: RedisEngineVersionProps) +``` + +Creates a RedisEngineVersion. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.RedisEngineVersionProps + +The properties for the Redis engine version. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + +#### Constants + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| VER_7 | @open-constructs/aws-cdk.aws_elasticache.RedisEngineVersion | Version 7. | + +--- + +##### `VER_7`Required + +```typescript +public readonly VER_7: RedisEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.RedisEngineVersion + +Version 7. + +--- + ### ReportGranularity Enum for the possible granularities of a cost report. @@ -7051,6 +7372,109 @@ Weekly granularity. --- +### ServerlessCacheEngine + +Engine class for serverless cache. + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| memcached | Creates a ServerlessCacheEngine for Memcached. | +| redis | Creates a ServerlessCacheEngine for Redis. | +| valkey | Creates a ServerlessCacheEngine for Valkey. | + +--- + +##### `memcached` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.ServerlessCacheEngine.memcached(props: MemcachedEngineProps) +``` + +Creates a ServerlessCacheEngine for Memcached. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.MemcachedEngineProps + +The properties for the Memcached engine. + +--- + +##### `redis` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.ServerlessCacheEngine.redis(props: RedisEngineProps) +``` + +Creates a ServerlessCacheEngine for Redis. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.RedisEngineProps + +The properties for the Redis engine. + +--- + +##### `valkey` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.ServerlessCacheEngine.valkey(props: ValkeyEngineProps) +``` + +Creates a ServerlessCacheEngine for Valkey. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineProps + +The properties for the Valkey engine. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| engine | @open-constructs/aws-cdk.aws_elasticache.Engine | The engine type of the serverless cache. | +| majorEngineVersion | string | The major engine version of the serverless cache. | + +--- + +##### `engine`Required + +```typescript +public readonly engine: Engine; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.Engine + +The engine type of the serverless cache. + +--- + +##### `majorEngineVersion`Required + +```typescript +public readonly majorEngineVersion: string; +``` + +- *Type:* string + +The major engine version of the serverless cache. + +--- + + ### SingleAz1ThroughputCapacityPerHaPair The throughput capacity for the Single-AZ 1 deployment type. @@ -7354,6 +7778,90 @@ The deployment type of the throughput capacity. --- +### ValkeyEngineVersion + +Valkey engine version for serverless cache. + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| of | Creates a ValkeyEngineVersion. | + +--- + +##### `of` + +```typescript +import { aws_elasticache } from '@open-constructs/aws-cdk' + +aws_elasticache.ValkeyEngineVersion.of(props: ValkeyEngineVersionProps) +``` + +Creates a ValkeyEngineVersion. + +###### `props`Required + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersionProps + +The properties for the Valkey engine version. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| majorVersion | string | The major version of the engine. | + +--- + +##### `majorVersion`Required + +```typescript +public readonly majorVersion: string; +``` + +- *Type:* string + +The major version of the engine. + +--- + +#### Constants + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| VER_7 | @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion | Version 7. | +| VER_8 | @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion | Version 8. | + +--- + +##### `VER_7`Required + +```typescript +public readonly VER_7: ValkeyEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion + +Version 7. + +--- + +##### `VER_8`Required + +```typescript +public readonly VER_8: ValkeyEngineVersion; +``` + +- *Type:* @open-constructs/aws-cdk.aws_elasticache.ValkeyEngineVersion + +Version 8. + +--- + ## Protocols ### IDomain @@ -8888,33 +9396,6 @@ User activity log. --- -### MajorVersion - -The version number of the engine the serverless cache is compatible with. - -#### Members - -| **Name** | **Description** | -| --- | --- | -| VER_7 | Version 7. | -| VER_8 | Version 8. | - ---- - -##### `VER_7` - -Version 7. - ---- - - -##### `VER_8` - -Version 8. - ---- - - ### OntapDeploymentType The different kinds of file system deployments used by NetApp ONTAP. diff --git a/src/aws-elasticache/README.md b/src/aws-elasticache/README.md index 0b86f15..490e3e2 100644 --- a/src/aws-elasticache/README.md +++ b/src/aws-elasticache/README.md @@ -170,8 +170,9 @@ declare const vpc: ec2.Vpc; declare const userGroup: UserGroup; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, - majorEngineVersion: MajorVersion.VER_8, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), serverlessCacheName: 'my-serverless-cache', vpc, // assign User Group @@ -228,9 +229,10 @@ Setup required properties and create: declare const vpc: ec2.Vpc; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); ``` @@ -297,13 +299,14 @@ To enable automatic backups, set the `snapshotRetentionLimit` property. You can declare const vpc: ec2.Vpc; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), // enable automatic backups and set the retention period to 6 days snapshotRetentionLimit: 6, // set the backup window to 12:00 AM UTC dailySnapshotTime: new DailySnapshotTime({ hour: 12, minute: 0 }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); ``` @@ -313,11 +316,12 @@ You can create a final backup by setting `finalSnapshotName` property. declare const vpc: ec2.Vpc; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), // set the final snapshot name finalSnapshotName: 'my-finalsnapshot', vpc, - majorEngineVersion: MajorVersion.VER_8, }); ``` @@ -327,11 +331,12 @@ You can restore from snapshots by setting snapshot ARNs to `snapshotArnsToRestor declare const vpc: ec2.Vpc; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), // set the snapshot to restore snapshotArnsToRestore: ['arn:aws:elasticache:us-east-1:123456789012:serverlesscachesnapshot:my-final-snapshot'], vpc, - majorEngineVersion: MajorVersion.VER_8, }); ``` @@ -347,12 +352,13 @@ To use CMK, set your CMK to the `kmsKey` property: declare const kmsKey: kms.Key; const serverlessCache = new ServerlessCache(this, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), serverlessCacheName: 'my-serverless-cache', vpc, // set Customer Managed Key kmsKey, - majorEngineVersion: MajorVersion.VER_8, }); ``` diff --git a/src/aws-elasticache/index.ts b/src/aws-elasticache/index.ts index 1af76ee..6febce4 100644 --- a/src/aws-elasticache/index.ts +++ b/src/aws-elasticache/index.ts @@ -1,5 +1,6 @@ export * from './daily-snapshot-time'; export * from './serverless-cache'; +export * from './serverless-cache-engine'; export * from './util'; export * from './user'; export * from './user-group'; diff --git a/src/aws-elasticache/serverless-cache-engine.ts b/src/aws-elasticache/serverless-cache-engine.ts new file mode 100644 index 0000000..6f916f2 --- /dev/null +++ b/src/aws-elasticache/serverless-cache-engine.ts @@ -0,0 +1,185 @@ +import { Engine } from './util'; + +interface EngineVersionBaseProps { + /** + * The major version of the engine. + */ + readonly majorVersion: string; +} + +abstract class EngineVersionBase { + /** + * The major version of the engine. + */ + public readonly majorVersion: string; + + protected constructor(props: EngineVersionBaseProps) { + this.majorVersion = props.majorVersion; + } +} + +/** + * Properties for the Valkey engine version. + */ +export interface ValkeyEngineVersionProps extends EngineVersionBaseProps {} + +/** + * Valkey engine version for serverless cache. + */ +export class ValkeyEngineVersion extends EngineVersionBase { + /** + * Version 7 + */ + public static readonly VER_7 = new ValkeyEngineVersion({ majorVersion: '7' }); + + /** + * Version 8 + */ + public static readonly VER_8 = new ValkeyEngineVersion({ majorVersion: '8' }); + + /** + * Creates a ValkeyEngineVersion. + * @param props The properties for the Valkey engine version. + * @returns A ValkeyEngineVersion. + */ + public static of(props: ValkeyEngineVersionProps): ValkeyEngineVersion { + return new ValkeyEngineVersion(props); + } + + private constructor(props: ValkeyEngineVersionProps) { + super(props); + } +} + +/** + * Properties of the Valkey engine for serverless cache. + */ +export interface ValkeyEngineProps { + /** + * The engine version of the Valkey engine. + */ + readonly engineVersion: ValkeyEngineVersion; +} + +/** + * Properties for the Redis engine version. + */ +export interface RedisEngineVersionProps extends EngineVersionBaseProps {} + +/** + * Redis engine version for serverless cache. + */ +export class RedisEngineVersion extends EngineVersionBase { + /** + * Version 7 + */ + public static readonly VER_7 = new RedisEngineVersion({ majorVersion: '7' }); + + /** + * Creates a RedisEngineVersion. + * @param props The properties for the Redis engine version. + * @returns A RedisEngineVersion. + */ + public static of(props: RedisEngineVersionProps): RedisEngineVersion { + return new RedisEngineVersion(props); + } + + private constructor(props: RedisEngineVersionProps) { + super(props); + } +} + +/** + * Properties of the Redis engine for serverless cache. + */ +export interface RedisEngineProps { + /** + * The engine version of the Redis engine. + */ + readonly engineVersion: RedisEngineVersion; +} + +/** + * Properties for the Memcached engine version. + */ +export interface MemcachedEngineVersionProps extends EngineVersionBaseProps {} + +/** + * Memcached engine version for serverless cache. + */ +export class MemcachedEngineVersion extends EngineVersionBase { + /** + * Version 1.6 + */ + public static readonly VER_1_6 = new MemcachedEngineVersion({ majorVersion: '1.6' }); + + /** + * Creates a MemcachedEngineVersion. + * @param props The properties for the Memcached engine version. + * @returns A MemcachedEngineVersion. + */ + public static of(props: MemcachedEngineVersionProps): MemcachedEngineVersion { + return new MemcachedEngineVersion(props); + } + + private constructor(props: MemcachedEngineVersionProps) { + super(props); + } +} + +/** + * Properties of the Memcached engine for serverless cache. + */ +export interface MemcachedEngineProps { + /** + * The engine version of the Memcached engine. + */ + readonly engineVersion: MemcachedEngineVersion; +} + +/** + * Engine class for serverless cache. + */ +export class ServerlessCacheEngine { + /** + * Creates a ServerlessCacheEngine for Redis. + * @param props The properties for the Redis engine. + * @returns A ServerlessCacheEngine for Redis. + */ + public static redis(props: RedisEngineProps): ServerlessCacheEngine { + return new ServerlessCacheEngine(Engine.REDIS, props.engineVersion.majorVersion); + } + + /** + * Creates a ServerlessCacheEngine for Valkey. + * @param props The properties for the Valkey engine. + * @returns A ServerlessCacheEngine for Valkey. + */ + public static valkey(props: ValkeyEngineProps): ServerlessCacheEngine { + return new ServerlessCacheEngine(Engine.VALKEY, props.engineVersion.majorVersion); + } + + /** + * Creates a ServerlessCacheEngine for Memcached. + * @param props The properties for the Memcached engine. + * @returns A ServerlessCacheEngine for Memcached. + */ + public static memcached(props: MemcachedEngineProps): ServerlessCacheEngine { + return new ServerlessCacheEngine(Engine.MEMCACHED, props.engineVersion.majorVersion); + } + + /** + * The engine type of the serverless cache. + */ + public readonly engine: Engine; + + /** + * The major engine version of the serverless cache. + */ + public readonly majorEngineVersion: string; + + private constructor(engine: Engine, majorEngineVersion: string) { + this.engine = engine; + this.majorEngineVersion = majorEngineVersion; + } +} diff --git a/src/aws-elasticache/serverless-cache.ts b/src/aws-elasticache/serverless-cache.ts index bfb0766..395c273 100644 --- a/src/aws-elasticache/serverless-cache.ts +++ b/src/aws-elasticache/serverless-cache.ts @@ -14,6 +14,7 @@ import { Metric, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch'; import { IKey } from 'aws-cdk-lib/aws-kms'; import { Construct } from 'constructs'; import { DailySnapshotTime } from './daily-snapshot-time'; +import { ServerlessCacheEngine } from './serverless-cache-engine'; import { IUserGroup } from './user-group'; import { Engine } from './util'; @@ -241,21 +242,6 @@ export interface IServerlessCache extends IResource, aws_ec2.IConnectable { metric(metricName: string, props?: MetricOptions): Metric; } -/** - * The version number of the engine the serverless cache is compatible with. - */ -export enum MajorVersion { - /** - * Version 7 - */ - VER_7 = '7', - - /** - * Version 8 - */ - VER_8 = '8', -} - /** * Properties for defining an ElastiCache Serverless Cache. */ @@ -263,7 +249,7 @@ export interface ServerlessCacheProps { /** * The engine the serverless cache is compatible with. */ - readonly engine: Engine; + readonly serverlessCacheEngine: ServerlessCacheEngine; /** * The unique identifier of the serverless cache. @@ -311,11 +297,6 @@ export interface ServerlessCacheProps { */ readonly kmsKey?: IKey; - /** - * The version number of the engine the serverless cache is compatible with. - */ - readonly majorEngineVersion: MajorVersion; - /** * The security groups to associate with the serverless cache. * @@ -599,14 +580,14 @@ export class ServerlessCache extends ServerlessCacheBase { this.validateUserGroup(); const serverlessCache = this.createResource(this, 'Resource', { - engine: this.props.engine, + engine: this.props.serverlessCacheEngine.engine, serverlessCacheName: this.physicalName, cacheUsageLimits: this.renderCacheUsageLimits(), dailySnapshotTime: props.dailySnapshotTime?.toTimestamp(), description: this.props.description, finalSnapshotName: this.props.finalSnapshotName, kmsKeyId: this.props.kmsKey?.keyArn, - majorEngineVersion: this.props.majorEngineVersion, + majorEngineVersion: this.props.serverlessCacheEngine.majorEngineVersion, securityGroupIds: this.securityGroups.map(sg => sg.securityGroupId), subnetIds: this.props.vpc.selectSubnets(this.vpcSubnets).subnetIds, snapshotArnsToRestore: this.props.snapshotArnsToRestore, @@ -748,8 +729,10 @@ export class ServerlessCache extends ServerlessCacheBase { private validateUserGroup(): void { if (this.props.userGroup === undefined) return; - if (![Engine.REDIS, Engine.VALKEY].includes(this.props.engine)) { - throw new Error(`\`userGroup\` is available for Valkey and Redis OSS only, got engine: ${this.props.engine}.`); + if (![Engine.REDIS, Engine.VALKEY].includes(this.props.serverlessCacheEngine.engine)) { + throw new Error( + `\`userGroup\` is available for Valkey and Redis OSS only, got engine: ${this.props.serverlessCacheEngine.engine}.`, + ); } } } diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts new file mode 100644 index 0000000..3b643ab --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts @@ -0,0 +1,48 @@ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ocf from '../../src'; + +class ElastiCacheStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const vpc = new cdk.aws_ec2.Vpc(this, 'VPC', {}); + + new ocf.aws_elasticache.ServerlessCache(this, 'Valkey8', { + serverlessCacheEngine: ocf.aws_elasticache.ServerlessCacheEngine.valkey({ + engineVersion: ocf.aws_elasticache.ValkeyEngineVersion.VER_8, + }), + vpc, + }); + + new ocf.aws_elasticache.ServerlessCache(this, 'Valkey7', { + serverlessCacheEngine: ocf.aws_elasticache.ServerlessCacheEngine.valkey({ + engineVersion: ocf.aws_elasticache.ValkeyEngineVersion.VER_7, + }), + vpc, + }); + + new ocf.aws_elasticache.ServerlessCache(this, 'Redis7', { + serverlessCacheEngine: ocf.aws_elasticache.ServerlessCacheEngine.redis({ + engineVersion: ocf.aws_elasticache.RedisEngineVersion.VER_7, + }), + vpc, + }); + + new ocf.aws_elasticache.ServerlessCache(this, 'Memcached1_6', { + serverlessCacheEngine: ocf.aws_elasticache.ServerlessCacheEngine.memcached({ + engineVersion: ocf.aws_elasticache.MemcachedEngineVersion.VER_1_6, + }), + vpc, + }); + } +} + +const app = new cdk.App(); + +const testCase = new ElastiCacheStack(app, 'ElastiCacheServerlessCacheEngineStack'); + +new IntegTest(app, 'ElastiCacheServerlessCacheEngineTest', { + testCases: [testCase], +}); diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.assets.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.assets.json new file mode 100644 index 0000000..2de6464 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200": { + "source": { + "path": "asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "cd647a85c12320a213429ab3e6255fc9076fe1e14f3c3592fc596aa54f217032": { + "source": { + "path": "ElastiCacheServerlessCacheEngineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "cd647a85c12320a213429ab3e6255fc9076fe1e14f3c3592fc596aa54f217032.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.template.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.template.json new file mode 100644 index 0000000..f8fc21e --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineStack.template.json @@ -0,0 +1,837 @@ +{ + "Resources": { + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC" + } + ] + } + }, + "VPCPublicSubnet1SubnetB4246D30": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet1RouteTableFEE4B781": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet1RouteTableAssociation0B0896DC": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "VPCPublicSubnet1DefaultRoute91CEF279": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet1EIP6AD938E8": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1NATGatewayE0556630": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet1DefaultRoute91CEF279", + "VPCPublicSubnet1RouteTableAssociation0B0896DC" + ] + }, + "VPCPublicSubnet2Subnet74179F39": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet2RouteTable6F1A15F1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet2RouteTableAssociation5A808732": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "VPCPublicSubnet2DefaultRouteB7481BBA": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet2EIP4947BC00": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2NATGateway3C070193": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet2DefaultRouteB7481BBA", + "VPCPublicSubnet2RouteTableAssociation5A808732" + ] + }, + "VPCPrivateSubnet1Subnet8BCA10E0": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet1RouteTableBE8A6027": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet1RouteTableAssociation347902D1": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "VPCPrivateSubnet1DefaultRouteAE1D6490": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + }, + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + } + } + }, + "VPCPrivateSubnet2SubnetCFCDAA7A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet2RouteTable0A19E10E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet2RouteTableAssociation0C73D413": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "VPCPrivateSubnet2DefaultRouteF4F5CFD2": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + }, + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + } + } + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ElastiCacheServerlessCacheEngineStack/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCRestrictDefaultSecurityGroupCustomResource59474679": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": { + "Fn::FindInMap": [ + "LatestNodeRuntimeMap", + { + "Ref": "AWS::Region" + }, + "value" + ] + }, + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "Valkey8SecurityGroupAD79447F": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "Valkey8F80665FE": { + "Type": "AWS::ElastiCache::ServerlessCache", + "Properties": { + "Engine": "valkey", + "MajorEngineVersion": "8", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "Valkey8SecurityGroupAD79447F", + "GroupId" + ] + } + ], + "ServerlessCacheName": "elasticacheservenestack-valkey8-18e8b6c9", + "SubnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "Valkey7SecurityGroup8DDD61EE": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "Valkey708C07A01": { + "Type": "AWS::ElastiCache::ServerlessCache", + "Properties": { + "Engine": "valkey", + "MajorEngineVersion": "7", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "Valkey7SecurityGroup8DDD61EE", + "GroupId" + ] + } + ], + "ServerlessCacheName": "elasticacheservenestack-valkey7-f1852a7e", + "SubnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "Redis7SecurityGroupA26FF90D": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "Redis72C218B99": { + "Type": "AWS::ElastiCache::ServerlessCache", + "Properties": { + "Engine": "redis", + "MajorEngineVersion": "7", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "Redis7SecurityGroupA26FF90D", + "GroupId" + ] + } + ], + "ServerlessCacheName": "elasticacheserveinestack-redis7-ccda94bb", + "SubnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "Memcached16SecurityGroup2D2E24C0": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "Memcached165EE7D985": { + "Type": "AWS::ElastiCache::ServerlessCache", + "Properties": { + "Engine": "memcached", + "MajorEngineVersion": "1.6", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "Memcached16SecurityGroup2D2E24C0", + "GroupId" + ] + } + ], + "ServerlessCacheName": "elasticacheserveack-memcached16-7fbff36e", + "SubnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + } + }, + "Mappings": { + "LatestNodeRuntimeMap": { + "af-south-1": { + "value": "nodejs20.x" + }, + "ap-east-1": { + "value": "nodejs20.x" + }, + "ap-northeast-1": { + "value": "nodejs20.x" + }, + "ap-northeast-2": { + "value": "nodejs20.x" + }, + "ap-northeast-3": { + "value": "nodejs20.x" + }, + "ap-south-1": { + "value": "nodejs20.x" + }, + "ap-south-2": { + "value": "nodejs20.x" + }, + "ap-southeast-1": { + "value": "nodejs20.x" + }, + "ap-southeast-2": { + "value": "nodejs20.x" + }, + "ap-southeast-3": { + "value": "nodejs20.x" + }, + "ap-southeast-4": { + "value": "nodejs20.x" + }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, + "ca-central-1": { + "value": "nodejs20.x" + }, + "ca-west-1": { + "value": "nodejs20.x" + }, + "cn-north-1": { + "value": "nodejs18.x" + }, + "cn-northwest-1": { + "value": "nodejs18.x" + }, + "eu-central-1": { + "value": "nodejs20.x" + }, + "eu-central-2": { + "value": "nodejs20.x" + }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, + "eu-north-1": { + "value": "nodejs20.x" + }, + "eu-south-1": { + "value": "nodejs20.x" + }, + "eu-south-2": { + "value": "nodejs20.x" + }, + "eu-west-1": { + "value": "nodejs20.x" + }, + "eu-west-2": { + "value": "nodejs20.x" + }, + "eu-west-3": { + "value": "nodejs20.x" + }, + "il-central-1": { + "value": "nodejs20.x" + }, + "me-central-1": { + "value": "nodejs20.x" + }, + "me-south-1": { + "value": "nodejs20.x" + }, + "mx-central-1": { + "value": "nodejs20.x" + }, + "sa-east-1": { + "value": "nodejs20.x" + }, + "us-east-1": { + "value": "nodejs20.x" + }, + "us-east-2": { + "value": "nodejs20.x" + }, + "us-gov-east-1": { + "value": "nodejs18.x" + }, + "us-gov-west-1": { + "value": "nodejs18.x" + }, + "us-iso-east-1": { + "value": "nodejs18.x" + }, + "us-iso-west-1": { + "value": "nodejs18.x" + }, + "us-isob-east-1": { + "value": "nodejs18.x" + }, + "us-west-1": { + "value": "nodejs20.x" + }, + "us-west-2": { + "value": "nodejs20.x" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets.json new file mode 100644 index 0000000..5e0f0a5 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.template.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.template.json new file mode 100644 index 0000000..ad9d0fb --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/__entrypoint__.js b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/__entrypoint__.js new file mode 100644 index 0000000..8567e73 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/__entrypoint__.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.external=void 0,exports.handler=handler,exports.withRetries=withRetries;const https=require("https"),url=require("url");exports.external={sendHttpRequest:defaultSendHttpRequest,log:defaultLog,includeStackTraces:!0,userHandlerIndex:"./index"};const CREATE_FAILED_PHYSICAL_ID_MARKER="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",MISSING_PHYSICAL_ID_MARKER="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";async function handler(event,context){const sanitizedEvent={...event,ResponseURL:"..."};if(exports.external.log(JSON.stringify(sanitizedEvent,void 0,2)),event.RequestType==="Delete"&&event.PhysicalResourceId===CREATE_FAILED_PHYSICAL_ID_MARKER){exports.external.log("ignoring DELETE event caused by a failed CREATE event"),await submitResponse("SUCCESS",event);return}try{const userHandler=require(exports.external.userHandlerIndex).handler,result=await userHandler(sanitizedEvent,context),responseEvent=renderResponse(event,result);await submitResponse("SUCCESS",responseEvent)}catch(e){const resp={...event,Reason:exports.external.includeStackTraces?e.stack:e.message};resp.PhysicalResourceId||(event.RequestType==="Create"?(exports.external.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),resp.PhysicalResourceId=CREATE_FAILED_PHYSICAL_ID_MARKER):exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`)),await submitResponse("FAILED",resp)}}function renderResponse(cfnRequest,handlerResponse={}){const physicalResourceId=handlerResponse.PhysicalResourceId??cfnRequest.PhysicalResourceId??cfnRequest.RequestId;if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`);return{...cfnRequest,...handlerResponse,PhysicalResourceId:physicalResourceId}}async function submitResponse(status,event){const json={Status:status,Reason:event.Reason??status,StackId:event.StackId,RequestId:event.RequestId,PhysicalResourceId:event.PhysicalResourceId||MISSING_PHYSICAL_ID_MARKER,LogicalResourceId:event.LogicalResourceId,NoEcho:event.NoEcho,Data:event.Data},parsedUrl=url.parse(event.ResponseURL),loggingSafeUrl=`${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`;exports.external.log("submit response to cloudformation",loggingSafeUrl,json);const responseBody=JSON.stringify(json),req={hostname:parsedUrl.hostname,path:parsedUrl.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(responseBody,"utf8")}};await withRetries({attempts:5,sleep:1e3},exports.external.sendHttpRequest)(req,responseBody)}async function defaultSendHttpRequest(options,requestBody){return new Promise((resolve,reject)=>{try{const request=https.request(options,response=>{response.resume(),!response.statusCode||response.statusCode>=400?reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)):resolve()});request.on("error",reject),request.write(requestBody),request.end()}catch(e){reject(e)}})}function defaultLog(fmt,...params){console.log(fmt,...params)}function withRetries(options,fn){return async(...xs)=>{let attempts=options.attempts,ms=options.sleep;for(;;)try{return await fn(...xs)}catch(e){if(attempts--<=0)throw e;await sleep(Math.floor(Math.random()*ms)),ms*=2}}}async function sleep(ms){return new Promise(ok=>setTimeout(ok,ms))} diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/index.js b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/index.js new file mode 100644 index 0000000..9f1466d --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/asset.7fa1e366ee8a9ded01fc355f704cff92bfd179574e6f9cfee800a3541df1b200/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create,t=Object.defineProperty,y=Object.getOwnPropertyDescriptor,P=Object.getOwnPropertyNames,g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r},R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r),k={};G(k,{handler:()=>f}),module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))} diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/cdk.out b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/cdk.out new file mode 100644 index 0000000..c6e6125 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/integ.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/integ.json new file mode 100644 index 0000000..a2b6200 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "ElastiCacheServerlessCacheEngineTest/DefaultTest": { + "stacks": [ + "ElastiCacheServerlessCacheEngineStack" + ], + "assertionStack": "ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert", + "assertionStackName": "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E" + } + } +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/manifest.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/manifest.json new file mode 100644 index 0000000..16cb68e --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/manifest.json @@ -0,0 +1,323 @@ +{ + "version": "38.0.1", + "artifacts": { + "ElastiCacheServerlessCacheEngineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ElastiCacheServerlessCacheEngineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ElastiCacheServerlessCacheEngineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ElastiCacheServerlessCacheEngineStack.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/cd647a85c12320a213429ab3e6255fc9076fe1e14f3c3592fc596aa54f217032.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ElastiCacheServerlessCacheEngineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ElastiCacheServerlessCacheEngineStack.assets" + ], + "metadata": { + "/ElastiCacheServerlessCacheEngineStack/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1SubnetB4246D30" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableFEE4B781" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableAssociation0B0896DC" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1DefaultRoute91CEF279" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1EIP6AD938E8" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1NATGatewayE0556630" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2Subnet74179F39" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTable6F1A15F1" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTableAssociation5A808732" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2DefaultRouteB7481BBA" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2EIP4947BC00" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2NATGateway3C070193" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1Subnet8BCA10E0" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableBE8A6027" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableAssociation347902D1" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1DefaultRouteAE1D6490" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTable0A19E10E" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTableAssociation0C73D413" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2DefaultRouteF4F5CFD2" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/ElastiCacheServerlessCacheEngineStack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCRestrictDefaultSecurityGroupCustomResource59474679" + } + ], + "/ElastiCacheServerlessCacheEngineStack/LatestNodeRuntimeMap": [ + { + "type": "aws:cdk:logicalId", + "data": "LatestNodeRuntimeMap" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ + { + "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", + "data": true + } + ], + "/ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Valkey8/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Valkey8SecurityGroupAD79447F" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Valkey8/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Valkey8F80665FE" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Valkey7/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Valkey7SecurityGroup8DDD61EE" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Valkey7/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Valkey708C07A01" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Redis7/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Redis7SecurityGroupA26FF90D" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Redis7/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Redis72C218B99" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Memcached1_6/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Memcached16SecurityGroup2D2E24C0" + } + ], + "/ElastiCacheServerlessCacheEngineStack/Memcached1_6/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Memcached165EE7D985" + } + ], + "/ElastiCacheServerlessCacheEngineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ElastiCacheServerlessCacheEngineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ElastiCacheServerlessCacheEngineStack" + }, + "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ElastiCacheServerlessCacheEngineTestDefaultTestDeployAssertEE90413E.assets" + ], + "metadata": { + "/ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/tree.json b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/tree.json new file mode 100644 index 0000000..e827f03 --- /dev/null +++ b/test/aws-elasticache/integ.elasticache-serverless-cache-engine.ts.snapshot/tree.json @@ -0,0 +1,1108 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "ElastiCacheServerlessCacheEngineStack": { + "id": "ElastiCacheServerlessCacheEngineStack", + "path": "ElastiCacheServerlessCacheEngineStack", + "children": { + "VPC": { + "id": "VPC", + "path": "ElastiCacheServerlessCacheEngineStack/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "2.168.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "2.168.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "2.168.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "2.168.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "2.168.0" + } + }, + "EIP": { + "id": "EIP", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "2.168.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "2.168.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "2.168.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "2.168.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "2.168.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "2.168.0" + } + }, + "EIP": { + "id": "EIP", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "2.168.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "2.168.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "2.168.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "2.168.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "2.168.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + }, + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "2.168.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "2.168.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "2.168.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "2.168.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + }, + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "2.168.0" + } + }, + "IGW": { + "id": "IGW", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ElastiCacheServerlessCacheEngineStack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "2.168.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "2.168.0" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "ElastiCacheServerlessCacheEngineStack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "2.168.0" + } + }, + "LatestNodeRuntimeMap": { + "id": "LatestNodeRuntimeMap", + "path": "ElastiCacheServerlessCacheEngineStack/LatestNodeRuntimeMap", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnMapping", + "version": "2.168.0" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "2.168.0" + } + }, + "Role": { + "id": "Role", + "path": "ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.168.0" + } + }, + "Handler": { + "id": "Handler", + "path": "ElastiCacheServerlessCacheEngineStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProviderBase", + "version": "2.168.0" + } + }, + "Valkey8": { + "id": "Valkey8", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey8", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey8/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey8/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "2.168.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey8/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ElastiCache::ServerlessCache", + "aws:cdk:cloudformation:props": { + "engine": "valkey", + "majorEngineVersion": "8", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "Valkey8SecurityGroupAD79447F", + "GroupId" + ] + } + ], + "serverlessCacheName": "elasticacheservenestack-valkey8-18e8b6c9", + "subnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_elasticache.CfnServerlessCache", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "Valkey7": { + "id": "Valkey7", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey7", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey7/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey7/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "2.168.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Valkey7/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ElastiCache::ServerlessCache", + "aws:cdk:cloudformation:props": { + "engine": "valkey", + "majorEngineVersion": "7", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "Valkey7SecurityGroup8DDD61EE", + "GroupId" + ] + } + ], + "serverlessCacheName": "elasticacheservenestack-valkey7-f1852a7e", + "subnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_elasticache.CfnServerlessCache", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "Redis7": { + "id": "Redis7", + "path": "ElastiCacheServerlessCacheEngineStack/Redis7", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "ElastiCacheServerlessCacheEngineStack/Redis7/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Redis7/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "2.168.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Redis7/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ElastiCache::ServerlessCache", + "aws:cdk:cloudformation:props": { + "engine": "redis", + "majorEngineVersion": "7", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "Redis7SecurityGroupA26FF90D", + "GroupId" + ] + } + ], + "serverlessCacheName": "elasticacheserveinestack-redis7-ccda94bb", + "subnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_elasticache.CfnServerlessCache", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "Memcached1_6": { + "id": "Memcached1_6", + "path": "ElastiCacheServerlessCacheEngineStack/Memcached1_6", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "ElastiCacheServerlessCacheEngineStack/Memcached1_6/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Memcached1_6/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for ElastiCache Serverless Security Group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "2.168.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ElastiCacheServerlessCacheEngineStack/Memcached1_6/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ElastiCache::ServerlessCache", + "aws:cdk:cloudformation:props": { + "engine": "memcached", + "majorEngineVersion": "1.6", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "Memcached16SecurityGroup2D2E24C0", + "GroupId" + ] + } + ], + "serverlessCacheName": "elasticacheserveack-memcached16-7fbff36e", + "subnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_elasticache.CfnServerlessCache", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.168.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ElastiCacheServerlessCacheEngineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.168.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ElastiCacheServerlessCacheEngineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.168.0" + } + }, + "ElastiCacheServerlessCacheEngineTest": { + "id": "ElastiCacheServerlessCacheEngineTest", + "path": "ElastiCacheServerlessCacheEngineTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "ElastiCacheServerlessCacheEngineTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "ElastiCacheServerlessCacheEngineTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.168.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ElastiCacheServerlessCacheEngineTest/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.168.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.168.0-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.168.0-alpha.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.168.0" + } + } +} \ No newline at end of file diff --git a/test/aws-elasticache/integ.elasticache-serverless-cache.ts b/test/aws-elasticache/integ.elasticache-serverless-cache.ts index f1288f2..6830c7f 100644 --- a/test/aws-elasticache/integ.elasticache-serverless-cache.ts +++ b/test/aws-elasticache/integ.elasticache-serverless-cache.ts @@ -3,7 +3,13 @@ import * as cdk from 'aws-cdk-lib'; import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; import { Construct } from 'constructs'; import * as ocf from '../../src'; -import { DataStorage, ECPUPerSecond, DailySnapshotTime, Engine, MajorVersion } from '../../src/aws-elasticache'; +import { + DailySnapshotTime, + DataStorage, + ECPUPerSecond, + ServerlessCacheEngine, + ValkeyEngineVersion, +} from '../../src/aws-elasticache'; class ElastiCacheStack extends cdk.Stack { public readonly alarms: cloudwatch.IAlarm[] = []; @@ -63,7 +69,9 @@ class ElastiCacheStack extends cdk.Stack { }); const serverlessCache = new ocf.aws_elasticache.ServerlessCache(this, 'ElastiCacheServerlessCluster', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), serverlessCacheName: 'my-serverless-cache', cacheUsageLimits: { dataStorage: DataStorage.gb({ minimum: 1, maximum: 5000 }), @@ -73,7 +81,6 @@ class ElastiCacheStack extends cdk.Stack { description: 'my serverless cache', finalSnapshotName: 'my-finalsnapshot', kmsKey: key, - majorEngineVersion: MajorVersion.VER_8, snapshotRetentionLimit: 6, securityGroups: [ new cdk.aws_ec2.SecurityGroup(this, 'SecurityGroup', { diff --git a/test/aws-elasticache/serverless-cache-engine.test.ts b/test/aws-elasticache/serverless-cache-engine.test.ts new file mode 100644 index 0000000..aa9b304 --- /dev/null +++ b/test/aws-elasticache/serverless-cache-engine.test.ts @@ -0,0 +1,66 @@ +import { App, Stack, aws_ec2 } from 'aws-cdk-lib'; +import { Template } from 'aws-cdk-lib/assertions'; +import { + ValkeyEngineVersion, + ServerlessCache, + ServerlessCacheEngine, + RedisEngineVersion, + MemcachedEngineVersion, +} from '../../src/aws-elasticache'; + +describe('ElastiCache Serverless Cache Engine', () => { + let app: App; + let stack: Stack; + let vpc: aws_ec2.Vpc; + + beforeEach(() => { + app = new App(); + stack = new Stack(app, 'TestStack', {}); + vpc = new aws_ec2.Vpc(stack, 'VPC'); + }); + + test.each([ + ['7', ValkeyEngineVersion.VER_7], + ['8', ValkeyEngineVersion.VER_8], + ])('valkey engine version %s', (majorVersion, engineVersion) => { + new ServerlessCache(stack, 'ServerlessCache', { + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion, + }), + vpc, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElastiCache::ServerlessCache', { + Engine: 'valkey', + MajorEngineVersion: majorVersion, + }); + }); + + test.each([['7', RedisEngineVersion.VER_7]])('redis engine version %s', (majorVersion, engineVersion) => { + new ServerlessCache(stack, 'ServerlessCache', { + serverlessCacheEngine: ServerlessCacheEngine.redis({ + engineVersion, + }), + vpc, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElastiCache::ServerlessCache', { + Engine: 'redis', + MajorEngineVersion: majorVersion, + }); + }); + + test.each([['1.6', MemcachedEngineVersion.VER_1_6]])('memcached engine version %s', (majorVersion, engineVersion) => { + new ServerlessCache(stack, 'ServerlessCache', { + serverlessCacheEngine: ServerlessCacheEngine.memcached({ + engineVersion, + }), + vpc, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElastiCache::ServerlessCache', { + Engine: 'memcached', + MajorEngineVersion: majorVersion, + }); + }); +}); diff --git a/test/aws-elasticache/serverless-cache.test.ts b/test/aws-elasticache/serverless-cache.test.ts index 6a36b44..f2f3fd9 100644 --- a/test/aws-elasticache/serverless-cache.test.ts +++ b/test/aws-elasticache/serverless-cache.test.ts @@ -7,12 +7,13 @@ import { DailySnapshotTime, DataStorage, ECPUPerSecond, - Engine, IServerlessCache, - MajorVersion, + MemcachedEngineVersion, NoPasswordRequiredUser, ServerlessCache, + ServerlessCacheEngine, UserGroup, + ValkeyEngineVersion, } from '../../src/aws-elasticache'; describe('ElastiCache Serverless Cache', () => { @@ -28,9 +29,10 @@ describe('ElastiCache Serverless Cache', () => { test('Create a serverless cache with minimal properties', () => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); Template.fromStack(stack).hasResourceProperties('AWS::ElastiCache::ServerlessCache', { @@ -61,7 +63,9 @@ describe('ElastiCache Serverless Cache', () => { }); new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), serverlessCacheName: 'my-serverless-cache', cacheUsageLimits: { dataStorage: DataStorage.gb({ minimum: 1000, maximum: 2000 }), @@ -71,7 +75,6 @@ describe('ElastiCache Serverless Cache', () => { description: 'my serverless cache', finalSnapshotName: 'my-finalsnapshot', kmsKey: key, - majorEngineVersion: MajorVersion.VER_8, snapshotRetentionLimit: 6, snapshotArnsToRestore: ['arn:aws:elasticache:us-east-1:123456789012:serverlesscachesnapshot:my-final-snapshot'], securityGroups: [securityGroup], @@ -161,9 +164,10 @@ describe('ElastiCache Serverless Cache', () => { }); const serverlessCache = new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); serverlessCache.grantConnect(role); @@ -204,9 +208,10 @@ describe('ElastiCache Serverless Cache', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { serverlessCacheName: 'my serverless cache', - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow('`serverlessCacheName` must not contain spaces, got: my serverless cache.'); }); @@ -217,9 +222,10 @@ describe('ElastiCache Serverless Cache', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { serverlessCacheName, - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow( `\`serverlessCacheName\` must be between 1 and 40 characters, got: ${serverlessCacheName.length} characters.`, @@ -232,12 +238,13 @@ describe('ElastiCache Serverless Cache', () => { test.each([0, 5001])('throws when dataStorage.maximum is invalid, got %s', invalidMax => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { dataStorage: DataStorage.gb({ maximum: invalidMax }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`dataStorage.maximum\` must be between 1 and 5000, got: ${invalidMax}.`); }); @@ -245,12 +252,13 @@ describe('ElastiCache Serverless Cache', () => { test.each([0, 5001])('throws when dataStorage.minimum is invalid, got %s', invalidMin => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { dataStorage: DataStorage.gb({ minimum: invalidMin }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`dataStorage.minimum\` must be between 1 and 5000, got: ${invalidMin}.`); }); @@ -258,12 +266,13 @@ describe('ElastiCache Serverless Cache', () => { test('throws when dataStorage.maximum is less than dataStorage.minimum', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { dataStorage: DataStorage.gb({ minimum: 2000, maximum: 1000 }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow( '`dataStorage.maximum` must be greater than or equal to `dataStorage.minimum`, got: maximum 1000, minimum 2000.', @@ -273,12 +282,13 @@ describe('ElastiCache Serverless Cache', () => { test.each([999, 15000001])('throws when ecpuPerSecond.maximum is invalid, got %s', invalidMax => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { ecpuPerSecond: ECPUPerSecond.of({ maximum: invalidMax }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`ecpuPerSecond.maximum\` must be between 1000 and 15000000, got: ${invalidMax}.`); }); @@ -286,12 +296,13 @@ describe('ElastiCache Serverless Cache', () => { test.each([999, 15000001])('throws when ecpuPerSecond.minimum is invalid, got %s', invalidMin => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { ecpuPerSecond: ECPUPerSecond.of({ minimum: invalidMin }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`ecpuPerSecond.minimum\` must be between 1000 and 15000000, got: ${invalidMin}.`); }); @@ -299,12 +310,13 @@ describe('ElastiCache Serverless Cache', () => { test('throws when ecpuPerSecond.maximum is less than ecpuPerSecond.minimum', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, cacheUsageLimits: { ecpuPerSecond: ECPUPerSecond.of({ minimum: 2000, maximum: 1000 }), }, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow( '`ecpuPerSecond.maximum` must be greater than or equal to `ecpuPerSecond.minimum`, got: maximum 1000, minimum 2000.', @@ -317,9 +329,10 @@ describe('ElastiCache Serverless Cache', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { description, - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`description\` must not contain < and >, got: ${description}`); }); @@ -328,9 +341,10 @@ describe('ElastiCache Serverless Cache', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { description: 'a'.repeat(256), - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow('`description` must not exceed 255 characters, got: 256 characters.'); }); @@ -340,10 +354,11 @@ describe('ElastiCache Serverless Cache', () => { test('throws when dailySnapshotTime is set without snapshotRetentionLimit', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, dailySnapshotTime: new DailySnapshotTime({ hour: 12, minute: 0 }), - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow('`snapshotRetentionLimit` must be specified when `dailySnapshotTime` is set.'); }); @@ -351,10 +366,11 @@ describe('ElastiCache Serverless Cache', () => { test.each([0, 36])('throws when snapshotRetentionLimit is invalid, got %s', snapshotRetentionLimit => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, snapshotRetentionLimit, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow(`\`snapshotRetentionLimit\` must be between 1 and 35, got: ${snapshotRetentionLimit}.`); }); @@ -366,10 +382,11 @@ describe('ElastiCache Serverless Cache', () => { finalSnapshotName => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, finalSnapshotName, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow( `\`finalSnapshotName\` must consist only of lowercase alphanumeric characters or hyphens, with the first character as a letter, and it can't end with a hyphen or contain two consecutive hyphens, got: ${finalSnapshotName}.`, @@ -380,10 +397,11 @@ describe('ElastiCache Serverless Cache', () => { test('throws when finalSnapshotName length is invalid', () => { expect(() => { new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, finalSnapshotName: 'a'.repeat(256), - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow('`finalSnapshotName` must not exceed 255 characters, got: 256 characters.'); }); @@ -401,10 +419,11 @@ describe('ElastiCache Serverless Cache', () => { }); new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.MEMCACHED, + serverlessCacheEngine: ServerlessCacheEngine.memcached({ + engineVersion: MemcachedEngineVersion.VER_1_6, + }), vpc, userGroup, - majorEngineVersion: MajorVersion.VER_8, }); }).toThrow('`userGroup` is available for Valkey and Redis OSS only, got engine: memcached.'); }); @@ -413,9 +432,10 @@ describe('ElastiCache Serverless Cache', () => { describe('metric method test', () => { test('metric', () => { const serverlessCache = new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); const metric = serverlessCache.metric('CacheHits', {}); @@ -436,9 +456,10 @@ describe('ElastiCache Serverless Cache', () => { test('metricBytesUsedForCache', () => { const serverlessCache = new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); const metric = serverlessCache.metricBytesUsedForCache(); @@ -459,9 +480,10 @@ describe('ElastiCache Serverless Cache', () => { test('metricElastiCacheProcessingUnits', () => { const serverlessCache = new ServerlessCache(stack, 'ServerlessCache', { - engine: Engine.VALKEY, + serverlessCacheEngine: ServerlessCacheEngine.valkey({ + engineVersion: ValkeyEngineVersion.VER_8, + }), vpc, - majorEngineVersion: MajorVersion.VER_8, }); const metric = serverlessCache.metricElastiCacheProcessingUnits({});