Class DatabaseClusterProps.Builder
java.lang.Object
software.amazon.awscdk.services.rds.DatabaseClusterProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<DatabaseClusterProps>
- Enclosing interface:
DatabaseClusterProps
@Stability(Stable)
public static final class DatabaseClusterProps.Builder
extends Object
implements software.amazon.jsii.Builder<DatabaseClusterProps>
A builder for
DatabaseClusterProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionautoMinorVersionUpgrade
(Boolean autoMinorVersionUpgrade) Sets the value ofDatabaseClusterProps.getAutoMinorVersionUpgrade()
backtrackWindow
(Duration backtrackWindow) Sets the value ofDatabaseClusterProps.getBacktrackWindow()
backup
(BackupProps backup) Sets the value ofDatabaseClusterProps.getBackup()
build()
Builds the configured instance.cloudwatchLogsExports
(List<String> cloudwatchLogsExports) Sets the value ofDatabaseClusterProps.getCloudwatchLogsExports()
cloudwatchLogsRetention
(RetentionDays cloudwatchLogsRetention) Sets the value ofDatabaseClusterProps.getCloudwatchLogsRetention()
cloudwatchLogsRetentionRole
(IRole cloudwatchLogsRetentionRole) Sets the value ofDatabaseClusterProps.getCloudwatchLogsRetentionRole()
clusterIdentifier
(String clusterIdentifier) Sets the value ofDatabaseClusterProps.getClusterIdentifier()
copyTagsToSnapshot
(Boolean copyTagsToSnapshot) Sets the value ofDatabaseClusterProps.getCopyTagsToSnapshot()
credentials
(Credentials credentials) Sets the value ofDatabaseClusterProps.getCredentials()
defaultDatabaseName
(String defaultDatabaseName) Sets the value ofDatabaseClusterProps.getDefaultDatabaseName()
deletionProtection
(Boolean deletionProtection) Sets the value ofDatabaseClusterProps.getDeletionProtection()
Sets the value ofDatabaseClusterProps.getDomain()
domainRole
(IRole domainRole) Sets the value ofDatabaseClusterProps.getDomainRole()
enableDataApi
(Boolean enableDataApi) Sets the value ofDatabaseClusterProps.getEnableDataApi()
enableLocalWriteForwarding
(Boolean enableLocalWriteForwarding) Sets the value ofDatabaseClusterProps.getEnableLocalWriteForwarding()
enablePerformanceInsights
(Boolean enablePerformanceInsights) Sets the value ofDatabaseClusterProps.getEnablePerformanceInsights()
engine
(IClusterEngine engine) Sets the value ofDatabaseClusterProps.getEngine()
iamAuthentication
(Boolean iamAuthentication) Sets the value ofDatabaseClusterProps.getIamAuthentication()
instanceIdentifierBase
(String instanceIdentifierBase) Sets the value ofDatabaseClusterProps.getInstanceIdentifierBase()
instanceProps
(InstanceProps instanceProps) Deprecated.- use writer and readers insteadDeprecated.- use writer and readers insteadinstanceUpdateBehaviour
(InstanceUpdateBehaviour instanceUpdateBehaviour) Sets the value ofDatabaseClusterProps.getInstanceUpdateBehaviour()
monitoringInterval
(Duration monitoringInterval) Sets the value ofDatabaseClusterProps.getMonitoringInterval()
monitoringRole
(IRole monitoringRole) Sets the value ofDatabaseClusterProps.getMonitoringRole()
networkType
(NetworkType networkType) Sets the value ofDatabaseClusterProps.getNetworkType()
parameterGroup
(IParameterGroup parameterGroup) Sets the value ofDatabaseClusterProps.getParameterGroup()
parameters
(Map<String, String> parameters) Sets the value ofDatabaseClusterProps.getParameters()
performanceInsightEncryptionKey
(IKey performanceInsightEncryptionKey) Sets the value ofDatabaseClusterProps.getPerformanceInsightEncryptionKey()
performanceInsightRetention
(PerformanceInsightRetention performanceInsightRetention) Sets the value ofDatabaseClusterProps.getPerformanceInsightRetention()
Sets the value ofDatabaseClusterProps.getPort()
preferredMaintenanceWindow
(String preferredMaintenanceWindow) Sets the value ofDatabaseClusterProps.getPreferredMaintenanceWindow()
readers
(List<? extends IClusterInstance> readers) Sets the value ofDatabaseClusterProps.getReaders()
removalPolicy
(RemovalPolicy removalPolicy) Sets the value ofDatabaseClusterProps.getRemovalPolicy()
s3ExportBuckets
(List<? extends IBucket> s3ExportBuckets) Sets the value ofDatabaseClusterProps.getS3ExportBuckets()
s3ExportRole
(IRole s3ExportRole) Sets the value ofDatabaseClusterProps.getS3ExportRole()
s3ImportBuckets
(List<? extends IBucket> s3ImportBuckets) Sets the value ofDatabaseClusterProps.getS3ImportBuckets()
s3ImportRole
(IRole s3ImportRole) Sets the value ofDatabaseClusterProps.getS3ImportRole()
securityGroups
(List<? extends ISecurityGroup> securityGroups) Sets the value ofDatabaseClusterProps.getSecurityGroups()
serverlessV2MaxCapacity
(Number serverlessV2MaxCapacity) Sets the value ofDatabaseClusterProps.getServerlessV2MaxCapacity()
serverlessV2MinCapacity
(Number serverlessV2MinCapacity) Sets the value ofDatabaseClusterProps.getServerlessV2MinCapacity()
storageEncrypted
(Boolean storageEncrypted) Sets the value ofDatabaseClusterProps.getStorageEncrypted()
storageEncryptionKey
(IKey storageEncryptionKey) Sets the value ofDatabaseClusterProps.getStorageEncryptionKey()
storageType
(DBClusterStorageType storageType) Sets the value ofDatabaseClusterProps.getStorageType()
subnetGroup
(ISubnetGroup subnetGroup) Sets the value ofDatabaseClusterProps.getSubnetGroup()
Sets the value ofDatabaseClusterProps.getVpc()
vpcSubnets
(SubnetSelection vpcSubnets) Sets the value ofDatabaseClusterProps.getVpcSubnets()
writer
(IClusterInstance writer) Sets the value ofDatabaseClusterProps.getWriter()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
engine
Sets the value ofDatabaseClusterProps.getEngine()
- Parameters:
engine
- What kind of database to start. This parameter is required.- Returns:
this
-
autoMinorVersionUpgrade
@Stability(Stable) public DatabaseClusterProps.Builder autoMinorVersionUpgrade(Boolean autoMinorVersionUpgrade) Sets the value ofDatabaseClusterProps.getAutoMinorVersionUpgrade()
- Parameters:
autoMinorVersionUpgrade
- Specifies whether minor engine upgrades are applied automatically to the DB cluster during the maintenance window.- Returns:
this
-
backtrackWindow
Sets the value ofDatabaseClusterProps.getBacktrackWindow()
- Parameters:
backtrackWindow
- The number of seconds to set a cluster's target backtrack window to. This feature is only supported by the Aurora MySQL database engine and cannot be enabled on existing clusters.- Returns:
this
-
backup
Sets the value ofDatabaseClusterProps.getBackup()
- Parameters:
backup
- Backup settings.- Returns:
this
-
cloudwatchLogsExports
@Stability(Stable) public DatabaseClusterProps.Builder cloudwatchLogsExports(List<String> cloudwatchLogsExports) Sets the value ofDatabaseClusterProps.getCloudwatchLogsExports()
- Parameters:
cloudwatchLogsExports
- The list of log types that need to be enabled for exporting to CloudWatch Logs.- Returns:
this
-
cloudwatchLogsRetention
@Stability(Stable) public DatabaseClusterProps.Builder cloudwatchLogsRetention(RetentionDays cloudwatchLogsRetention) Sets the value ofDatabaseClusterProps.getCloudwatchLogsRetention()
- Parameters:
cloudwatchLogsRetention
- The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value toInfinity
.- Returns:
this
-
cloudwatchLogsRetentionRole
@Stability(Stable) public DatabaseClusterProps.Builder cloudwatchLogsRetentionRole(IRole cloudwatchLogsRetentionRole) Sets the value ofDatabaseClusterProps.getCloudwatchLogsRetentionRole()
- Parameters:
cloudwatchLogsRetentionRole
- The IAM role for the Lambda function associated with the custom resource that sets the retention policy.- Returns:
this
-
clusterIdentifier
Sets the value ofDatabaseClusterProps.getClusterIdentifier()
- Parameters:
clusterIdentifier
- An optional identifier for the cluster.- Returns:
this
-
copyTagsToSnapshot
@Stability(Stable) public DatabaseClusterProps.Builder copyTagsToSnapshot(Boolean copyTagsToSnapshot) Sets the value ofDatabaseClusterProps.getCopyTagsToSnapshot()
- Parameters:
copyTagsToSnapshot
- Whether to copy tags to the snapshot when a snapshot is created.- Returns:
this
-
credentials
Sets the value ofDatabaseClusterProps.getCredentials()
- Parameters:
credentials
- Credentials for the administrative user.- Returns:
this
-
defaultDatabaseName
@Stability(Stable) public DatabaseClusterProps.Builder defaultDatabaseName(String defaultDatabaseName) Sets the value ofDatabaseClusterProps.getDefaultDatabaseName()
- Parameters:
defaultDatabaseName
- Name of a database which is automatically created inside the cluster.- Returns:
this
-
deletionProtection
@Stability(Stable) public DatabaseClusterProps.Builder deletionProtection(Boolean deletionProtection) Sets the value ofDatabaseClusterProps.getDeletionProtection()
- Parameters:
deletionProtection
- Indicates whether the DB cluster should have deletion protection enabled.- Returns:
this
-
domain
Sets the value ofDatabaseClusterProps.getDomain()
- Parameters:
domain
- Directory ID for associating the DB cluster with a specific Active Directory. Necessary for enabling Kerberos authentication. If specified, the DB cluster joins the given Active Directory, enabling Kerberos authentication. If not specified, the DB cluster will not be associated with any Active Directory, and Kerberos authentication will not be enabled.- Returns:
this
-
domainRole
Sets the value ofDatabaseClusterProps.getDomainRole()
- Parameters:
domainRole
- The IAM role to be used when making API calls to the Directory Service. The role needs the AWS-managed policyAmazonRDSDirectoryServiceAccess
or equivalent.- Returns:
this
-
enableDataApi
Sets the value ofDatabaseClusterProps.getEnableDataApi()
- Parameters:
enableDataApi
- Whether to enable the Data API for the cluster.- Returns:
this
-
enableLocalWriteForwarding
@Stability(Stable) public DatabaseClusterProps.Builder enableLocalWriteForwarding(Boolean enableLocalWriteForwarding) Sets the value ofDatabaseClusterProps.getEnableLocalWriteForwarding()
- Parameters:
enableLocalWriteForwarding
- Whether read replicas can forward write operations to the writer DB instance in the DB cluster. This setting can only be enabled for Aurora MySQL 3.04 or higher, and for Aurora PostgreSQL 16.4 or higher (for version 16), 15.8 or higher (for version 15), and 14.13 or higher (for version 14).- Returns:
this
-
enablePerformanceInsights
@Stability(Stable) public DatabaseClusterProps.Builder enablePerformanceInsights(Boolean enablePerformanceInsights) Sets the value ofDatabaseClusterProps.getEnablePerformanceInsights()
- Parameters:
enablePerformanceInsights
- Whether to enable Performance Insights for the DB cluster.- Returns:
this
-
iamAuthentication
Sets the value ofDatabaseClusterProps.getIamAuthentication()
- Parameters:
iamAuthentication
- Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.- Returns:
this
-
instanceIdentifierBase
@Stability(Stable) public DatabaseClusterProps.Builder instanceIdentifierBase(String instanceIdentifierBase) Sets the value ofDatabaseClusterProps.getInstanceIdentifierBase()
- Parameters:
instanceIdentifierBase
- Base identifier for instances. Every replica is named by appending the replica number to this string, 1-based.- Returns:
this
-
instanceProps
@Stability(Deprecated) @Deprecated public DatabaseClusterProps.Builder instanceProps(InstanceProps instanceProps) Deprecated.- use writer and readers insteadSets the value ofDatabaseClusterProps.getInstanceProps()
- Parameters:
instanceProps
- Settings for the individual instances that are launched.- Returns:
this
-
instances
Deprecated.- use writer and readers insteadSets the value ofDatabaseClusterProps.getInstances()
- Parameters:
instances
- How many replicas/instances to create. Has to be at least 1.- Returns:
this
-
instanceUpdateBehaviour
@Stability(Stable) public DatabaseClusterProps.Builder instanceUpdateBehaviour(InstanceUpdateBehaviour instanceUpdateBehaviour) Sets the value ofDatabaseClusterProps.getInstanceUpdateBehaviour()
- Parameters:
instanceUpdateBehaviour
- The ordering of updates for instances.- Returns:
this
-
monitoringInterval
@Stability(Stable) public DatabaseClusterProps.Builder monitoringInterval(Duration monitoringInterval) Sets the value ofDatabaseClusterProps.getMonitoringInterval()
- Parameters:
monitoringInterval
- The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.- Returns:
this
-
monitoringRole
Sets the value ofDatabaseClusterProps.getMonitoringRole()
- Parameters:
monitoringRole
- Role that will be used to manage DB instances monitoring.- Returns:
this
-
networkType
Sets the value ofDatabaseClusterProps.getNetworkType()
- Parameters:
networkType
- The network type of the DB instance.- Returns:
this
-
parameterGroup
@Stability(Stable) public DatabaseClusterProps.Builder parameterGroup(IParameterGroup parameterGroup) Sets the value ofDatabaseClusterProps.getParameterGroup()
- Parameters:
parameterGroup
- Additional parameters to pass to the database engine.- Returns:
this
-
parameters
Sets the value ofDatabaseClusterProps.getParameters()
- Parameters:
parameters
- The parameters in the DBClusterParameterGroup to create automatically. You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBClusterParameterGroup.- Returns:
this
-
performanceInsightEncryptionKey
@Stability(Stable) public DatabaseClusterProps.Builder performanceInsightEncryptionKey(IKey performanceInsightEncryptionKey) Sets the value ofDatabaseClusterProps.getPerformanceInsightEncryptionKey()
- Parameters:
performanceInsightEncryptionKey
- The AWS KMS key for encryption of Performance Insights data.- Returns:
this
-
performanceInsightRetention
@Stability(Stable) public DatabaseClusterProps.Builder performanceInsightRetention(PerformanceInsightRetention performanceInsightRetention) Sets the value ofDatabaseClusterProps.getPerformanceInsightRetention()
- Parameters:
performanceInsightRetention
- The amount of time, in days, to retain Performance Insights data.- Returns:
this
-
port
Sets the value ofDatabaseClusterProps.getPort()
- Parameters:
port
- What port to listen on.- Returns:
this
-
preferredMaintenanceWindow
@Stability(Stable) public DatabaseClusterProps.Builder preferredMaintenanceWindow(String preferredMaintenanceWindow) Sets the value ofDatabaseClusterProps.getPreferredMaintenanceWindow()
- Parameters:
preferredMaintenanceWindow
- 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'- Returns:
this
-
readers
@Stability(Stable) public DatabaseClusterProps.Builder readers(List<? extends IClusterInstance> readers) Sets the value ofDatabaseClusterProps.getReaders()
- Parameters:
readers
- A list of instances to create as cluster reader instances.- Returns:
this
-
removalPolicy
Sets the value ofDatabaseClusterProps.getRemovalPolicy()
- Parameters:
removalPolicy
- The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.- Returns:
this
-
s3ExportBuckets
@Stability(Stable) public DatabaseClusterProps.Builder s3ExportBuckets(List<? extends IBucket> s3ExportBuckets) Sets the value ofDatabaseClusterProps.getS3ExportBuckets()
- Parameters:
s3ExportBuckets
- S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. This property must not be used ifs3ExportRole
is used.For MySQL:
- Returns:
this
-
s3ExportRole
Sets the value ofDatabaseClusterProps.getS3ExportRole()
- Parameters:
s3ExportRole
- Role that will be associated with this DB cluster to enable S3 export. This feature is only supported by the Aurora database engine.This property must not be used if
s3ExportBuckets
is used. To use this property with Aurora PostgreSQL, it must be configured with the S3 export feature enabled when creating the DatabaseClusterEngine For MySQL:- Returns:
this
-
s3ImportBuckets
@Stability(Stable) public DatabaseClusterProps.Builder s3ImportBuckets(List<? extends IBucket> s3ImportBuckets) Sets the value ofDatabaseClusterProps.getS3ImportBuckets()
- Parameters:
s3ImportBuckets
- S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. This property must not be used ifs3ImportRole
is used.For MySQL:
- Returns:
this
-
s3ImportRole
Sets the value ofDatabaseClusterProps.getS3ImportRole()
- Parameters:
s3ImportRole
- Role that will be associated with this DB cluster to enable S3 import. This feature is only supported by the Aurora database engine.This property must not be used if
s3ImportBuckets
is used. To use this property with Aurora PostgreSQL, it must be configured with the S3 import feature enabled when creating the DatabaseClusterEngine For MySQL:- Returns:
this
-
securityGroups
@Stability(Stable) public DatabaseClusterProps.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Sets the value ofDatabaseClusterProps.getSecurityGroups()
- Parameters:
securityGroups
- Security group.- Returns:
this
-
serverlessV2MaxCapacity
@Stability(Stable) public DatabaseClusterProps.Builder serverlessV2MaxCapacity(Number serverlessV2MaxCapacity) Sets the value ofDatabaseClusterProps.getServerlessV2MaxCapacity()
- Parameters:
serverlessV2MaxCapacity
- The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. You can specify ACU values in half-step increments, such as 40, 40.5, 41, and so on. The largest value that you can use is 256.The maximum capacity must be higher than 0.5 ACUs.
- Returns:
this
-
serverlessV2MinCapacity
@Stability(Stable) public DatabaseClusterProps.Builder serverlessV2MinCapacity(Number serverlessV2MinCapacity) Sets the value ofDatabaseClusterProps.getServerlessV2MinCapacity()
- Parameters:
serverlessV2MinCapacity
- The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. You can specify ACU values in half-step increments, such as 8, 8.5, 9, and so on. The smallest value that you can use is 0.5.- Returns:
this
-
storageEncrypted
Sets the value ofDatabaseClusterProps.getStorageEncrypted()
- Parameters:
storageEncrypted
- Whether to enable storage encryption.- Returns:
this
-
storageEncryptionKey
@Stability(Stable) public DatabaseClusterProps.Builder storageEncryptionKey(IKey storageEncryptionKey) Sets the value ofDatabaseClusterProps.getStorageEncryptionKey()
- Parameters:
storageEncryptionKey
- The KMS key for storage encryption. If specified,storageEncrypted
will be set totrue
.- Returns:
this
-
storageType
@Stability(Stable) public DatabaseClusterProps.Builder storageType(DBClusterStorageType storageType) Sets the value ofDatabaseClusterProps.getStorageType()
- Parameters:
storageType
- The storage type to be associated with the DB cluster.- Returns:
this
-
subnetGroup
Sets the value ofDatabaseClusterProps.getSubnetGroup()
- Parameters:
subnetGroup
- Existing subnet group for the cluster.- Returns:
this
-
vpc
Sets the value ofDatabaseClusterProps.getVpc()
- Parameters:
vpc
- What subnets to run the RDS instances in. Must be at least 2 subnets in two different AZs.- Returns:
this
-
vpcSubnets
Sets the value ofDatabaseClusterProps.getVpcSubnets()
- Parameters:
vpcSubnets
- Where to place the instances within the VPC.- Returns:
this
-
writer
Sets the value ofDatabaseClusterProps.getWriter()
- Parameters:
writer
- The instance to use for the cluster writer.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<DatabaseClusterProps>
- Returns:
- a new instance of
DatabaseClusterProps
- Throws:
NullPointerException
- if any required attribute was not provided
-