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

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

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

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.MongoDatabaseArgs.builder
import com.pulumi.azure.cosmosdb.kotlin.inputs.MongoDatabaseAutoscaleSettingsArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.MongoDatabaseAutoscaleSettingsArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * Manages a Mongo Database within a Cosmos DB Account.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = azure.cosmosdb.getAccount({
 *     name: "tfex-cosmosdb-account",
 *     resourceGroupName: "tfex-cosmosdb-account-rg",
 * });
 * const exampleMongoDatabase = new azure.cosmosdb.MongoDatabase("example", {
 *     name: "tfex-cosmos-mongo-db",
 *     resourceGroupName: example.then(example => example.resourceGroupName),
 *     accountName: example.then(example => example.name),
 *     throughput: 400,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
 *     resource_group_name="tfex-cosmosdb-account-rg")
 * example_mongo_database = azure.cosmosdb.MongoDatabase("example",
 *     name="tfex-cosmos-mongo-db",
 *     resource_group_name=example.resource_group_name,
 *     account_name=example.name,
 *     throughput=400)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Azure.CosmosDB.GetAccount.Invoke(new()
 *     {
 *         Name = "tfex-cosmosdb-account",
 *         ResourceGroupName = "tfex-cosmosdb-account-rg",
 *     });
 *     var exampleMongoDatabase = new Azure.CosmosDB.MongoDatabase("example", new()
 *     {
 *         Name = "tfex-cosmos-mongo-db",
 *         ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
 *         AccountName = example.Apply(getAccountResult => getAccountResult.Name),
 *         Throughput = 400,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
 * 			Name:              "tfex-cosmosdb-account",
 * 			ResourceGroupName: "tfex-cosmosdb-account-rg",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cosmosdb.NewMongoDatabase(ctx, "example", &cosmosdb.MongoDatabaseArgs{
 * 			Name:              pulumi.String("tfex-cosmos-mongo-db"),
 * 			ResourceGroupName: pulumi.String(example.ResourceGroupName),
 * 			AccountName:       pulumi.String(example.Name),
 * 			Throughput:        pulumi.Int(400),
 * 		})
 * 		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.cosmosdb.CosmosdbFunctions;
 * import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
 * import com.pulumi.azure.cosmosdb.MongoDatabase;
 * import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
 * 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) {
 *         final var example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
 *             .name("tfex-cosmosdb-account")
 *             .resourceGroupName("tfex-cosmosdb-account-rg")
 *             .build());
 *         var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
 *             .name("tfex-cosmos-mongo-db")
 *             .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
 *             .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
 *             .throughput(400)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleMongoDatabase:
 *     type: azure:cosmosdb:MongoDatabase
 *     name: example
 *     properties:
 *       name: tfex-cosmos-mongo-db
 *       resourceGroupName: ${example.resourceGroupName}
 *       accountName: ${example.name}
 *       throughput: 400
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:cosmosdb:getAccount
 *       Arguments:
 *         name: tfex-cosmosdb-account
 *         resourceGroupName: tfex-cosmosdb-account-rg
 * ```
 * 
 * ## Import
 * Cosmos Mongo Database can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/mongoDatabase:MongoDatabase db1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/mongodbDatabases/db1
 * ```
 * @property accountName The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
 * @property autoscaleSettings An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
 * > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
 * @property name Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
 * @property throughput The throughput of the MongoDB collection (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
 * > **Note:** throughput has a maximum value of `1000000` unless a higher limit is requested via Azure Support.
 */
public data class MongoDatabaseArgs(
    public val accountName: Output? = null,
    public val autoscaleSettings: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val throughput: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.cosmosdb.MongoDatabaseArgs =
        com.pulumi.azure.cosmosdb.MongoDatabaseArgs.builder()
            .accountName(accountName?.applyValue({ args0 -> args0 }))
            .autoscaleSettings(autoscaleSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .throughput(throughput?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MongoDatabaseArgs].
 */
@PulumiTagMarker
public class MongoDatabaseArgsBuilder internal constructor() {
    private var accountName: Output? = null

    private var autoscaleSettings: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var throughput: Output? = null

    /**
     * @param value The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
     */
    @JvmName("mefbvtcvgmellijj")
    public suspend fun accountName(`value`: Output) {
        this.accountName = value
    }

    /**
     * @param value An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
     * > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
     */
    @JvmName("xrdybbgoqbbujrpi")
    public suspend fun autoscaleSettings(`value`: Output) {
        this.autoscaleSettings = value
    }

    /**
     * @param value Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
     */
    @JvmName("gksloirevuyylaks")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
     */
    @JvmName("pnobhgnjjlwwibgc")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The throughput of the MongoDB collection (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
     * > **Note:** throughput has a maximum value of `1000000` unless a higher limit is requested via Azure Support.
     */
    @JvmName("qyfinrwyhpclbfcy")
    public suspend fun throughput(`value`: Output) {
        this.throughput = value
    }

    /**
     * @param value The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
     */
    @JvmName("falcaokgltijuada")
    public suspend fun accountName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accountName = mapped
    }

    /**
     * @param value An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
     * > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
     */
    @JvmName("ehkujrhkirpcatnj")
    public suspend fun autoscaleSettings(`value`: MongoDatabaseAutoscaleSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoscaleSettings = mapped
    }

    /**
     * @param argument An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
     * > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
     */
    @JvmName("uipblfcpcieowtki")
    public suspend fun autoscaleSettings(argument: suspend MongoDatabaseAutoscaleSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = MongoDatabaseAutoscaleSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.autoscaleSettings = mapped
    }

    /**
     * @param value Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
     */
    @JvmName("trchkpnqdxcstdor")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
     */
    @JvmName("iwvqjnfjupwywlda")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value The throughput of the MongoDB collection (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
     * > **Note:** throughput has a maximum value of `1000000` unless a higher limit is requested via Azure Support.
     */
    @JvmName("ibejxqybbhqufxry")
    public suspend fun throughput(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.throughput = mapped
    }

    internal fun build(): MongoDatabaseArgs = MongoDatabaseArgs(
        accountName = accountName,
        autoscaleSettings = autoscaleSettings,
        name = name,
        resourceGroupName = resourceGroupName,
        throughput = throughput,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy