All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.digitalocean.kotlin.DatabaseConnectionPoolArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.digitalocean.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.digitalocean.DatabaseConnectionPoolArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Provides a DigitalOcean database connection pool resource.
 * ## Example Usage
 * ### Create a new PostgreSQL database connection pool
 * 
 * ```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,
 * });
 * const pool_01 = new digitalocean.DatabaseConnectionPool("pool-01", {
 *     clusterId: postgres_example.id,
 *     name: "pool-01",
 *     mode: "transaction",
 *     size: 20,
 *     dbName: "defaultdb",
 *     user: "doadmin",
 * });
 * ```
 * ```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)
 * pool_01 = digitalocean.DatabaseConnectionPool("pool-01",
 *     cluster_id=postgres_example.id,
 *     name="pool-01",
 *     mode="transaction",
 *     size=20,
 *     db_name="defaultdb",
 *     user="doadmin")
 * ```
 * ```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,
 *     });
 *     var pool_01 = new DigitalOcean.DatabaseConnectionPool("pool-01", new()
 *     {
 *         ClusterId = postgres_example.Id,
 *         Name = "pool-01",
 *         Mode = "transaction",
 *         Size = 20,
 *         DbName = "defaultdb",
 *         User = "doadmin",
 *     });
 * });
 * ```
 * ```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
 * 		}
 * 		_, err = digitalocean.NewDatabaseConnectionPool(ctx, "pool-01", &digitalocean.DatabaseConnectionPoolArgs{
 * 			ClusterId: postgres_example.ID(),
 * 			Name:      pulumi.String("pool-01"),
 * 			Mode:      pulumi.String("transaction"),
 * 			Size:      pulumi.Int(20),
 * 			DbName:    pulumi.String("defaultdb"),
 * 			User:      pulumi.String("doadmin"),
 * 		})
 * 		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.DatabaseConnectionPool;
 * import com.pulumi.digitalocean.DatabaseConnectionPoolArgs;
 * 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());
 *         var pool_01 = new DatabaseConnectionPool("pool-01", DatabaseConnectionPoolArgs.builder()
 *             .clusterId(postgres_example.id())
 *             .name("pool-01")
 *             .mode("transaction")
 *             .size(20)
 *             .dbName("defaultdb")
 *             .user("doadmin")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   pool-01:
 *     type: digitalocean:DatabaseConnectionPool
 *     properties:
 *       clusterId: ${["postgres-example"].id}
 *       name: pool-01
 *       mode: transaction
 *       size: 20
 *       dbName: defaultdb
 *       user: doadmin
 *   postgres-example:
 *     type: digitalocean:DatabaseCluster
 *     properties:
 *       name: example-postgres-cluster
 *       engine: pg
 *       version: '15'
 *       size: db-s-1vcpu-1gb
 *       region: nyc1
 *       nodeCount: 1
 * ```
 * 
 * ## Import
 * Database connection pools can be imported using the `id` of the source database cluster
 * and the `name` of the connection pool joined with a comma. For example:
 * ```sh
 * $ pulumi import digitalocean:index/databaseConnectionPool:DatabaseConnectionPool pool-01 245bcfd0-7f31-4ce6-a2bc-475a116cca97,pool-01
 * ```
 * @property clusterId The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
 * @property dbName The database for use with the connection pool.
 * @property mode The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
 * @property name The name for the database connection pool.
 * @property size The desired size of the PGBouncer connection pool.
 * @property user The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
 */
public data class DatabaseConnectionPoolArgs(
    public val clusterId: Output? = null,
    public val dbName: Output? = null,
    public val mode: Output? = null,
    public val name: Output? = null,
    public val size: Output? = null,
    public val user: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.digitalocean.DatabaseConnectionPoolArgs =
        com.pulumi.digitalocean.DatabaseConnectionPoolArgs.builder()
            .clusterId(clusterId?.applyValue({ args0 -> args0 }))
            .dbName(dbName?.applyValue({ args0 -> args0 }))
            .mode(mode?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .size(size?.applyValue({ args0 -> args0 }))
            .user(user?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [DatabaseConnectionPoolArgs].
 */
@PulumiTagMarker
public class DatabaseConnectionPoolArgsBuilder internal constructor() {
    private var clusterId: Output? = null

    private var dbName: Output? = null

    private var mode: Output? = null

    private var name: Output? = null

    private var size: Output? = null

    private var user: Output? = null

    /**
     * @param value The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
     */
    @JvmName("yobewjqggckdxime")
    public suspend fun clusterId(`value`: Output) {
        this.clusterId = value
    }

    /**
     * @param value The database for use with the connection pool.
     */
    @JvmName("yiihyrsjjynnrkwn")
    public suspend fun dbName(`value`: Output) {
        this.dbName = value
    }

    /**
     * @param value The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
     */
    @JvmName("evcksmkifvcbjeef")
    public suspend fun mode(`value`: Output) {
        this.mode = value
    }

    /**
     * @param value The name for the database connection pool.
     */
    @JvmName("igfhcfoedyqfdhtr")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The desired size of the PGBouncer connection pool.
     */
    @JvmName("pdibpixwideexwsy")
    public suspend fun size(`value`: Output) {
        this.size = value
    }

    /**
     * @param value The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
     */
    @JvmName("mofxvccrvqdyseuj")
    public suspend fun user(`value`: Output) {
        this.user = value
    }

    /**
     * @param value The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
     */
    @JvmName("ncaholeyubsohinf")
    public suspend fun clusterId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.clusterId = mapped
    }

    /**
     * @param value The database for use with the connection pool.
     */
    @JvmName("ioiftdcafwfvtdpq")
    public suspend fun dbName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dbName = mapped
    }

    /**
     * @param value The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
     */
    @JvmName("cjywoquxylscliyg")
    public suspend fun mode(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.mode = mapped
    }

    /**
     * @param value The name for the database connection pool.
     */
    @JvmName("serihmhdvwcjxevo")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The desired size of the PGBouncer connection pool.
     */
    @JvmName("diryehnxyyyttptc")
    public suspend fun size(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.size = mapped
    }

    /**
     * @param value The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
     */
    @JvmName("aixtcqeqdtvjxoyh")
    public suspend fun user(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.user = mapped
    }

    internal fun build(): DatabaseConnectionPoolArgs = DatabaseConnectionPoolArgs(
        clusterId = clusterId,
        dbName = dbName,
        mode = mode,
        name = name,
        size = size,
        user = user,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy