Skip to content
v2.273.0

Experimental

@aws-cdk/aws-redshift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

User ​

A user in a Redshift cluster.

Example ​

ts

const user = new User(this, 'User', {
  cluster: cluster,
  databaseName: 'databaseName',
});
cluster.addRotationMultiUser('MultiUserRotation', {
  secret: user.secret,
});
python
user = User(self, "User",
    cluster=cluster,
    database_name="databaseName"
)
cluster.add_rotation_multi_user("MultiUserRotation",
    secret=user.secret
)
java
User user = User.Builder.create(this, "User")
        .cluster(cluster)
        .databaseName("databaseName")
        .build();
cluster.addRotationMultiUser("MultiUserRotation", RotationMultiUserOptions.builder()
        .secret(user.getSecret())
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
var user = new User(this, "User", new UserProps {
    Cluster = cluster,
    DatabaseName = "databaseName"
});
cluster.AddRotationMultiUser("MultiUserRotation", new RotationMultiUserOptions {
    Secret = user.Secret
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &UserProps{
	Cluster: cluster,
	DatabaseName: jsii.String("databaseName"),
})
cluster.AddRotationMultiUser(jsii.String("MultiUserRotation"), &RotationMultiUserOptions{
	Secret: user.Secret,
})

Initializer ​

ts
new User(scope: Construct, id: string, props: UserProps)
python
User(scope: Construct, id: str, props: UserProps)
java
new User(Construct scope, String id, UserProps props)
csharp
new User(Construct scope, string id, UserProps props)
go
NewUser(Scope Construct, Id *string, Props UserProps)

Construct Props ​

adminUserISecretadmin_userISecretadminUserISecretAdminUserISecretAdminUserISecret= the admin secret is taken from t…#
The secret containing credentials to a Redshift user with administrator privileges.

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

default

Default: the admin secret is taken from the cluster

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster containing the database.
databaseNamestringdatabase_namestrdatabaseNameStringDatabaseNamestringDatabaseName*stringrequired#
The name of the database.
encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey= the default AWS managed key is u…#
KMS key to encrypt the generated secret.
default

Default: the default AWS managed key is used

excludeCharactersstringexclude_charactersstrexcludeCharactersStringExcludeCharactersstringExcludeCharacters*string= '"@/\\\ \''#
Characters to not include in the generated password.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= cdk.RemovalPolicy.Destroy#
The policy to apply when this resource is removed from the application.
usernamestringusernamestrusernameStringUsernamestringUsername*string= a name is generated#
The name of the user.

Properties ​

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster where the table is located.
databaseNamestringdatabase_namestrdatabaseNameStringDatabaseNamestringDatabaseName*stringrequired#
The name of the database where the table is located.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
passwordSecretValuepasswordSecretValuepasswordSecretValuePasswordSecretValuePasswordSecretValuerequired#
The password of the user.
secretISecretsecretISecretsecretISecretSecretISecretSecretISecretrequired#
The Secrets Manager secret of the user.
usernamestringusernamestrusernameStringUsernamestringUsername*stringrequired#
The name of the user.

Methods ​

addTablePrivileges(table: ITable, ...actions: TableAction[]): voiddef add_table_privileges(self, table: ITable, actions: TableAction) -> Nonepublic void addTablePrivileges(ITable table, TableAction actions)public void AddTablePrivileges(ITable table, TableAction actions)func AddTablePrivileges(Table ITable, Actions TableAction)#
Grant this user privilege to access a table.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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@staticmethod def from_user_attributes(scope: Construct, id: str, attrs: UserAttributes) -> IUserpublic static IUser fromUserAttributes(Construct scope, String id, UserAttributes attrs)public static IUser FromUserAttributes(Construct scope, string id, UserAttributes attrs)func FromUserAttributes(Scope Construct, Id *string, Attrs UserAttributes) IUserstatic#
Specify a Redshift user using credentials that already exist.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

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

  • xxxxX — Any object.

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

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func 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.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining