User

class aws_cdk.aws_redshift_alpha.User(scope, id, *, encryption_key=None, removal_policy=None, username=None, cluster, database_name, admin_user=None)

Bases: Construct

(experimental) A user in a Redshift cluster.

Stability:

experimental

ExampleMetadata:

fixture=cluster infused

Example:

user = User(self, "User",
    cluster=cluster,
    database_name="databaseName"
)
cluster.add_rotation_multi_user("MultiUserRotation",
    secret=user.secret
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • encryption_key (Optional[IKey]) – (experimental) KMS key to encrypt the generated secret. Default: - the default AWS managed key is used

  • removal_policy (Optional[RemovalPolicy]) – (experimental) The policy to apply when this resource is removed from the application. Default: cdk.RemovalPolicy.Destroy

  • username (Optional[str]) – (experimental) The name of the user. For valid values, see: https://docs.aws.amazon.com/redshift/latest/dg/r_names.html Default: - a name is generated

  • cluster (ICluster) – (experimental) The cluster containing the database.

  • database_name (str) – (experimental) The name of the database.

  • admin_user (Optional[ISecret]) – (experimental) The secret containing credentials to a Redshift user with administrator privileges. Secret JSON schema: { username: string; password: string }. Default: - the admin secret is taken from the cluster

Stability:

experimental

Methods

add_table_privileges(table, *actions)

(experimental) Grant this user privilege to access a table.

Parameters:
Stability:

experimental

Return type:

None

apply_removal_policy(policy)

(experimental) 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.

Parameters:

policy (RemovalPolicy) –

Stability:

experimental

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

cluster

(experimental) The cluster where the table is located.

Stability:

experimental

database_name

(experimental) The name of the database where the table is located.

Stability:

experimental

node

The tree node.

password

(experimental) The password of the user.

Stability:

experimental

secret

(experimental) The Secrets Manager secret of the user.

Stability:

experimental

Attribute:

true

username

(experimental) The name of the user.

Stability:

experimental

Static Methods

classmethod from_user_attributes(scope, id, *, password, username, cluster, database_name, admin_user=None)

(experimental) Specify a Redshift user using credentials that already exist.

Parameters:
  • scope (Construct) –

  • id (str) –

  • password (SecretValue) – (experimental) The password of the user. Do not put passwords in CDK code directly.

  • username (str) – (experimental) The name of the user.

  • cluster (ICluster) – (experimental) The cluster containing the database.

  • database_name (str) – (experimental) The name of the database.

  • admin_user (Optional[ISecret]) – (experimental) The secret containing credentials to a Redshift user with administrator privileges. Secret JSON schema: { username: string; password: string }. Default: - the admin secret is taken from the cluster

Stability:

experimental

Return type:

IUser

classmethod is_construct(x)

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) – Any object.

Return type:

bool

Returns:

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