Experimental
@aws-cdk/aws-redshift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
UserAttributes Struct
A full specification of a Redshift user that can be used to import it fluently into the CDK application.
Example
ts
const databaseName = 'databaseName';
const username = 'myuser'
const tableName = 'mytable'
const user = User.fromUserAttributes(this, 'User', {
username: username,
password: SecretValue.unsafePlainText('NOT_FOR_PRODUCTION'),
cluster: cluster,
databaseName: databaseName,
});
const table = Table.fromTableAttributes(this, 'Table', {
tableName: tableName,
tableColumns: [{ name: 'col1', dataType: 'varchar(4)' }, { name: 'col2', dataType: 'float' }],
cluster: cluster,
databaseName: 'databaseName',
});
table.grant(user, TableAction.INSERT);
python
from aws_cdk.aws_redshift_alpha import Column, Column
database_name = "databaseName"
username = "myuser"
table_name = "mytable"
user = User.from_user_attributes(self, "User",
username=username,
password=SecretValue.unsafe_plain_text("NOT_FOR_PRODUCTION"),
cluster=cluster,
database_name=database_name
)
table = Table.from_table_attributes(self, "Table",
table_name=table_name,
table_columns=[Column(name="col1", data_type="varchar(4)"), Column(name="col2", data_type="float")],
cluster=cluster,
database_name="databaseName"
)
table.grant(user, TableAction.INSERT)
java
String databaseName = "databaseName";
String username = "myuser";
String tableName = "mytable";
IUser user = User.fromUserAttributes(this, "User", UserAttributes.builder()
.username(username)
.password(SecretValue.unsafePlainText("NOT_FOR_PRODUCTION"))
.cluster(cluster)
.databaseName(databaseName)
.build());
ITable table = Table.fromTableAttributes(this, "Table", TableAttributes.builder()
.tableName(tableName)
.tableColumns(List.of(Column.builder().name("col1").dataType("varchar(4)").build(), Column.builder().name("col2").dataType("float").build()))
.cluster(cluster)
.databaseName("databaseName")
.build());
table.grant(user, TableAction.INSERT);
csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
var databaseName = "databaseName";
var username = "myuser";
var tableName = "mytable";
var user = User.FromUserAttributes(this, "User", new UserAttributes {
Username = username,
Password = SecretValue.UnsafePlainText("NOT_FOR_PRODUCTION"),
Cluster = cluster,
DatabaseName = databaseName
});
var table = Table.FromTableAttributes(this, "Table", new TableAttributes {
TableName = tableName,
TableColumns = new [] { new Column { Name = "col1", DataType = "varchar(4)" }, new Column { Name = "col2", DataType = "float" } },
Cluster = cluster,
DatabaseName = "databaseName"
});
table.Grant(user, TableAction.INSERT);
go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
databaseName := "databaseName"
username := "myuser"
tableName := "mytable"
user := awscdkredshiftalpha.User_FromUserAttributes(this, jsii.String("User"), &UserAttributes{
Username: username,
Password: awscdk.SecretValue_UnsafePlainText(jsii.String("NOT_FOR_PRODUCTION")),
Cluster: cluster,
DatabaseName: databaseName,
})
table := awscdkredshiftalpha.Table_FromTableAttributes(this, jsii.String("Table"), &TableAttributes{
TableName: tableName,
TableColumns: []Column{
&Column{
Name: jsii.String("col1"),
DataType: jsii.String("varchar(4)"),
},
&Column{
Name: jsii.String("col2"),
DataType: jsii.String("float"),
},
},
Cluster: cluster,
DatabaseName: jsii.String("databaseName"),
})
table.Grant(user, awscdkredshiftalpha.TableAction_INSERT)
Properties
adminUseroptionalISecretadmin_useroptionalISecretadminUseroptionalISecretAdminUseroptionalISecretAdminUseroptionalISecret#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 }.
The cluster containing the database.
The name of the database.
passwordSecretValuepasswordSecretValuepasswordSecretValuePasswordSecretValuePasswordSecretValuerequired#The password of the user.
Do not put passwords in CDK code directly.
The name of the user.