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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinDatabaseAutoscaleSettings
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinDatabaseAutoscaleSettings.Companion.toKotlin
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

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

    public var args: GremlinDatabaseArgs = GremlinDatabaseArgs()

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

/**
 * Manages a Gremlin 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 exampleGremlinDatabase = new azure.cosmosdb.GremlinDatabase("example", {
 *     name: "tfex-cosmos-gremlin-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_gremlin_database = azure.cosmosdb.GremlinDatabase("example",
 *     name="tfex-cosmos-gremlin-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 exampleGremlinDatabase = new Azure.CosmosDB.GremlinDatabase("example", new()
 *     {
 *         Name = "tfex-cosmos-gremlin-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.NewGremlinDatabase(ctx, "example", &cosmosdb.GremlinDatabaseArgs{
 * 			Name:              pulumi.String("tfex-cosmos-gremlin-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.GremlinDatabase;
 * import com.pulumi.azure.cosmosdb.GremlinDatabaseArgs;
 * 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 exampleGremlinDatabase = new GremlinDatabase("exampleGremlinDatabase", GremlinDatabaseArgs.builder()
 *             .name("tfex-cosmos-gremlin-db")
 *             .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
 *             .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
 *             .throughput(400)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleGremlinDatabase:
 *     type: azure:cosmosdb:GremlinDatabase
 *     name: example
 *     properties:
 *       name: tfex-cosmos-gremlin-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
 * CosmosDB Gremlin Databases can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/gremlinDatabase:GremlinDatabase db1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/gremlinDatabases/db1
 * ```
 */
public class GremlinDatabase internal constructor(
    override val javaResource: com.pulumi.azure.cosmosdb.GremlinDatabase,
) : KotlinCustomResource(javaResource, GremlinDatabaseMapper) {
    /**
     * The name of the CosmosDB Account to create the Gremlin Database within. Changing this forces a new resource to be created.
     */
    public val accountName: Output
        get() = javaResource.accountName().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val autoscaleSettings: Output?
        get() = javaResource.autoscaleSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies the name of the Cosmos DB Gremlin Database. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which the Cosmos DB Gremlin Database is created. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The throughput of the Gremlin database (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 val throughput: Output
        get() = javaResource.throughput().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy