awscdkredshiftalpha

package module
v2.30.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

README

Amazon Redshift Construct Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


Starting a Redshift Cluster Database

To set up a Redshift cluster, define a Cluster. It will be launched in a VPC. You can specify a VPC, otherwise one will be created. The nodes are always launched in private subnets and are encrypted by default.

import ec2 "github.com/aws/aws-cdk-go/awscdk"


vpc := ec2.NewVpc(this, jsii.String("Vpc"))
cluster := awscdkredshiftalpha.NewCluster(this, jsii.String("Redshift"), &clusterProps{
	masterUser: &login{
		masterUsername: jsii.String("admin"),
	},
	vpc: vpc,
})

By default, the master password will be generated and stored in AWS Secrets Manager.

A default database named default_db will be created in the cluster. To change the name of this database set the defaultDatabaseName attribute in the constructor properties.

By default, the cluster will not be publicly accessible. Depending on your use case, you can make the cluster publicly accessible with the publiclyAccessible property.

Connecting

To control who can access the cluster, use the .connections attribute. Redshift Clusters have a default port, so you don't need to specify the port:

cluster.connections.allowDefaultPortFromAnyIpv4(jsii.String("Open to the world"))

The endpoint to access your database cluster will be available as the .clusterEndpoint attribute:

cluster.clusterEndpoint.socketAddress

Database Resources

This module allows for the creation of non-CloudFormation database resources such as users and tables. This allows you to manage identities, permissions, and stateful resources within your Redshift cluster from your CDK application.

Because these resources are not available in CloudFormation, this library leverages custom resources to manage them. In addition to the IAM permissions required to make Redshift service calls, the execution role for the custom resource handler requires database credentials to create resources within the cluster.

These database credentials can be supplied explicitly through the adminUser properties of the various database resource constructs. Alternatively, the credentials can be automatically pulled from the Redshift cluster's default administrator credentials. However, this option is only available if the password for the credentials was generated by the CDK application (ie., no value vas provided for the masterPassword property of Cluster.masterUser).

Creating Users

Create a user within a Redshift cluster database by instantiating a User construct. This will generate a username and password, store the credentials in a AWS Secrets Manager Secret, and make a query to the Redshift cluster to create a new database user with the credentials.

awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})

By default, the user credentials are encrypted with your AWS account's default Secrets Manager encryption key. You can specify the encryption key used for this purpose by supplying a key in the encryptionKey property.

import kms "github.com/aws/aws-cdk-go/awscdk"


encryptionKey := kms.NewKey(this, jsii.String("Key"))
awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	encryptionKey: encryptionKey,
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})

By default, a username is automatically generated from the user construct ID and its path in the construct tree. You can specify a particular username by providing a value for the username property. Usernames must be valid identifiers; see: Names and identifiers in the Amazon Redshift Database Developer Guide.

awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	username: jsii.String("myuser"),
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})

The user password is generated by AWS Secrets Manager using the default configuration found in secretsmanager.SecretStringGenerator, except with password length 30 and some SQL-incompliant characters excluded. The plaintext for the password will never be present in the CDK application; instead, a CloudFormation Dynamic Reference will be used wherever the password value is required.

Creating Tables

Create a table within a Redshift cluster database by instantiating a Table construct. This will make a query to the Redshift cluster to create a new database table with the supplied schema.

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	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"),
})

The table can be configured to have distStyle attribute and a distKey column:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			distKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	distStyle: awscdkredshiftalpha.TableDistStyle_KEY,
})

The table can also be configured to have sortStyle attribute and sortKey columns:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			sortKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
			sortKey: jsii.Boolean(true),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	sortStyle: awscdkredshiftalpha.TableSortStyle_COMPOUND,
})
Granting Privileges

You can give a user privileges to perform certain actions on a table by using the Table.grant() method.

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
table := awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	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_DROP, awscdkredshiftalpha.TableAction_SELECT)

Take care when managing privileges via the CDK, as attempting to manage a user's privileges on the same table in multiple CDK applications could lead to accidentally overriding these permissions. Consider the following two CDK applications which both refer to the same user and table. In application 1, the resources are created and the user is given INSERT permissions on the table:

databaseName := "databaseName"
username := "myuser"
tableName := "mytable"

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	username: username,
	cluster: cluster,
	databaseName: databaseName,
})
table := awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: databaseName,
})
table.grant(user, awscdkredshiftalpha.TableAction_INSERT)

In application 2, the resources are imported and the user is given INSERT permissions on the table:

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)

Both applications attempt to grant the user the appropriate privilege on the table by submitting a GRANT USER SQL query to the Redshift cluster. Note that the latter of these two calls will have no effect since the user has already been granted the privilege.

Now, if application 1 were to remove the call to grant, a REVOKE USER SQL query is submitted to the Redshift cluster. In general, application 1 does not know that application 2 has also granted this permission and thus cannot decide not to issue the revocation. This leads to the undesirable state where application 2 still contains the call to grant but the user does not have the specified permission.

Note that this does not occur when duplicate privileges are granted within the same application, as such privileges are de-duplicated before any SQL query is submitted.

Rotating credentials

When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically:

cluster.addRotationSingleUser()

The multi user rotation scheme is also available:

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
cluster.addRotationMultiUser(jsii.String("MultiUserRotation"), &rotationMultiUserOptions{
	secret: user.secret,
})

Documentation

Overview

The CDK Construct Library for AWS::Redshift

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterParameterGroup_IsConstruct

func ClusterParameterGroup_IsConstruct(x interface{}) *bool

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.

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

func ClusterParameterGroup_IsResource

func ClusterParameterGroup_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func ClusterSubnetGroup_IsConstruct

func ClusterSubnetGroup_IsConstruct(x interface{}) *bool

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.

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

func ClusterSubnetGroup_IsResource

func ClusterSubnetGroup_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func Cluster_IsConstruct

func Cluster_IsConstruct(x interface{}) *bool

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.

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

func Cluster_IsResource

func Cluster_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func DatabaseSecret_FromSecretAttributes

func DatabaseSecret_FromSecretAttributes(scope constructs.Construct, id *string, attrs *awssecretsmanager.SecretAttributes) awssecretsmanager.ISecret

Import an existing secret into the Stack. Experimental.

func DatabaseSecret_FromSecretCompleteArn

func DatabaseSecret_FromSecretCompleteArn(scope constructs.Construct, id *string, secretCompleteArn *string) awssecretsmanager.ISecret

Imports a secret by complete ARN.

The complete ARN is the ARN with the Secrets Manager-supplied suffix. Experimental.

func DatabaseSecret_FromSecretNameV2

func DatabaseSecret_FromSecretNameV2(scope constructs.Construct, id *string, secretName *string) awssecretsmanager.ISecret

Imports a secret by secret name.

A secret with this name must exist in the same account & region. Replaces the deprecated `fromSecretName`. Experimental.

func DatabaseSecret_FromSecretPartialArn

func DatabaseSecret_FromSecretPartialArn(scope constructs.Construct, id *string, secretPartialArn *string) awssecretsmanager.ISecret

Imports a secret by partial ARN.

The partial ARN is the ARN without the Secrets Manager-supplied suffix. Experimental.

func DatabaseSecret_IsConstruct

func DatabaseSecret_IsConstruct(x interface{}) *bool

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.

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

func DatabaseSecret_IsResource

func DatabaseSecret_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func DatabaseSecret_IsSecret

func DatabaseSecret_IsSecret(x interface{}) *bool

Return whether the given object is a Secret. Experimental.

func NewClusterParameterGroup_Override

func NewClusterParameterGroup_Override(c ClusterParameterGroup, scope constructs.Construct, id *string, props *ClusterParameterGroupProps)

Experimental.

func NewClusterSubnetGroup_Override

func NewClusterSubnetGroup_Override(c ClusterSubnetGroup, scope constructs.Construct, id *string, props *ClusterSubnetGroupProps)

Experimental.

func NewCluster_Override

func NewCluster_Override(c Cluster, scope constructs.Construct, id *string, props *ClusterProps)

Experimental.

func NewDatabaseSecret_Override

func NewDatabaseSecret_Override(d DatabaseSecret, scope constructs.Construct, id *string, props *DatabaseSecretProps)

Experimental.

func NewEndpoint_Override

func NewEndpoint_Override(e Endpoint, address *string, port *float64)

Experimental.

func NewTable_Override

func NewTable_Override(t Table, scope constructs.Construct, id *string, props *TableProps)

Experimental.

func NewUser_Override

func NewUser_Override(u User, scope constructs.Construct, id *string, props *UserProps)

Experimental.

func Table_IsConstruct

func Table_IsConstruct(x interface{}) *bool

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.

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

func User_IsConstruct

func User_IsConstruct(x interface{}) *bool

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.

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

Types

type Cluster

type Cluster interface {
	awscdk.Resource
	ICluster
	// The endpoint to use for read/write operations.
	// Experimental.
	ClusterEndpoint() Endpoint
	// Identifier of the cluster.
	// Experimental.
	ClusterName() *string
	// Access to the network connections.
	// Experimental.
	Connections() awsec2.Connections
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The secret attached to this cluster.
	// Experimental.
	Secret() awssecretsmanager.ISecret
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Adds the multi user rotation to this cluster.
	// Experimental.
	AddRotationMultiUser(id *string, options *RotationMultiUserOptions) awssecretsmanager.SecretRotation
	// Adds the single user rotation of the master password to this cluster.
	// Experimental.
	AddRotationSingleUser(automaticallyAfter awscdk.Duration) awssecretsmanager.SecretRotation
	// 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 deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Renders the secret attachment target specifications.
	// Experimental.
	AsSecretAttachmentTarget() *awssecretsmanager.SecretAttachmentTargetProps
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Create a Redshift cluster a given number of nodes.

Example:

import ec2 "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"))
cluster := awscdkredshiftalpha.NewCluster(this, jsii.String("Redshift"), &clusterProps{
	masterUser: &login{
		masterUsername: jsii.String("admin"),
	},
	vpc: vpc,
})

Experimental.

func NewCluster

func NewCluster(scope constructs.Construct, id *string, props *ClusterProps) Cluster

Experimental.

type ClusterAttributes

type ClusterAttributes struct {
	// Cluster endpoint address.
	// Experimental.
	ClusterEndpointAddress *string `field:"required" json:"clusterEndpointAddress" yaml:"clusterEndpointAddress"`
	// Cluster endpoint port.
	// Experimental.
	ClusterEndpointPort *float64 `field:"required" json:"clusterEndpointPort" yaml:"clusterEndpointPort"`
	// Identifier for the cluster.
	// Experimental.
	ClusterName *string `field:"required" json:"clusterName" yaml:"clusterName"`
	// The security groups of the redshift cluster.
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
}

Properties that describe an existing cluster instance.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var securityGroup securityGroup

clusterAttributes := &clusterAttributes{
	clusterEndpointAddress: jsii.String("clusterEndpointAddress"),
	clusterEndpointPort: jsii.Number(123),
	clusterName: jsii.String("clusterName"),

	// the properties below are optional
	securityGroups: []iSecurityGroup{
		securityGroup,
	},
}

Experimental.

type ClusterParameterGroup

type ClusterParameterGroup interface {
	awscdk.Resource
	IClusterParameterGroup
	// The name of the parameter group.
	// Experimental.
	ClusterParameterGroupName() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// 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 deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A cluster parameter group.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

clusterParameterGroup := redshift_alpha.NewClusterParameterGroup(this, jsii.String("MyClusterParameterGroup"), &clusterParameterGroupProps{
	parameters: map[string]*string{
		"parametersKey": jsii.String("parameters"),
	},

	// the properties below are optional
	description: jsii.String("description"),
})

Experimental.

func NewClusterParameterGroup

func NewClusterParameterGroup(scope constructs.Construct, id *string, props *ClusterParameterGroupProps) ClusterParameterGroup

Experimental.

type ClusterParameterGroupProps

type ClusterParameterGroupProps struct {
	// The parameters in this parameter group.
	// Experimental.
	Parameters *map[string]*string `field:"required" json:"parameters" yaml:"parameters"`
	// Description for this parameter group.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
}

Properties for a parameter group.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

clusterParameterGroupProps := &clusterParameterGroupProps{
	parameters: map[string]*string{
		"parametersKey": jsii.String("parameters"),
	},

	// the properties below are optional
	description: jsii.String("description"),
}

Experimental.

type ClusterProps

type ClusterProps struct {
	// Username and password for the administrative user.
	// Experimental.
	MasterUser *Login `field:"required" json:"masterUser" yaml:"masterUser"`
	// The VPC to place the cluster in.
	// Experimental.
	Vpc awsec2.IVpc `field:"required" json:"vpc" yaml:"vpc"`
	// An optional identifier for the cluster.
	// Experimental.
	ClusterName *string `field:"optional" json:"clusterName" yaml:"clusterName"`
	// Settings for the individual instances that are launched.
	// Experimental.
	ClusterType ClusterType `field:"optional" json:"clusterType" yaml:"clusterType"`
	// Name of a database which is automatically created inside the cluster.
	// Experimental.
	DefaultDatabaseName *string `field:"optional" json:"defaultDatabaseName" yaml:"defaultDatabaseName"`
	// Whether to enable encryption of data at rest in the cluster.
	// Experimental.
	Encrypted *bool `field:"optional" json:"encrypted" yaml:"encrypted"`
	// The KMS key to use for encryption of data at rest.
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// Bucket to send logs to.
	//
	// Logging information includes queries and connection attempts, for the specified Amazon Redshift cluster.
	// Experimental.
	LoggingBucket awss3.IBucket `field:"optional" json:"loggingBucket" yaml:"loggingBucket"`
	// Prefix used for logging.
	// Experimental.
	LoggingKeyPrefix *string `field:"optional" json:"loggingKeyPrefix" yaml:"loggingKeyPrefix"`
	// The node type to be provisioned for the cluster.
	// Experimental.
	NodeType NodeType `field:"optional" json:"nodeType" yaml:"nodeType"`
	// Number of compute nodes in the cluster. Only specify this property for multi-node clusters.
	//
	// Value must be at least 2 and no more than 100.
	// Experimental.
	NumberOfNodes *float64 `field:"optional" json:"numberOfNodes" yaml:"numberOfNodes"`
	// Additional parameters to pass to the database engine https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html.
	// Experimental.
	ParameterGroup IClusterParameterGroup `field:"optional" json:"parameterGroup" yaml:"parameterGroup"`
	// What port to listen on.
	// Experimental.
	Port *float64 `field:"optional" json:"port" yaml:"port"`
	// A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).
	//
	// Example: 'Sun:23:45-Mon:00:15'.
	// See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance
	//
	// Experimental.
	PreferredMaintenanceWindow *string `field:"optional" json:"preferredMaintenanceWindow" yaml:"preferredMaintenanceWindow"`
	// Whether to make cluster publicly accessible.
	// Experimental.
	PubliclyAccessible *bool `field:"optional" json:"publiclyAccessible" yaml:"publiclyAccessible"`
	// The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
	// A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services.
	//
	// Specify a maximum of 10 roles.
	// Experimental.
	Roles *[]awsiam.IRole `field:"optional" json:"roles" yaml:"roles"`
	// Security group.
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
	// A cluster subnet group to use with this cluster.
	// Experimental.
	SubnetGroup IClusterSubnetGroup `field:"optional" json:"subnetGroup" yaml:"subnetGroup"`
	// Where to place the instances within the VPC.
	// Experimental.
	VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Properties for a new database cluster.

Example:

import ec2 "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("Vpc"))
cluster := awscdkredshiftalpha.NewCluster(this, jsii.String("Redshift"), &clusterProps{
	masterUser: &login{
		masterUsername: jsii.String("admin"),
	},
	vpc: vpc,
})

Experimental.

type ClusterSubnetGroup

type ClusterSubnetGroup interface {
	awscdk.Resource
	IClusterSubnetGroup
	// The name of the cluster subnet group.
	// Experimental.
	ClusterSubnetGroupName() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// 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 deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Class for creating a Redshift cluster subnet group.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var subnet subnet
var subnetFilter subnetFilter
var vpc vpc

clusterSubnetGroup := redshift_alpha.NewClusterSubnetGroup(this, jsii.String("MyClusterSubnetGroup"), &clusterSubnetGroupProps{
	description: jsii.String("description"),
	vpc: vpc,

	// the properties below are optional
	removalPolicy: cdk.removalPolicy_DESTROY,
	vpcSubnets: &subnetSelection{
		availabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		onePerAz: jsii.Boolean(false),
		subnetFilters: []*subnetFilter{
			subnetFilter,
		},
		subnetGroupName: jsii.String("subnetGroupName"),
		subnets: []iSubnet{
			subnet,
		},
		subnetType: awscdk.Aws_ec2.subnetType_PRIVATE_ISOLATED,
	},
})

Experimental.

func NewClusterSubnetGroup

func NewClusterSubnetGroup(scope constructs.Construct, id *string, props *ClusterSubnetGroupProps) ClusterSubnetGroup

Experimental.

type ClusterSubnetGroupProps

type ClusterSubnetGroupProps struct {
	// Description of the subnet group.
	// Experimental.
	Description *string `field:"required" json:"description" yaml:"description"`
	// The VPC to place the subnet group in.
	// Experimental.
	Vpc awsec2.IVpc `field:"required" json:"vpc" yaml:"vpc"`
	// The removal policy to apply when the subnet group are removed from the stack or replaced during an update.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
	// Which subnets within the VPC to associate with this group.
	// Experimental.
	VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Properties for creating a ClusterSubnetGroup.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var subnet subnet
var subnetFilter subnetFilter
var vpc vpc

clusterSubnetGroupProps := &clusterSubnetGroupProps{
	description: jsii.String("description"),
	vpc: vpc,

	// the properties below are optional
	removalPolicy: cdk.removalPolicy_DESTROY,
	vpcSubnets: &subnetSelection{
		availabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		onePerAz: jsii.Boolean(false),
		subnetFilters: []*subnetFilter{
			subnetFilter,
		},
		subnetGroupName: jsii.String("subnetGroupName"),
		subnets: []iSubnet{
			subnet,
		},
		subnetType: awscdk.Aws_ec2.subnetType_PRIVATE_ISOLATED,
	},
}

Experimental.

type ClusterType

type ClusterType string

What cluster type to use.

Used by {@link ClusterProps.clusterType} Experimental.

const (
	// single-node cluster, the {@link ClusterProps.numberOfNodes} parameter is not required.
	// Experimental.
	ClusterType_SINGLE_NODE ClusterType = "SINGLE_NODE"
	// multi-node cluster, set the amount of nodes using {@link ClusterProps.numberOfNodes} parameter.
	// Experimental.
	ClusterType_MULTI_NODE ClusterType = "MULTI_NODE"
)

type Column

type Column struct {
	// The data type of the column.
	// Experimental.
	DataType *string `field:"required" json:"dataType" yaml:"dataType"`
	// The name of the column.
	// Experimental.
	Name *string `field:"required" json:"name" yaml:"name"`
	// Boolean value that indicates whether the column is to be configured as DISTKEY.
	// Experimental.
	DistKey *bool `field:"optional" json:"distKey" yaml:"distKey"`
	// Boolean value that indicates whether the column is to be configured as SORTKEY.
	// Experimental.
	SortKey *bool `field:"optional" json:"sortKey" yaml:"sortKey"`
}

A column in a Redshift table.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

column := &column{
	dataType: jsii.String("dataType"),
	name: jsii.String("name"),

	// the properties below are optional
	distKey: jsii.Boolean(false),
	sortKey: jsii.Boolean(false),
}

Experimental.

type DatabaseOptions

type DatabaseOptions struct {
	// The cluster containing the database.
	// Experimental.
	Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The name of the database.
	// Experimental.
	DatabaseName *string `field:"required" json:"databaseName" yaml:"databaseName"`
	// The secret containing credentials to a Redshift user with administrator privileges.
	//
	// Secret JSON schema: `{ username: string; password: string }`.
	// Experimental.
	AdminUser awssecretsmanager.ISecret `field:"optional" json:"adminUser" yaml:"adminUser"`
}

Properties for accessing a Redshift database.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var cluster cluster
var secret secret

databaseOptions := &databaseOptions{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),

	// the properties below are optional
	adminUser: secret,
}

Experimental.

type DatabaseSecret

type DatabaseSecret interface {
	awssecretsmanager.Secret
	// Provides an identifier for this secret for use in IAM policies.
	//
	// If there is a full ARN, this is just the ARN;
	// if we have a partial ARN -- due to either importing by secret name or partial ARN --
	// then we need to add a suffix to capture the full ARN's format.
	// Experimental.
	ArnForPolicies() *string
	// Experimental.
	AutoCreatePolicy() *bool
	// The customer-managed encryption key that is used to encrypt this secret, if any.
	//
	// When not specified, the default
	// KMS key for the account and region is being used.
	// Experimental.
	EncryptionKey() awskms.IKey
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The string of the characters that are excluded in this secret when it is generated.
	// Experimental.
	ExcludeCharacters() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The ARN of the secret in AWS Secrets Manager.
	//
	// Will return the full ARN if available, otherwise a partial arn.
	// For secrets imported by the deprecated `fromSecretName`, it will return the `secretName`.
	// Experimental.
	SecretArn() *string
	// The full ARN of the secret in AWS Secrets Manager, which is the ARN including the Secrets Manager-supplied 6-character suffix.
	//
	// This is equal to `secretArn` in most cases, but is undefined when a full ARN is not available (e.g., secrets imported by name).
	// Experimental.
	SecretFullArn() *string
	// The name of the secret.
	//
	// For "owned" secrets, this will be the full resource name (secret name + suffix), unless the
	// '@aws-cdk/aws-secretsmanager:parseOwnedSecretName' feature flag is set.
	// Experimental.
	SecretName() *string
	// Retrieve the value of the stored secret as a `SecretValue`.
	// Experimental.
	SecretValue() awscdk.SecretValue
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Adds a replica region for the secret.
	// Experimental.
	AddReplicaRegion(region *string, encryptionKey awskms.IKey)
	// Adds a rotation schedule to the secret.
	// Experimental.
	AddRotationSchedule(id *string, options *awssecretsmanager.RotationScheduleOptions) awssecretsmanager.RotationSchedule
	// Adds a statement to the IAM resource policy associated with this secret.
	//
	// If this secret was created in this stack, a resource policy will be
	// automatically created upon the first call to `addToResourcePolicy`. If
	// the secret is imported, then this is a no-op.
	// Experimental.
	AddToResourcePolicy(statement awsiam.PolicyStatement) *awsiam.AddToResourcePolicyResult
	// 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 deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Attach a target to this secret.
	//
	// Returns: An attached secret.
	// Experimental.
	Attach(target awssecretsmanager.ISecretAttachmentTarget) awssecretsmanager.ISecret
	// Denies the `DeleteSecret` action to all principals within the current account.
	// Experimental.
	DenyAccountRootDelete()
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Grants reading the secret value to some role.
	// Experimental.
	GrantRead(grantee awsiam.IGrantable, versionStages *[]*string) awsiam.Grant
	// Grants writing and updating the secret value to some role.
	// Experimental.
	GrantWrite(grantee awsiam.IGrantable) awsiam.Grant
	// Interpret the secret as a JSON object and return a field's value from it as a `SecretValue`.
	// Experimental.
	SecretValueFromJson(jsonField *string) awscdk.SecretValue
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A database secret.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var key key

databaseSecret := redshift_alpha.NewDatabaseSecret(this, jsii.String("MyDatabaseSecret"), &databaseSecretProps{
	username: jsii.String("username"),

	// the properties below are optional
	encryptionKey: key,
})

Experimental.

func NewDatabaseSecret

func NewDatabaseSecret(scope constructs.Construct, id *string, props *DatabaseSecretProps) DatabaseSecret

Experimental.

type DatabaseSecretProps

type DatabaseSecretProps struct {
	// The username.
	// Experimental.
	Username *string `field:"required" json:"username" yaml:"username"`
	// The KMS key to use to encrypt the secret.
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
}

Construction properties for a DatabaseSecret.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var key key

databaseSecretProps := &databaseSecretProps{
	username: jsii.String("username"),

	// the properties below are optional
	encryptionKey: key,
}

Experimental.

type Endpoint

type Endpoint interface {
	// The hostname of the endpoint.
	// Experimental.
	Hostname() *string
	// The port of the endpoint.
	// Experimental.
	Port() *float64
	// The combination of "HOSTNAME:PORT" for this endpoint.
	// Experimental.
	SocketAddress() *string
}

Connection endpoint of a redshift cluster.

Consists of a combination of hostname and port.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import redshift_alpha "github.com/aws/aws-cdk-go/awscdkredshiftalpha"

endpoint := redshift_alpha.NewEndpoint(jsii.String("address"), jsii.Number(123))

Experimental.

func NewEndpoint

func NewEndpoint(address *string, port *float64) Endpoint

Experimental.

type ICluster

type ICluster interface {
	awsec2.IConnectable
	awscdk.IResource
	awssecretsmanager.ISecretAttachmentTarget
	// The endpoint to use for read/write operations.
	// Experimental.
	ClusterEndpoint() Endpoint
	// Name of the cluster.
	// Experimental.
	ClusterName() *string
}

Create a Redshift Cluster with a given number of nodes.

Implemented by {@link Cluster} via {@link ClusterBase}. Experimental.

func Cluster_FromClusterAttributes

func Cluster_FromClusterAttributes(scope constructs.Construct, id *string, attrs *ClusterAttributes) ICluster

Import an existing DatabaseCluster from properties. Experimental.

type IClusterParameterGroup

type IClusterParameterGroup interface {
	awscdk.IResource
	// The name of this parameter group.
	// Experimental.
	ClusterParameterGroupName() *string
}

A parameter group. Experimental.

func ClusterParameterGroup_FromClusterParameterGroupName

func ClusterParameterGroup_FromClusterParameterGroupName(scope constructs.Construct, id *string, clusterParameterGroupName *string) IClusterParameterGroup

Imports a parameter group. Experimental.

type IClusterSubnetGroup

type IClusterSubnetGroup interface {
	awscdk.IResource
	// The name of the cluster subnet group.
	// Experimental.
	ClusterSubnetGroupName() *string
}

Interface for a cluster subnet group. Experimental.

func ClusterSubnetGroup_FromClusterSubnetGroupName

func ClusterSubnetGroup_FromClusterSubnetGroupName(scope constructs.Construct, id *string, clusterSubnetGroupName *string) IClusterSubnetGroup

Imports an existing subnet group by name. Experimental.

type ITable

type ITable interface {
	constructs.IConstruct
	// Grant a user privilege to access this table.
	// Experimental.
	Grant(user IUser, actions ...TableAction)
	// The cluster where the table is located.
	// Experimental.
	Cluster() ICluster
	// The name of the database where the table is located.
	// Experimental.
	DatabaseName() *string
	// The columns of the table.
	// Experimental.
	TableColumns() *[]*Column
	// Name of the table.
	// Experimental.
	TableName() *string
}

Represents a table in a Redshift database. Experimental.

func Table_FromTableAttributes

func Table_FromTableAttributes(scope constructs.Construct, id *string, attrs *TableAttributes) ITable

Specify a Redshift table using a table name and schema that already exists. Experimental.

type IUser

type IUser interface {
	constructs.IConstruct
	// Grant this user privilege to access a table.
	// Experimental.
	AddTablePrivileges(table ITable, actions ...TableAction)
	// The cluster where the table is located.
	// Experimental.
	Cluster() ICluster
	// The name of the database where the table is located.
	// Experimental.
	DatabaseName() *string
	// The password of the user.
	// Experimental.
	Password() awscdk.SecretValue
	// The name of the user.
	// Experimental.
	Username() *string
}

Represents a user in a Redshift database. Experimental.

func User_FromUserAttributes

func User_FromUserAttributes(scope constructs.Construct, id *string, attrs *UserAttributes) IUser

Specify a Redshift user using credentials that already exist. Experimental.

type Login

type Login struct {
	// Username.
	// Experimental.
	MasterUsername *string `field:"required" json:"masterUsername" yaml:"masterUsername"`
	// KMS encryption key to encrypt the generated secret.
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// Password.
	//
	// Do not put passwords in your CDK code directly.
	// Experimental.
	MasterPassword awscdk.SecretValue `field:"optional" json:"masterPassword" yaml:"masterPassword"`
}

Username and password combination.

Example:

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
cluster.addRotationMultiUser(jsii.String("MultiUserRotation"), &rotationMultiUserOptions{
	secret: user.secret,
})

Experimental.

type NodeType

type NodeType string

Possible Node Types to use in the cluster used for defining {@link ClusterProps.nodeType}. Experimental.

const (
	// ds2.xlarge.
	// Experimental.
	NodeType_DS2_XLARGE NodeType = "DS2_XLARGE"
	// ds2.8xlarge.
	// Experimental.
	NodeType_DS2_8XLARGE NodeType = "DS2_8XLARGE"
	// dc1.large.
	// Experimental.
	NodeType_DC1_LARGE NodeType = "DC1_LARGE"
	// dc1.8xlarge.
	// Experimental.
	NodeType_DC1_8XLARGE NodeType = "DC1_8XLARGE"
	// dc2.large.
	// Experimental.
	NodeType_DC2_LARGE NodeType = "DC2_LARGE"
	// dc2.8xlarge.
	// Experimental.
	NodeType_DC2_8XLARGE NodeType = "DC2_8XLARGE"
	// ra3.xlplus.
	// Experimental.
	NodeType_RA3_XLPLUS NodeType = "RA3_XLPLUS"
	// ra3.4xlarge.
	// Experimental.
	NodeType_RA3_4XLARGE NodeType = "RA3_4XLARGE"
	// ra3.16xlarge.
	// Experimental.
	NodeType_RA3_16XLARGE NodeType = "RA3_16XLARGE"
)

type RotationMultiUserOptions

type RotationMultiUserOptions struct {
	// The secret to rotate.
	//
	// It must be a JSON string with the following format:
	// “`
	// {
	//    "engine": <required: database engine>,
	//    "host": <required: instance host name>,
	//    "username": <required: username>,
	//    "password": <required: password>,
	//    "dbname": <optional: database name>,
	//    "port": <optional: if not specified, default port will be used>,
	//    "masterarn": <required: the arn of the master secret which will be used to create users/change passwords>
	// }
	// “`.
	// Experimental.
	Secret awssecretsmanager.ISecret `field:"required" json:"secret" yaml:"secret"`
	// Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
	// Experimental.
	AutomaticallyAfter awscdk.Duration `field:"optional" json:"automaticallyAfter" yaml:"automaticallyAfter"`
}

Options to add the multi user rotation.

Example:

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
cluster.addRotationMultiUser(jsii.String("MultiUserRotation"), &rotationMultiUserOptions{
	secret: user.secret,
})

Experimental.

type Table

type Table interface {
	constructs.Construct
	ITable
	// The cluster where the table is located.
	// Experimental.
	Cluster() ICluster
	// The name of the database where the table is located.
	// Experimental.
	DatabaseName() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// The columns of the table.
	// Experimental.
	TableColumns() *[]*Column
	// Name of the table.
	// Experimental.
	TableName() *string
	// 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 retained by default.
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Grant a user privilege to access this table.
	// Experimental.
	Grant(user IUser, actions ...TableAction)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A table in a Redshift cluster.

Example:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			distKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	distStyle: awscdkredshiftalpha.TableDistStyle_KEY,
})

Experimental.

func NewTable

func NewTable(scope constructs.Construct, id *string, props *TableProps) Table

Experimental.

type TableAction

type TableAction string

An action that a Redshift user can be granted privilege to perform on a table.

Example:

databaseName := "databaseName"
username := "myuser"
tableName := "mytable"

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	username: username,
	cluster: cluster,
	databaseName: databaseName,
})
table := awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: databaseName,
})
table.grant(user, awscdkredshiftalpha.TableAction_INSERT)

