Class DatabaseCluster.Builder

java.lang.Object
software.amazon.awscdk.services.docdb.DatabaseCluster.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<DatabaseCluster>
Enclosing class:
DatabaseCluster

@Stability(Stable) public static final class DatabaseCluster.Builder extends Object implements software.amazon.jsii.Builder<DatabaseCluster>
A fluent builder for DatabaseCluster.
  • Method Details

    • create

      @Stability(Stable) public static DatabaseCluster.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of DatabaseCluster.Builder.
    • instanceType

      @Stability(Stable) public DatabaseCluster.Builder instanceType(InstanceType instanceType)
      What type of instance to start for the replicas.

      Parameters:
      instanceType - What type of instance to start for the replicas. This parameter is required.
      Returns:
      this
    • masterUser

      @Stability(Stable) public DatabaseCluster.Builder masterUser(Login masterUser)
      Username and password for the administrative user.

      Parameters:
      masterUser - Username and password for the administrative user. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Stable) public DatabaseCluster.Builder vpc(IVpc vpc)
      What subnets to run the DocumentDB instances in.

      Must be at least 2 subnets in two different AZs.

      Parameters:
      vpc - What subnets to run the DocumentDB instances in. This parameter is required.
      Returns:
      this
    • backup

      @Stability(Stable) public DatabaseCluster.Builder backup(BackupProps backup)
      Backup settings.

      Default: - Backup retention period for automated backups is 1 day. Backup preferred window is set to a 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week.

      Parameters:
      backup - Backup settings. This parameter is required.
      Returns:
      this
      See Also:
    • cloudWatchLogsRetention

      @Stability(Stable) public DatabaseCluster.Builder cloudWatchLogsRetention(RetentionDays 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 to Infinity.

      Default: - logs never expire

      Parameters:
      cloudWatchLogsRetention - The number of days log events are kept in CloudWatch Logs. This parameter is required.
      Returns:
      this
    • cloudWatchLogsRetentionRole

      @Stability(Stable) public DatabaseCluster.Builder cloudWatchLogsRetentionRole(IRole cloudWatchLogsRetentionRole)
      The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

      Default: - a new role is created.

      Parameters:
      cloudWatchLogsRetentionRole - The IAM role for the Lambda function associated with the custom resource that sets the retention policy. This parameter is required.
      Returns:
      this
    • dbClusterName

      @Stability(Stable) public DatabaseCluster.Builder dbClusterName(String dbClusterName)
      An optional identifier for the cluster.

      Default: - A name is automatically generated.

      Parameters:
      dbClusterName - An optional identifier for the cluster. This parameter is required.
      Returns:
      this
    • deletionProtection

      @Stability(Stable) public DatabaseCluster.Builder deletionProtection(Boolean deletionProtection)
      Specifies whether this cluster can be deleted.

      If deletionProtection is enabled, the cluster cannot be deleted unless it is modified and deletionProtection is disabled. deletionProtection protects clusters from being accidentally deleted.

      Default: - false

      Parameters:
      deletionProtection - Specifies whether this cluster can be deleted. This parameter is required.
      Returns:
      this
    • engineVersion

      @Stability(Stable) public DatabaseCluster.Builder engineVersion(String engineVersion)
      What version of the database to start.

      Default: - The default engine version.

      Parameters:
      engineVersion - What version of the database to start. This parameter is required.
      Returns:
      this
    • exportAuditLogsToCloudWatch

      @Stability(Stable) public DatabaseCluster.Builder exportAuditLogsToCloudWatch(Boolean exportAuditLogsToCloudWatch)
      Whether the audit logs should be exported to CloudWatch.

      Note that you also have to configure the audit log export in the Cluster's Parameter Group.

      Default: false

      Parameters:
      exportAuditLogsToCloudWatch - Whether the audit logs should be exported to CloudWatch. This parameter is required.
      Returns:
      this
      See Also:
    • exportProfilerLogsToCloudWatch

      @Stability(Stable) public DatabaseCluster.Builder exportProfilerLogsToCloudWatch(Boolean exportProfilerLogsToCloudWatch)
      Whether the profiler logs should be exported to CloudWatch.

      Note that you also have to configure the profiler log export in the Cluster's Parameter Group.

      Default: false

      Parameters:
      exportProfilerLogsToCloudWatch - Whether the profiler logs should be exported to CloudWatch. This parameter is required.
      Returns:
      this
      See Also:
    • instanceIdentifierBase

      @Stability(Stable) public DatabaseCluster.Builder instanceIdentifierBase(String instanceIdentifierBase)
      Base identifier for instances.

      Every replica is named by appending the replica number to this string, 1-based.

      Default: - `dbClusterName` is used with the word "Instance" appended. If `dbClusterName` is not provided, the identifier is automatically generated.

      Parameters:
      instanceIdentifierBase - Base identifier for instances. This parameter is required.
      Returns:
      this
    • instances

      @Stability(Stable) public DatabaseCluster.Builder instances(Number instances)
      Number of DocDB compute instances.

      Default: 1

      Parameters:
      instances - Number of DocDB compute instances. This parameter is required.
      Returns:
      this
    • kmsKey

      @Stability(Stable) public DatabaseCluster.Builder kmsKey(IKey kmsKey)
      The KMS key for storage encryption.

      Default: - default master key.

      Parameters:
      kmsKey - The KMS key for storage encryption. This parameter is required.
      Returns:
      this
    • parameterGroup

      @Stability(Stable) public DatabaseCluster.Builder parameterGroup(IClusterParameterGroup parameterGroup)
      The DB parameter group to associate with the instance.

      Default: no parameter group

      Parameters:
      parameterGroup - The DB parameter group to associate with the instance. This parameter is required.
      Returns:
      this
    • port

      @Stability(Stable) public DatabaseCluster.Builder port(Number port)
      The port the DocumentDB cluster will listen on.

      Default: DatabaseCluster.DEFAULT_PORT

      Parameters:
      port - The port the DocumentDB cluster will listen on. This parameter is required.
      Returns:
      this
    • preferredMaintenanceWindow

      @Stability(Stable) public DatabaseCluster.Builder preferredMaintenanceWindow(String preferredMaintenanceWindow)
      A weekly time range in which maintenance should preferably execute.

      Must be at least 30 minutes long.

      Example: 'tue:04:17-tue:04:47'

      Default: - 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week.

      Parameters:
      preferredMaintenanceWindow - A weekly time range in which maintenance should preferably execute. This parameter is required.
      Returns:
      this
      See Also:
    • removalPolicy

      @Stability(Stable) public DatabaseCluster.Builder removalPolicy(RemovalPolicy removalPolicy)
      The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted.

      This removal policy also applies to the implicit security group created for the cluster if one is not supplied as a parameter.

      Default: - Retain cluster.

      Parameters:
      removalPolicy - The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted. This parameter is required.
      Returns:
      this
    • securityGroup

      @Stability(Stable) public DatabaseCluster.Builder securityGroup(ISecurityGroup securityGroup)
      Security group.

      Default: a new security group is created.

      Parameters:
      securityGroup - Security group. This parameter is required.
      Returns:
      this
    • storageEncrypted

      @Stability(Stable) public DatabaseCluster.Builder storageEncrypted(Boolean storageEncrypted)
      Whether to enable storage encryption.

      Default: true

      Parameters:
      storageEncrypted - Whether to enable storage encryption. This parameter is required.
      Returns:
      this
    • vpcSubnets

      @Stability(Stable) public DatabaseCluster.Builder vpcSubnets(SubnetSelection vpcSubnets)
      Where to place the instances within the VPC.

      Default: private subnets

      Parameters:
      vpcSubnets - Where to place the instances within the VPC. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public DatabaseCluster build()
      Specified by:
      build in interface software.amazon.jsii.Builder<DatabaseCluster>
      Returns:
      a newly built instance of DatabaseCluster.