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

A user in a Redshift cluster.

Extends: Construct › User
Implements: IUser, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/user.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-redshift-alpha/lib/user.ts#L144)

## Example

```ts

const user = new User(this, 'User', {
  cluster: cluster,
  databaseName: 'databaseName',
});
cluster.addRotationMultiUser('MultiUserRotation', {
  secret: user.secret,
});
```

## Initializer

```ts
new User(scope: Construct, id: string, props: UserProps)
```

## Construct Props

- `adminUser`: [ISecret](/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.ISecret.html) — The secret containing credentials to a Redshift user with administrator privileges.

  **Default:** the admin secret is taken from the cluster

  Secret JSON schema: `{ username: string; password: string }`.

- `cluster`: [ICluster](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.ICluster.html) (required) — The cluster containing the database.

- `databaseName`: string (required) — The name of the database.

- `encryptionKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — KMS key to encrypt the generated secret.

  **Default:** the default AWS managed key is used

- `excludeCharacters`: string — Characters to not include in the generated password.

  **Default:** '"@/\\\ \''

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = cdk.RemovalPolicy.Destroy — The policy to apply when this resource is removed from the application.

- `username`: string — The name of the user.

  **Default:** a name is generated

  For valid values, see: https://docs.aws.amazon.com/redshift/latest/dg/r_names.html

## Properties

- `cluster`: [ICluster](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.ICluster.html) (required) — The cluster where the table is located.

- `databaseName`: string (required) — The name of the database where the table is located.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `password`: [SecretValue](/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) (required) — The password of the user.

- `secret`: [ISecret](/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.ISecret.html) (required) — The Secrets Manager secret of the user.

- `username`: string (required) — The name of the user.

## Methods

- `addTablePrivileges(table: ITable, ...actions: TableAction[]): void` — Grant this user privilege to access a table.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be destroyed (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

  This resource is destroyed by default.

- `fromUserAttributes(scope: Construct, id: string, attrs: UserAttributes): IUser` (static) — Specify a Redshift user using credentials that already exist.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