Experimental.

const (
	// Grants privilege to select data from a table or view using a SELECT statement.
	// Experimental.
	TableAction_SELECT TableAction = "SELECT"
	// Grants privilege to load data into a table using an INSERT statement or a COPY statement.
	// Experimental.
	TableAction_INSERT TableAction = "INSERT"
	// Grants privilege to update a table column using an UPDATE statement.
	// Experimental.
	TableAction_UPDATE TableAction = "UPDATE"
	// Grants privilege to delete a data row from a table.
	// Experimental.
	TableAction_DELETE TableAction = "DELETE"
	// Grants privilege to drop a table.
	// Experimental.
	TableAction_DROP TableAction = "DROP"
	// Grants privilege to create a foreign key constraint.
	//
	// You need to grant this privilege on both the referenced table and the referencing table; otherwise, the user can't create the constraint.
	// Experimental.
	TableAction_REFERENCES TableAction = "REFERENCES"
	// Grants all available privileges at once to the specified user or user group.
	// Experimental.
	TableAction_ALL TableAction = "ALL"
)

type TableAttributes

type TableAttributes struct {
	// The cluster where the table is located.
	// Experimental.
	Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The name of the database where the table is located.
	// Experimental.
	DatabaseName *string `field:"required" json:"databaseName" yaml:"databaseName"`
	// The columns of the table.
	// Experimental.
	TableColumns *[]*Column `field:"required" json:"tableColumns" yaml:"tableColumns"`
	// Name of the table.
	// Experimental.
	TableName *string `field:"required" json:"tableName" yaml:"tableName"`
}

