> **Experimental**
>
> `@aws-cdk/aws-elasticache-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# UserEngine

Engine type for ElastiCache users and user groups.

Use the named static members for the engines currently supported by ElastiCache
user/user-group resources. To target an engine not yet represented by a named
instance, use `UserEngine.of(engineType)`.

Obtainable from: UserEngine.REDIS, UserEngine.VALKEY, UserEngine.of

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/common.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-elasticache-alpha/lib/common.ts#L8)

## Example

TypeScript:

```ts
const user = new elasticache.IamUser(this, 'User', {
  // set user engine
  engine: elasticache.UserEngine.REDIS,

  // set user id
  userId: 'my-user',

  // set username
  userName: 'my-user',

  // set access string
  accessControl: elasticache.AccessControl.fromAccessString("on ~* +@all"),
});
```

Python:

```python
user = elasticache.IamUser(self, "User",
    # set user engine
    engine=elasticache.UserEngine.REDIS,

    # set user id
    user_id="my-user",

    # set username
    user_name="my-user",

    # set access string
    access_control=elasticache.AccessControl.from_access_string("on ~* +@all")
)
```

Java:

```java
IamUser user = IamUser.Builder.create(this, "User")
        // set user engine
        .engine(UserEngine.REDIS)

        // set user id
        .userId("my-user")

        // set username
        .userName("my-user")

        // set access string
        .accessControl(AccessControl.fromAccessString("on ~* +@all"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
var user = new IamUser(this, "User", new IamUserProps {
    // set user engine
    Engine = UserEngine.REDIS,

    // set user id
    UserId = "my-user",

    // set username
    UserName = "my-user",

    // set access string
    AccessControl = AccessControl.FromAccessString("on ~* +@all")
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
user := elasticache.NewIamUser(this, jsii.String("User"), &IamUserProps{
	// set user engine
	Engine: elasticache.UserEngine_REDIS(),

	// set user id
	UserId: jsii.String("my-user"),

	// set username
	UserName: jsii.String("my-user"),

	// set access string
	AccessControl: elasticache.AccessControl_FromAccessString(jsii.String("on ~* +@all")),
})
```

## Properties

- `engineType`: string — The engine type, for example `'valkey'` or `'redis'`.

  Maps directly to the `Engine` property of `AWS::ElastiCache::User` and
  `AWS::ElastiCache::UserGroup`.

- `REDIS`: [UserEngine](/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.UserEngine.html) (static) — Redis engine.

- `VALKEY`: [UserEngine](/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.UserEngine.html) (static) — Valkey engine.

## Methods

- `of(engineType: string): UserEngine // chainable` (static) — Create a new `UserEngine` with an arbitrary engine type.

  **Parameters**

  - `engineType` — the engine type (for example, `'valkey'` or `'redis'`).

- `toString(): string` — Returns the engine type as a string (for example, `'valkey'`).
