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

Attributes for importing an existing ElastiCache user.

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

## Example

TypeScript:

```ts
// use the original `default` user by using import method
const defaultUser = elasticache.NoPasswordUser.fromUserAttributes(this, 'DefaultUser', {
  // userId and userName must be 'default'
  userId: 'default',
});

// create a new default user
const newDefaultUser = new elasticache.NoPasswordUser(this, 'NewDefaultUser', {
  // new default user id must not be 'default'
  userId: 'new-default',
  // new default username must be 'default'
  userName: 'default',
  // set access string
  accessControl: elasticache.AccessControl.fromAccessString("on ~* +@all"),
});
```

Python:

```python
# use the original `default` user by using import method
default_user = elasticache.NoPasswordUser.from_user_attributes(self, "DefaultUser",
    # userId and userName must be 'default'
    user_id="default"
)

# create a new default user
new_default_user = elasticache.NoPasswordUser(self, "NewDefaultUser",
    # new default user id must not be 'default'
    user_id="new-default",
    # new default username must be 'default'
    user_name="default",
    # set access string
    access_control=elasticache.AccessControl.from_access_string("on ~* +@all")
)
```

Java:

```java
// use the original `default` user by using import method
IUser defaultUser = NoPasswordUser.fromUserAttributes(this, "DefaultUser", UserBaseAttributes.builder()
        // userId and userName must be 'default'
        .userId("default")
        .build());

// create a new default user
NoPasswordUser newDefaultUser = NoPasswordUser.Builder.create(this, "NewDefaultUser")
        // new default user id must not be 'default'
        .userId("new-default")
        // new default username must be 'default'
        .userName("default")
        // set access string
        .accessControl(AccessControl.fromAccessString("on ~* +@all"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
// use the original `default` user by using import method
var defaultUser = NoPasswordUser.FromUserAttributes(this, "DefaultUser", new UserBaseAttributes {
    // userId and userName must be 'default'
    UserId = "default"
});

// create a new default user
var newDefaultUser = new NoPasswordUser(this, "NewDefaultUser", new NoPasswordUserProps {
    // new default user id must not be 'default'
    UserId = "new-default",
    // new default username must be 'default'
    UserName = "default",
    // set access string
    AccessControl = AccessControl.FromAccessString("on ~* +@all")
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
// use the original `default` user by using import method
defaultUser := elasticache.NoPasswordUser_FromUserAttributes(this, jsii.String("DefaultUser"), &UserBaseAttributes{
	// userId and userName must be 'default'
	UserId: jsii.String("default"),
})

// create a new default user
newDefaultUser := elasticache.NewNoPasswordUser(this, jsii.String("NewDefaultUser"), &NoPasswordUserProps{
	// new default user id must not be 'default'
	UserId: jsii.String("new-default"),
	// new default username must be 'default'
	UserName: jsii.String("default"),
	// set access string
	AccessControl: elasticache.AccessControl_FromAccessString(jsii.String("on ~* +@all")),
})
```

## Properties

- `engine`: [UserEngine](/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.UserEngine.html) — The engine type for the user.

  **Default:** engine type is unknown.

- `userArn`: string — The ARN of the user.

  **Default:** derived from userId.

  One of `userId` or `userArn` is required.

- `userId`: string — The ID of the user.

  **Default:** derived from userArn.

  One of `userId` or `userArn` is required.

- `userName`: string — The user's name.

  **Default:** name is unknown.
