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

com.pulumi.azure.cosmosdb.kotlin.PostgresqlCluster.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.kotlin.outputs.PostgresqlClusterMaintenanceWindow
import com.pulumi.azure.cosmosdb.kotlin.outputs.PostgresqlClusterServer
import com.pulumi.core.Output
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 kotlin.collections.Map
import com.pulumi.azure.cosmosdb.kotlin.outputs.PostgresqlClusterMaintenanceWindow.Companion.toKotlin as postgresqlClusterMaintenanceWindowToKotlin
import com.pulumi.azure.cosmosdb.kotlin.outputs.PostgresqlClusterServer.Companion.toKotlin as postgresqlClusterServerToKotlin

/**
 * Builder for [PostgresqlCluster].
 */
@PulumiTagMarker
public class PostgresqlClusterResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: PostgresqlClusterArgs = PostgresqlClusterArgs()

    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 PostgresqlClusterArgsBuilder.() -> Unit) {
        val builder = PostgresqlClusterArgsBuilder()
        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(): PostgresqlCluster {
        val builtJavaResource = com.pulumi.azure.cosmosdb.PostgresqlCluster(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return PostgresqlCluster(builtJavaResource)
    }
}

/**
 * Manages an Azure Cosmos DB for PostgreSQL Cluster.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const examplePostgresqlCluster = new azure.cosmosdb.PostgresqlCluster("example", {
 *     name: "example-cluster",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     administratorLoginPassword: "H@Sh1CoR3!",
 *     coordinatorStorageQuotaInMb: 131072,
 *     coordinatorVcoreCount: 2,
 *     nodeCount: 0,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_postgresql_cluster = azure.cosmosdb.PostgresqlCluster("example",
 *     name="example-cluster",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     administrator_login_password="H@Sh1CoR3!",
 *     coordinator_storage_quota_in_mb=131072,
 *     coordinator_vcore_count=2,
 *     node_count=0)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var examplePostgresqlCluster = new Azure.CosmosDB.PostgresqlCluster("example", new()
 *     {
 *         Name = "example-cluster",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AdministratorLoginPassword = "H@Sh1CoR3!",
 *         CoordinatorStorageQuotaInMb = 131072,
 *         CoordinatorVcoreCount = 2,
 *         NodeCount = 0,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cosmosdb"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cosmosdb.NewPostgresqlCluster(ctx, "example", &cosmosdb.PostgresqlClusterArgs{
 * 			Name:                        pulumi.String("example-cluster"),
 * 			ResourceGroupName:           example.Name,
 * 			Location:                    example.Location,
 * 			AdministratorLoginPassword:  pulumi.String("H@Sh1CoR3!"),
 * 			CoordinatorStorageQuotaInMb: pulumi.Int(131072),
 * 			CoordinatorVcoreCount:       pulumi.Int(2),
 * 			NodeCount:                   pulumi.Int(0),
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.cosmosdb.PostgresqlCluster;
 * import com.pulumi.azure.cosmosdb.PostgresqlClusterArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var examplePostgresqlCluster = new PostgresqlCluster("examplePostgresqlCluster", PostgresqlClusterArgs.builder()
 *             .name("example-cluster")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .administratorLoginPassword("H@Sh1CoR3!")
 *             .coordinatorStorageQuotaInMb(131072)
 *             .coordinatorVcoreCount(2)
 *             .nodeCount(0)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   examplePostgresqlCluster:
 *     type: azure:cosmosdb:PostgresqlCluster
 *     name: example
 *     properties:
 *       name: example-cluster
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       administratorLoginPassword: H@Sh1CoR3!
 *       coordinatorStorageQuotaInMb: 131072
 *       coordinatorVcoreCount: 2
 *       nodeCount: 0
 * ```
 * 
 * ## Import
 * Azure Cosmos DB for PostgreSQL Clusters can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/postgresqlCluster:PostgresqlCluster example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/cluster1
 * ```
 */
public class PostgresqlCluster internal constructor(
    override val javaResource: com.pulumi.azure.cosmosdb.PostgresqlCluster,
) : KotlinCustomResource(javaResource, PostgresqlClusterMapper) {
    /**
     * The password of the administrator login. This is required when `source_resource_id` is not set.
     */
    public val administratorLoginPassword: Output?
        get() = javaResource.administratorLoginPassword().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The citus extension version on the Azure Cosmos DB for PostgreSQL Cluster. Possible values are `8.3`, `9.0`, `9.1`, `9.2`, `9.3`, `9.4`, `9.5`, `10.0`, `10.1`, `10.2`, `11.0`, `11.1`, `11.2`, `11.3` and `12.1`.
     */
    public val citusVersion: Output
        get() = javaResource.citusVersion().applyValue({ args0 -> args0 })

    /**
     * Is public access enabled on coordinator? Defaults to `true`.
     */
    public val coordinatorPublicIpAccessEnabled: Output?
        get() = javaResource.coordinatorPublicIpAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The edition of the coordinator server. Possible values are `BurstableGeneralPurpose`, `BurstableMemoryOptimized`, `GeneralPurpose` and `MemoryOptimized`. Defaults to `GeneralPurpose`.
     */
    public val coordinatorServerEdition: Output?
        get() = javaResource.coordinatorServerEdition().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The coordinator storage allowed for the Azure Cosmos DB for PostgreSQL Cluster. Possible values are `32768`, `65536`, `131072`, `262144`, `524288`, `1048576`, `2097152`, `4194304`, `8388608`, `16777216`, and `33554432`.
     * > **NOTE:** More information on [the types of compute resources available for CosmosDB can be found in the product documentation](https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute)
     */
    public val coordinatorStorageQuotaInMb: Output?
        get() = javaResource.coordinatorStorageQuotaInMb().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The coordinator vCore count for the Azure Cosmos DB for PostgreSQL Cluster. Possible values are `1`, `2`, `4`, `8`, `16`, `32`, `64` and `96`.
     */
    public val coordinatorVcoreCount: Output?
        get() = javaResource.coordinatorVcoreCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The earliest restore point time (ISO8601 format) for the Azure Cosmos DB for PostgreSQL Cluster.
     */
    public val earliestRestoreTime: Output
        get() = javaResource.earliestRestoreTime().applyValue({ args0 -> args0 })

    /**
     * Is high availability enabled for the Azure Cosmos DB for PostgreSQL cluster? Defaults to `false`.
     */
    public val haEnabled: Output?
        get() = javaResource.haEnabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Azure Region where the Azure Cosmos DB for PostgreSQL Cluster should exist. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A `maintenance_window` block as defined below.
     */
    public val maintenanceWindow: Output?
        get() = javaResource.maintenanceWindow().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> postgresqlClusterMaintenanceWindowToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The name which should be used for this Azure Cosmos DB for PostgreSQL Cluster. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The worker node count of the Azure Cosmos DB for PostgreSQL Cluster. Possible value is between `0` and `20` except `1`.
     */
    public val nodeCount: Output
        get() = javaResource.nodeCount().applyValue({ args0 -> args0 })

    /**
     * Is public access enabled on worker nodes. Defaults to `false`.
     */
    public val nodePublicIpAccessEnabled: Output?
        get() = javaResource.nodePublicIpAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The edition of the node server. Possible values are `BurstableGeneralPurpose`, `BurstableMemoryOptimized`, `GeneralPurpose` and `MemoryOptimized`. Defaults to `MemoryOptimized`.
     */
    public val nodeServerEdition: Output?
        get() = javaResource.nodeServerEdition().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The storage quota in MB on each worker node. Possible values are `32768`, `65536`, `131072`, `262144`, `524288`, `1048576`, `2097152`, `4194304`, `8388608` and `16777216`.
     */
    public val nodeStorageQuotaInMb: Output
        get() = javaResource.nodeStorageQuotaInMb().applyValue({ args0 -> args0 })

    /**
     * The vCores count on each worker node. Possible values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `96` and `104`.
     */
    public val nodeVcores: Output
        get() = javaResource.nodeVcores().applyValue({ args0 -> args0 })

    /**
     * The date and time in UTC (ISO8601 format) for the Azure Cosmos DB for PostgreSQL cluster restore. Changing this forces a new resource to be created.
     */
    public val pointInTimeInUtc: Output?
        get() = javaResource.pointInTimeInUtc().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The preferred primary availability zone for the Azure Cosmos DB for PostgreSQL cluster.
     */
    public val preferredPrimaryZone: Output?
        get() = javaResource.preferredPrimaryZone().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Azure Cosmos DB for PostgreSQL Cluster should exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `servers` block as defined below.
     */
    public val servers: Output>
        get() = javaResource.servers().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    postgresqlClusterServerToKotlin(args0)
                })
            })
        })

    /**
     * Is shards on coordinator enabled for the Azure Cosmos DB for PostgreSQL cluster.
     */
    public val shardsOnCoordinatorEnabled: Output
        get() = javaResource.shardsOnCoordinatorEnabled().applyValue({ args0 -> args0 })

    /**
     * The Azure region of the source Azure Cosmos DB for PostgreSQL cluster for read replica clusters. Changing this forces a new resource to be created.
     */
    public val sourceLocation: Output?
        get() = javaResource.sourceLocation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The resource ID of the source Azure Cosmos DB for PostgreSQL cluster for read replica clusters. Changing this forces a new resource to be created.
     */
    public val sourceResourceId: Output?
        get() = javaResource.sourceResourceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The major PostgreSQL version on the Azure Cosmos DB for PostgreSQL cluster. Possible values are `11`, `12`, `13`, `14`, `15` and `16`.
     */
    public val sqlVersion: Output
        get() = javaResource.sqlVersion().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the Azure Cosmos DB for PostgreSQL Cluster.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object PostgresqlClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.cosmosdb.PostgresqlCluster::class == javaResource::class

    override fun map(javaResource: Resource): PostgresqlCluster = PostgresqlCluster(
        javaResource as
            com.pulumi.azure.cosmosdb.PostgresqlCluster,
    )
}

/**
 * @see [PostgresqlCluster].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [PostgresqlCluster].
 */
public suspend fun postgresqlCluster(
    name: String,
    block: suspend PostgresqlClusterResourceBuilder.() -> Unit,
): PostgresqlCluster {
    val builder = PostgresqlClusterResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [PostgresqlCluster].
 * @param name The _unique_ name of the resulting resource.
 */
public fun postgresqlCluster(name: String): PostgresqlCluster {
    val builder = PostgresqlClusterResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy