- 
                Notifications
    You must be signed in to change notification settings 
- Fork 21
fix(aws-elasticache)!: correct major engine version cannot be set on serverless cache for memcached #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(aws-elasticache)!: correct major engine version cannot be set on serverless cache for memcached #77
Changes from all commits
44b819d
              9b2bb00
              17e20f7
              616c2b5
              7c7cdf8
              76a3771
              7599b4a
              958cab4
              5555deb
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -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'; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -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 {} | ||
| 
      Comment on lines
    
      +21
     to 
      +24
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering the possibility that properties such as  | ||
|  | ||
| /** | ||
| * 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; | ||
| } | ||
| 
      Comment on lines
    
      +54
     to 
      +62
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The EngineVersion class (property) is wrapped in the EngineProps for factory methods of the  | ||
|  | ||
| /** | ||
| * 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; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created the props instead of directly using
majorVersionas arguments for the EngineVersion in case properties such asfullVersionare added in the future.