A full specification of a Redshift table that can be used to import it fluently into the CDK application.

Example:

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)

Experimental.

type TableDistStyle

type TableDistStyle string

The data distribution style of a table.

Example:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			distKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	distStyle: awscdkredshiftalpha.TableDistStyle_KEY,
})

Experimental.

const (
	// Amazon Redshift assigns an optimal distribution style based on the table data.
	// Experimental.
	TableDistStyle_AUTO TableDistStyle = "AUTO"
	// The data in the table is spread evenly across the nodes in a cluster in a round-robin distribution.
	// Experimental.
	TableDistStyle_EVEN TableDistStyle = "EVEN"
	// The data is distributed by the values in the DISTKEY column.
	// Experimental.
	TableDistStyle_KEY TableDistStyle = "KEY"
	// A copy of the entire table is distributed to every node.
	// Experimental.
	TableDistStyle_ALL TableDistStyle = "ALL"
)

type TableProps

type TableProps struct {
	// The cluster containing the database.
	// Experimental.
	Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The name of the database.
	// Experimental.
	DatabaseName *string `field:"required" json:"databaseName" yaml:"databaseName"`
	// The secret containing credentials to a Redshift user with administrator privileges.
	//
	// Secret JSON schema: `{ username: string; password: string }`.
	// Experimental.
	AdminUser awssecretsmanager.ISecret `field:"optional" json:"adminUser" yaml:"adminUser"`
	// The columns of the table.
	// Experimental.
	TableColumns *[]*Column `field:"required" json:"tableColumns" yaml:"tableColumns"`
	// The distribution style of the table.
	// Experimental.
	DistStyle TableDistStyle `field:"optional" json:"distStyle" yaml:"distStyle"`
	// The policy to apply when this resource is removed from the application.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
	// The sort style of the table.
	// Experimental.
	SortStyle TableSortStyle `field:"optional" json:"sortStyle" yaml:"sortStyle"`
	// The name of the table.
	// Experimental.
	TableName *string `field:"optional" json:"tableName" yaml:"tableName"`
}

Properties for configuring a Redshift table.

Example:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			distKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	distStyle: awscdkredshiftalpha.TableDistStyle_KEY,
})

Experimental.

type TableSortStyle

type TableSortStyle string

The sort style of a table.

Example:

awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &tableProps{
	tableColumns: []column{
		&column{
			name: jsii.String("col1"),
			dataType: jsii.String("varchar(4)"),
			sortKey: jsii.Boolean(true),
		},
		&column{
			name: jsii.String("col2"),
			dataType: jsii.String("float"),
			sortKey: jsii.Boolean(true),
		},
	},
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
	sortStyle: awscdkredshiftalpha.TableSortStyle_COMPOUND,
})

Experimental.

const (
	// Amazon Redshift assigns an optimal sort key based on the table data.
	// Experimental.
	TableSortStyle_AUTO TableSortStyle = "AUTO"
	// Specifies that the data is sorted using a compound key made up of all of the listed columns, in the order they are listed.
	// Experimental.
	TableSortStyle_COMPOUND TableSortStyle = "COMPOUND"
	// Specifies that the data is sorted using an interleaved sort key.
	// Experimental.
	TableSortStyle_INTERLEAVED TableSortStyle = "INTERLEAVED"
)

type User

type User interface {
	constructs.Construct
	IUser
	// The cluster where the table is located.
	// Experimental.
	Cluster() ICluster
	// The name of the database where the table is located.
	// Experimental.
	DatabaseName() *string
	// Experimental.
	DatabaseProps() *DatabaseOptions
	// Experimental.
	SetDatabaseProps(val *DatabaseOptions)
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// The password of the user.
	// Experimental.
	Password() awscdk.SecretValue
	// The Secrets Manager secret of the user.
	// Experimental.
	Secret() awssecretsmanager.ISecret
	// The name of the user.
	// Experimental.
	Username() *string
	// Grant this user privilege to access a table.
	// Experimental.
	AddTablePrivileges(table ITable, actions ...TableAction)
	// 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.
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A user in a Redshift cluster.

Example:

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
cluster.addRotationMultiUser(jsii.String("MultiUserRotation"), &rotationMultiUserOptions{
	secret: user.secret,
})

Experimental.

func NewUser

func NewUser(scope constructs.Construct, id *string, props *UserProps) User

Experimental.

type UserAttributes

type UserAttributes struct {
	// The cluster containing the database.
	// Experimental.
	Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The name of the database.
	// Experimental.
	DatabaseName *string `field:"required" json:"databaseName" yaml:"databaseName"`
	// The secret containing credentials to a Redshift user with administrator privileges.
	//
	// Secret JSON schema: `{ username: string; password: string }`.
	// Experimental.
	AdminUser awssecretsmanager.ISecret `field:"optional" json:"adminUser" yaml:"adminUser"`
	// The password of the user.
	//
	// Do not put passwords in CDK code directly.
	// Experimental.
	Password awscdk.SecretValue `field:"required" json:"password" yaml:"password"`
	// The name of the user.
	// Experimental.
	Username *string `field:"required" json:"username" yaml:"username"`
}

A full specification of a Redshift user that can be used to import it fluently into the CDK application.

Example:

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)

Experimental.

type UserProps

type UserProps struct {
	// The cluster containing the database.
	// Experimental.
	Cluster ICluster `field:"required" json:"cluster" yaml:"cluster"`
	// The name of the database.
	// Experimental.
	DatabaseName *string `field:"required" json:"databaseName" yaml:"databaseName"`
	// The secret containing credentials to a Redshift user with administrator privileges.
	//
	// Secret JSON schema: `{ username: string; password: string }`.
	// Experimental.
	AdminUser awssecretsmanager.ISecret `field:"optional" json:"adminUser" yaml:"adminUser"`
	// KMS key to encrypt the generated secret.
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// The policy to apply when this resource is removed from the application.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
	// The name of the user.
	//
	// For valid values, see: https://docs.aws.amazon.com/redshift/latest/dg/r_names.html
	// Experimental.
	Username *string `field:"optional" json:"username" yaml:"username"`
}

Properties for configuring a Redshift user.

Example:

user := awscdkredshiftalpha.NewUser(this, jsii.String("User"), &userProps{
	cluster: cluster,
	databaseName: jsii.String("databaseName"),
})
cluster.addRotationMultiUser(jsii.String("MultiUserRotation"), &rotationMultiUserOptions{
	secret: user.secret,
})

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL