com.pulumi.digitalocean.kotlin.DatabaseCluster.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-digitalocean-kotlin Show documentation
Show all versions of pulumi-digitalocean-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.digitalocean.kotlin
import com.pulumi.core.Output
import com.pulumi.digitalocean.kotlin.outputs.DatabaseClusterBackupRestore
import com.pulumi.digitalocean.kotlin.outputs.DatabaseClusterMaintenanceWindow
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.digitalocean.kotlin.outputs.DatabaseClusterBackupRestore.Companion.toKotlin as databaseClusterBackupRestoreToKotlin
import com.pulumi.digitalocean.kotlin.outputs.DatabaseClusterMaintenanceWindow.Companion.toKotlin as databaseClusterMaintenanceWindowToKotlin
/**
* Builder for [DatabaseCluster].
*/
@PulumiTagMarker
public class DatabaseClusterResourceBuilder internal constructor() {
public var name: String? = null
public var args: DatabaseClusterArgs = DatabaseClusterArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend DatabaseClusterArgsBuilder.() -> Unit) {
val builder = DatabaseClusterArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): DatabaseCluster {
val builtJavaResource = com.pulumi.digitalocean.DatabaseCluster(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return DatabaseCluster(builtJavaResource)
}
}
/**
* Provides a DigitalOcean database cluster resource.
* ## Example Usage
* ### Create a new PostgreSQL database cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
* name: "example-postgres-cluster",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* postgres_example = digitalocean.DatabaseCluster("postgres-example",
* name="example-postgres-cluster",
* engine="pg",
* version="15",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
* region=digitalocean.Region.NYC1,
* node_count=1)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
* {
* Name = "example-postgres-cluster",
* Engine = "pg",
* Version = "15",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 1,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("example-postgres-cluster"),
* Engine: pulumi.String("pg"),
* Version: pulumi.String("15"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()
* .name("example-postgres-cluster")
* .engine("pg")
* .version("15")
* .size("db-s-1vcpu-1gb")
* .region("nyc1")
* .nodeCount(1)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* postgres-example:
* type: digitalocean:DatabaseCluster
* properties:
* name: example-postgres-cluster
* engine: pg
* version: '15'
* size: db-s-1vcpu-1gb
* region: nyc1
* nodeCount: 1
* ```
*
* ### Create a new MySQL database cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const mysql_example = new digitalocean.DatabaseCluster("mysql-example", {
* name: "example-mysql-cluster",
* engine: "mysql",
* version: "8",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* mysql_example = digitalocean.DatabaseCluster("mysql-example",
* name="example-mysql-cluster",
* engine="mysql",
* version="8",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
* region=digitalocean.Region.NYC1,
* node_count=1)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var mysql_example = new DigitalOcean.DatabaseCluster("mysql-example", new()
* {
* Name = "example-mysql-cluster",
* Engine = "mysql",
* Version = "8",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 1,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewDatabaseCluster(ctx, "mysql-example", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("example-mysql-cluster"),
* Engine: pulumi.String("mysql"),
* Version: pulumi.String("8"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var mysql_example = new DatabaseCluster("mysql-example", DatabaseClusterArgs.builder()
* .name("example-mysql-cluster")
* .engine("mysql")
* .version("8")
* .size("db-s-1vcpu-1gb")
* .region("nyc1")
* .nodeCount(1)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* mysql-example:
* type: digitalocean:DatabaseCluster
* properties:
* name: example-mysql-cluster
* engine: mysql
* version: '8'
* size: db-s-1vcpu-1gb
* region: nyc1
* nodeCount: 1
* ```
*
* ### Create a new Redis database cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const redis_example = new digitalocean.DatabaseCluster("redis-example", {
* name: "example-redis-cluster",
* engine: "redis",
* version: "7",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* redis_example = digitalocean.DatabaseCluster("redis-example",
* name="example-redis-cluster",
* engine="redis",
* version="7",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
* region=digitalocean.Region.NYC1,
* node_count=1)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var redis_example = new DigitalOcean.DatabaseCluster("redis-example", new()
* {
* Name = "example-redis-cluster",
* Engine = "redis",
* Version = "7",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 1,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewDatabaseCluster(ctx, "redis-example", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("example-redis-cluster"),
* Engine: pulumi.String("redis"),
* Version: pulumi.String("7"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var redis_example = new DatabaseCluster("redis-example", DatabaseClusterArgs.builder()
* .name("example-redis-cluster")
* .engine("redis")
* .version("7")
* .size("db-s-1vcpu-1gb")
* .region("nyc1")
* .nodeCount(1)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* redis-example:
* type: digitalocean:DatabaseCluster
* properties:
* name: example-redis-cluster
* engine: redis
* version: '7'
* size: db-s-1vcpu-1gb
* region: nyc1
* nodeCount: 1
* ```
*
* ### Create a new Kafka database cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const kafka_example = new digitalocean.DatabaseCluster("kafka-example", {
* name: "example-kafka-cluster",
* engine: "kafka",
* version: "3.5",
* size: "db-s-2vcpu-2gb",
* region: digitalocean.Region.NYC1,
* nodeCount: 3,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* kafka_example = digitalocean.DatabaseCluster("kafka-example",
* name="example-kafka-cluster",
* engine="kafka",
* version="3.5",
* size="db-s-2vcpu-2gb",
* region=digitalocean.Region.NYC1,
* node_count=3)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var kafka_example = new DigitalOcean.DatabaseCluster("kafka-example", new()
* {
* Name = "example-kafka-cluster",
* Engine = "kafka",
* Version = "3.5",
* Size = "db-s-2vcpu-2gb",
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 3,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewDatabaseCluster(ctx, "kafka-example", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("example-kafka-cluster"),
* Engine: pulumi.String("kafka"),
* Version: pulumi.String("3.5"),
* Size: pulumi.String("db-s-2vcpu-2gb"),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(3),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var kafka_example = new DatabaseCluster("kafka-example", DatabaseClusterArgs.builder()
* .name("example-kafka-cluster")
* .engine("kafka")
* .version("3.5")
* .size("db-s-2vcpu-2gb")
* .region("nyc1")
* .nodeCount(3)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* kafka-example:
* type: digitalocean:DatabaseCluster
* properties:
* name: example-kafka-cluster
* engine: kafka
* version: '3.5'
* size: db-s-2vcpu-2gb
* region: nyc1
* nodeCount: 3
* ```
*
* ### Create a new MongoDB database cluster
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const mongodb_example = new digitalocean.DatabaseCluster("mongodb-example", {
* name: "example-mongo-cluster",
* engine: "mongodb",
* version: "6",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC3,
* nodeCount: 1,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* mongodb_example = digitalocean.DatabaseCluster("mongodb-example",
* name="example-mongo-cluster",
* engine="mongodb",
* version="6",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
* region=digitalocean.Region.NYC3,
* node_count=1)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var mongodb_example = new DigitalOcean.DatabaseCluster("mongodb-example", new()
* {
* Name = "example-mongo-cluster",
* Engine = "mongodb",
* Version = "6",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
* Region = DigitalOcean.Region.NYC3,
* NodeCount = 1,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := digitalocean.NewDatabaseCluster(ctx, "mongodb-example", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("example-mongo-cluster"),
* Engine: pulumi.String("mongodb"),
* Version: pulumi.String("6"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
* Region: pulumi.String(digitalocean.RegionNYC3),
* NodeCount: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var mongodb_example = new DatabaseCluster("mongodb-example", DatabaseClusterArgs.builder()
* .name("example-mongo-cluster")
* .engine("mongodb")
* .version("6")
* .size("db-s-1vcpu-1gb")
* .region("nyc3")
* .nodeCount(1)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* mongodb-example:
* type: digitalocean:DatabaseCluster
* properties:
* name: example-mongo-cluster
* engine: mongodb
* version: '6'
* size: db-s-1vcpu-1gb
* region: nyc3
* nodeCount: 1
* ```
*
* ## Create a new database cluster based on a backup of an existing cluster.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const doby = new digitalocean.DatabaseCluster("doby", {
* name: "dobydb",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU2GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* tags: ["production"],
* });
* const dobyBackup = new digitalocean.DatabaseCluster("doby_backup", {
* name: "dobydupe",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU2GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* tags: ["production"],
* backupRestore: {
* databaseName: "dobydb",
* },
* }, {
* dependsOn: [doby],
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* doby = digitalocean.DatabaseCluster("doby",
* name="dobydb",
* engine="pg",
* version="15",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU2_GB,
* region=digitalocean.Region.NYC1,
* node_count=1,
* tags=["production"])
* doby_backup = digitalocean.DatabaseCluster("doby_backup",
* name="dobydupe",
* engine="pg",
* version="15",
* size=digitalocean.DatabaseSlug.D_B_1_VPCU2_GB,
* region=digitalocean.Region.NYC1,
* node_count=1,
* tags=["production"],
* backup_restore={
* "database_name": "dobydb",
* },
* opts = pulumi.ResourceOptions(depends_on=[doby]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var doby = new DigitalOcean.DatabaseCluster("doby", new()
* {
* Name = "dobydb",
* Engine = "pg",
* Version = "15",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU2GB,
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 1,
* Tags = new[]
* {
* "production",
* },
* });
* var dobyBackup = new DigitalOcean.DatabaseCluster("doby_backup", new()
* {
* Name = "dobydupe",
* Engine = "pg",
* Version = "15",
* Size = DigitalOcean.DatabaseSlug.DB_1VPCU2GB,
* Region = DigitalOcean.Region.NYC1,
* NodeCount = 1,
* Tags = new[]
* {
* "production",
* },
* BackupRestore = new DigitalOcean.Inputs.DatabaseClusterBackupRestoreArgs
* {
* DatabaseName = "dobydb",
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* doby,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* doby, err := digitalocean.NewDatabaseCluster(ctx, "doby", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("dobydb"),
* Engine: pulumi.String("pg"),
* Version: pulumi.String("15"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU2GB),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(1),
* Tags: pulumi.StringArray{
* pulumi.String("production"),
* },
* })
* if err != nil {
* return err
* }
* _, err = digitalocean.NewDatabaseCluster(ctx, "doby_backup", &digitalocean.DatabaseClusterArgs{
* Name: pulumi.String("dobydupe"),
* Engine: pulumi.String("pg"),
* Version: pulumi.String("15"),
* Size: pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU2GB),
* Region: pulumi.String(digitalocean.RegionNYC1),
* NodeCount: pulumi.Int(1),
* Tags: pulumi.StringArray{
* pulumi.String("production"),
* },
* BackupRestore: &digitalocean.DatabaseClusterBackupRestoreArgs{
* DatabaseName: pulumi.String("dobydb"),
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* doby,
* }))
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.digitalocean.DatabaseCluster;
* import com.pulumi.digitalocean.DatabaseClusterArgs;
* import com.pulumi.digitalocean.inputs.DatabaseClusterBackupRestoreArgs;
* import com.pulumi.resources.CustomResourceOptions;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var doby = new DatabaseCluster("doby", DatabaseClusterArgs.builder()
* .name("dobydb")
* .engine("pg")
* .version("15")
* .size("db-s-1vcpu-2gb")
* .region("nyc1")
* .nodeCount(1)
* .tags("production")
* .build());
* var dobyBackup = new DatabaseCluster("dobyBackup", DatabaseClusterArgs.builder()
* .name("dobydupe")
* .engine("pg")
* .version("15")
* .size("db-s-1vcpu-2gb")
* .region("nyc1")
* .nodeCount(1)
* .tags("production")
* .backupRestore(DatabaseClusterBackupRestoreArgs.builder()
* .databaseName("dobydb")
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(doby)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* doby:
* type: digitalocean:DatabaseCluster
* properties:
* name: dobydb
* engine: pg
* version: '15'
* size: db-s-1vcpu-2gb
* region: nyc1
* nodeCount: 1
* tags:
* - production
* dobyBackup:
* type: digitalocean:DatabaseCluster
* name: doby_backup
* properties:
* name: dobydupe
* engine: pg
* version: '15'
* size: db-s-1vcpu-2gb
* region: nyc1
* nodeCount: 1
* tags:
* - production
* backupRestore:
* databaseName: dobydb
* options:
* dependson:
* - ${doby}
* ```
*
* ## Import
* Database clusters can be imported using the `id` returned from DigitalOcean, e.g.
* ```sh
* $ pulumi import digitalocean:index/databaseCluster:DatabaseCluster mycluster 245bcfd0-7f31-4ce6-a2bc-475a116cca97
* ```
*/
public class DatabaseCluster internal constructor(
override val javaResource: com.pulumi.digitalocean.DatabaseCluster,
) : KotlinCustomResource(javaResource, DatabaseClusterMapper) {
public val backupRestore: Output?
get() = javaResource.backupRestore().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> databaseClusterBackupRestoreToKotlin(args0) })
}).orElse(null)
})
/**
* The uniform resource name of the database cluster.
*/
public val clusterUrn: Output
get() = javaResource.clusterUrn().applyValue({ args0 -> args0 })
/**
* Name of the cluster's default database.
*/
public val database: Output
get() = javaResource.database().applyValue({ args0 -> args0 })
/**
* Database engine used by the cluster (ex. `pg` for PostreSQL, `mysql` for MySQL, `redis` for Redis, `mongodb` for MongoDB, or `kafka` for Kafka).
*/
public val engine: Output
get() = javaResource.engine().applyValue({ args0 -> args0 })
/**
* A string specifying the eviction policy for a Redis cluster. Valid values are: `noeviction`, `allkeys_lru`, `allkeys_random`, `volatile_lru`, `volatile_random`, or `volatile_ttl`.
*/
public val evictionPolicy: Output?
get() = javaResource.evictionPolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Database cluster's hostname.
*/
public val host: Output
get() = javaResource.host().applyValue({ args0 -> args0 })
/**
* Defines when the automatic maintenance should be performed for the database cluster.
*/
public val maintenanceWindows: Output>?
get() = javaResource.maintenanceWindows().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
databaseClusterMaintenanceWindowToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The name of the database cluster.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Number of nodes that will be included in the cluster. For `kafka` clusters, this must be 3.
*/
public val nodeCount: Output
get() = javaResource.nodeCount().applyValue({ args0 -> args0 })
/**
* Password for the cluster's default user.
*/
public val password: Output
get() = javaResource.password().applyValue({ args0 -> args0 })
/**
* Network port that the database cluster is listening on.
*/
public val port: Output
get() = javaResource.port().applyValue({ args0 -> args0 })
/**
* Same as `host`, but only accessible from resources within the account and in the same region.
*/
public val privateHost: Output
get() = javaResource.privateHost().applyValue({ args0 -> args0 })
/**
* The ID of the VPC where the database cluster will be located.
*/
public val privateNetworkUuid: Output
get() = javaResource.privateNetworkUuid().applyValue({ args0 -> args0 })
/**
* Same as `uri`, but only accessible from resources within the account and in the same region.
*/
public val privateUri: Output
get() = javaResource.privateUri().applyValue({ args0 -> args0 })
/**
* The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project.
*/
public val projectId: Output
get() = javaResource.projectId().applyValue({ args0 -> args0 })
/**
* DigitalOcean region where the cluster will reside.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* Database Droplet size associated with the cluster (ex. `db-s-1vcpu-1gb`). See here for a [list of valid size slugs](https://docs.digitalocean.com/reference/api/api-reference/#tag/Databases).
*/
public val size: Output
get() = javaResource.size().applyValue({ args0 -> args0 })
/**
* A comma separated string specifying the SQL modes for a MySQL cluster.
*/
public val sqlMode: Output?
get() = javaResource.sqlMode().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Defines the disk size, in MiB, allocated to the cluster. This can be adjusted on MySQL and PostreSQL clusters based on predefined ranges for each slug/droplet size.
*/
public val storageSizeMib: Output
get() = javaResource.storageSizeMib().applyValue({ args0 -> args0 })
/**
* A list of tag names to be applied to the database cluster.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* Name of the OpenSearch dashboard db.
*/
public val uiDatabase: Output
get() = javaResource.uiDatabase().applyValue({ args0 -> args0 })
/**
* Hostname for the OpenSearch dashboard.
*/
public val uiHost: Output
get() = javaResource.uiHost().applyValue({ args0 -> args0 })
/**
* Password for the OpenSearch dashboard's default user.
*/
public val uiPassword: Output
get() = javaResource.uiPassword().applyValue({ args0 -> args0 })
/**
* Network port that the OpenSearch dashboard is listening on.
*/
public val uiPort: Output
get() = javaResource.uiPort().applyValue({ args0 -> args0 })
/**
* The full URI for connecting to the OpenSearch dashboard.
*/
public val uiUri: Output
get() = javaResource.uiUri().applyValue({ args0 -> args0 })
/**
* Username for OpenSearch dashboard's default user.
*/
public val uiUser: Output
get() = javaResource.uiUser().applyValue({ args0 -> args0 })
/**
* The full URI for connecting to the database cluster.
*/
public val uri: Output
get() = javaResource.uri().applyValue({ args0 -> args0 })
/**
* Username for the cluster's default user.
*/
public val user: Output
get() = javaResource.user().applyValue({ args0 -> args0 })
/**
* Engine version used by the cluster (ex. `14` for PostgreSQL 14).
* When this value is changed, a call to the [Upgrade major Version for a Database](https://docs.digitalocean.com/reference/api/api-reference/#operation/databases_update_major_version) API operation is made with the new version.
*/
public val version: Output?
get() = javaResource.version().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object DatabaseClusterMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.DatabaseCluster::class == javaResource::class
override fun map(javaResource: Resource): DatabaseCluster = DatabaseCluster(
javaResource as
com.pulumi.digitalocean.DatabaseCluster,
)
}
/**
* @see [DatabaseCluster].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [DatabaseCluster].
*/
public suspend fun databaseCluster(
name: String,
block: suspend DatabaseClusterResourceBuilder.() -> Unit,
): DatabaseCluster {
val builder = DatabaseClusterResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [DatabaseCluster].
* @param name The _unique_ name of the resulting resource.
*/
public fun databaseCluster(name: String): DatabaseCluster {
val builder = DatabaseClusterResourceBuilder()
builder.name(name)
return builder.build()
}