![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azure.cosmosdb.kotlin.GremlinGraph.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-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.azure.cosmosdb.kotlin
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphAutoscaleSettings
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphConflictResolutionPolicy
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphIndexPolicy
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphUniqueKey
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 com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphAutoscaleSettings.Companion.toKotlin as gremlinGraphAutoscaleSettingsToKotlin
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphConflictResolutionPolicy.Companion.toKotlin as gremlinGraphConflictResolutionPolicyToKotlin
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphIndexPolicy.Companion.toKotlin as gremlinGraphIndexPolicyToKotlin
import com.pulumi.azure.cosmosdb.kotlin.outputs.GremlinGraphUniqueKey.Companion.toKotlin as gremlinGraphUniqueKeyToKotlin
/**
* Builder for [GremlinGraph].
*/
@PulumiTagMarker
public class GremlinGraphResourceBuilder internal constructor() {
public var name: String? = null
public var args: GremlinGraphArgs = GremlinGraphArgs()
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 GremlinGraphArgsBuilder.() -> Unit) {
val builder = GremlinGraphArgsBuilder()
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(): GremlinGraph {
val builtJavaResource = com.pulumi.azure.cosmosdb.GremlinGraph(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GremlinGraph(builtJavaResource)
}
}
/**
* Manages a Gremlin Graph 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),
* });
* const exampleGremlinGraph = new azure.cosmosdb.GremlinGraph("example", {
* name: "tfex-cosmos-gremlin-graph",
* resourceGroupName: example.then(example => example.resourceGroupName),
* accountName: example.then(example => example.name),
* databaseName: exampleGremlinDatabase.name,
* partitionKeyPath: "/Example",
* throughput: 400,
* indexPolicy: {
* automatic: true,
* indexingMode: "consistent",
* includedPaths: ["/*"],
* excludedPaths: ["/\"_etag\"/?"],
* },
* conflictResolutionPolicy: {
* mode: "LastWriterWins",
* conflictResolutionPath: "/_ts",
* },
* uniqueKeys: [{
* paths: [
* "/definition/id1",
* "/definition/id2",
* ],
* }],
* });
* ```
* ```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)
* example_gremlin_graph = azure.cosmosdb.GremlinGraph("example",
* name="tfex-cosmos-gremlin-graph",
* resource_group_name=example.resource_group_name,
* account_name=example.name,
* database_name=example_gremlin_database.name,
* partition_key_path="/Example",
* throughput=400,
* index_policy={
* "automatic": True,
* "indexing_mode": "consistent",
* "included_paths": ["/*"],
* "excluded_paths": ["/\"_etag\"/?"],
* },
* conflict_resolution_policy={
* "mode": "LastWriterWins",
* "conflict_resolution_path": "/_ts",
* },
* unique_keys=[{
* "paths": [
* "/definition/id1",
* "/definition/id2",
* ],
* }])
* ```
* ```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),
* });
* var exampleGremlinGraph = new Azure.CosmosDB.GremlinGraph("example", new()
* {
* Name = "tfex-cosmos-gremlin-graph",
* ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
* AccountName = example.Apply(getAccountResult => getAccountResult.Name),
* DatabaseName = exampleGremlinDatabase.Name,
* PartitionKeyPath = "/Example",
* Throughput = 400,
* IndexPolicy = new Azure.CosmosDB.Inputs.GremlinGraphIndexPolicyArgs
* {
* Automatic = true,
* IndexingMode = "consistent",
* IncludedPaths = new[]
* {
* "/*",
* },
* ExcludedPaths = new[]
* {
* "/\"_etag\"/?",
* },
* },
* ConflictResolutionPolicy = new Azure.CosmosDB.Inputs.GremlinGraphConflictResolutionPolicyArgs
* {
* Mode = "LastWriterWins",
* ConflictResolutionPath = "/_ts",
* },
* UniqueKeys = new[]
* {
* new Azure.CosmosDB.Inputs.GremlinGraphUniqueKeyArgs
* {
* Paths = new[]
* {
* "/definition/id1",
* "/definition/id2",
* },
* },
* },
* });
* });
* ```
* ```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
* }
* exampleGremlinDatabase, err := cosmosdb.NewGremlinDatabase(ctx, "example", &cosmosdb.GremlinDatabaseArgs{
* Name: pulumi.String("tfex-cosmos-gremlin-db"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* })
* if err != nil {
* return err
* }
* _, err = cosmosdb.NewGremlinGraph(ctx, "example", &cosmosdb.GremlinGraphArgs{
* Name: pulumi.String("tfex-cosmos-gremlin-graph"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* DatabaseName: exampleGremlinDatabase.Name,
* PartitionKeyPath: pulumi.String("/Example"),
* Throughput: pulumi.Int(400),
* IndexPolicy: &cosmosdb.GremlinGraphIndexPolicyArgs{
* Automatic: pulumi.Bool(true),
* IndexingMode: pulumi.String("consistent"),
* IncludedPaths: pulumi.StringArray{
* pulumi.String("/*"),
* },
* ExcludedPaths: pulumi.StringArray{
* pulumi.String("/\"_etag\"/?"),
* },
* },
* ConflictResolutionPolicy: &cosmosdb.GremlinGraphConflictResolutionPolicyArgs{
* Mode: pulumi.String("LastWriterWins"),
* ConflictResolutionPath: pulumi.String("/_ts"),
* },
* UniqueKeys: cosmosdb.GremlinGraphUniqueKeyArray{
* &cosmosdb.GremlinGraphUniqueKeyArgs{
* Paths: pulumi.StringArray{
* pulumi.String("/definition/id1"),
* pulumi.String("/definition/id2"),
* },
* },
* },
* })
* 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 com.pulumi.azure.cosmosdb.GremlinGraph;
* import com.pulumi.azure.cosmosdb.GremlinGraphArgs;
* import com.pulumi.azure.cosmosdb.inputs.GremlinGraphIndexPolicyArgs;
* import com.pulumi.azure.cosmosdb.inputs.GremlinGraphConflictResolutionPolicyArgs;
* import com.pulumi.azure.cosmosdb.inputs.GremlinGraphUniqueKeyArgs;
* 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()))
* .build());
* var exampleGremlinGraph = new GremlinGraph("exampleGremlinGraph", GremlinGraphArgs.builder()
* .name("tfex-cosmos-gremlin-graph")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .databaseName(exampleGremlinDatabase.name())
* .partitionKeyPath("/Example")
* .throughput(400)
* .indexPolicy(GremlinGraphIndexPolicyArgs.builder()
* .automatic(true)
* .indexingMode("consistent")
* .includedPaths("/*")
* .excludedPaths("/\"_etag\"/?")
* .build())
* .conflictResolutionPolicy(GremlinGraphConflictResolutionPolicyArgs.builder()
* .mode("LastWriterWins")
* .conflictResolutionPath("/_ts")
* .build())
* .uniqueKeys(GremlinGraphUniqueKeyArgs.builder()
* .paths(
* "/definition/id1",
* "/definition/id2")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleGremlinDatabase:
* type: azure:cosmosdb:GremlinDatabase
* name: example
* properties:
* name: tfex-cosmos-gremlin-db
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* exampleGremlinGraph:
* type: azure:cosmosdb:GremlinGraph
* name: example
* properties:
* name: tfex-cosmos-gremlin-graph
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* databaseName: ${exampleGremlinDatabase.name}
* partitionKeyPath: /Example
* throughput: 400
* indexPolicy:
* automatic: true
* indexingMode: consistent
* includedPaths:
* - /*
* excludedPaths:
* - /"_etag"/?
* conflictResolutionPolicy:
* mode: LastWriterWins
* conflictResolutionPath: /_ts
* uniqueKeys:
* - paths:
* - /definition/id1
* - /definition/id2
* variables:
* example:
* fn::invoke:
* Function: azure:cosmosdb:getAccount
* Arguments:
* name: tfex-cosmosdb-account
* resourceGroupName: tfex-cosmosdb-account-rg
* ```
*
* > **NOTE:** The CosmosDB Account needs to have the `EnableGremlin` capability enabled to use this resource - which can be done by adding this to the `capabilities` list within the `azure.cosmosdb.Account` resource.
* ## Import
* Cosmos Gremlin Graphs can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:cosmosdb/gremlinGraph:GremlinGraph example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/gremlinDatabases/db1/graphs/graphs1
* ```
* */*/*/*/*/*/
*/
public class GremlinGraph internal constructor(
override val javaResource: com.pulumi.azure.cosmosdb.GremlinGraph,
) : KotlinCustomResource(javaResource, GremlinGraphMapper) {
/**
* The name of the CosmosDB Account to create the Gremlin Graph within. Changing this forces a new resource to be created.
*/
public val accountName: Output
get() = javaResource.accountName().applyValue({ args0 -> args0 })
/**
* The time to live of Analytical Storage for this Cosmos DB Gremlin Graph. Possible values are between `-1` to `2147483647` not including `0`. If present and the value is set to `-1`, it means never expire.
* > **Note:** Disabling `analytical_storage_ttl` will force a new resource to be created since it can't be disabled once it's enabled.
*/
public val analyticalStorageTtl: Output?
get() = javaResource.analyticalStorageTtl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
public val autoscaleSettings: Output?
get() = javaResource.autoscaleSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> gremlinGraphAutoscaleSettingsToKotlin(args0) })
}).orElse(null)
})
/**
* A `conflict_resolution_policy` blocks as defined below. Changing this forces a new resource to be created.
*/
public val conflictResolutionPolicy: Output
get() = javaResource.conflictResolutionPolicy().applyValue({ args0 ->
args0.let({ args0 ->
gremlinGraphConflictResolutionPolicyToKotlin(args0)
})
})
/**
* The name of the Cosmos DB Graph Database in which the Cosmos DB Gremlin Graph is created. Changing this forces a new resource to be created.
*/
public val databaseName: Output
get() = javaResource.databaseName().applyValue({ args0 -> args0 })
/**
* The default time to live (TTL) of the Gremlin graph. If the value is missing or set to "-1", items don’t expire.
*/
public val defaultTtl: Output?
get() = javaResource.defaultTtl().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The configuration of the indexing policy. One or more `index_policy` blocks as defined below.
*/
public val indexPolicy: Output
get() = javaResource.indexPolicy().applyValue({ args0 ->
args0.let({ args0 ->
gremlinGraphIndexPolicyToKotlin(args0)
})
})
/**
* Specifies the name of the Cosmos DB Gremlin Graph. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Define a partition key. Changing this forces a new resource to be created.
*/
public val partitionKeyPath: Output
get() = javaResource.partitionKeyPath().applyValue({ args0 -> args0 })
/**
* Define a partition key version. Changing this forces a new resource to be created. Possible values are `1`and `2`. This should be set to `2` in order to use large partition keys.
*/
public val partitionKeyVersion: Output?
get() = javaResource.partitionKeyVersion().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the resource group in which the Cosmos DB Gremlin Graph 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 graph (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 destroy-apply.
*/
public val throughput: Output
get() = javaResource.throughput().applyValue({ args0 -> args0 })
/**
* One or more `unique_key` blocks as defined below. Changing this forces a new resource to be created.
*/
public val uniqueKeys: Output>?
get() = javaResource.uniqueKeys().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> gremlinGraphUniqueKeyToKotlin(args0) })
})
}).orElse(null)
})
}
public object GremlinGraphMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.cosmosdb.GremlinGraph::class == javaResource::class
override fun map(javaResource: Resource): GremlinGraph = GremlinGraph(
javaResource as
com.pulumi.azure.cosmosdb.GremlinGraph,
)
}
/**
* @see [GremlinGraph].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GremlinGraph].
*/
public suspend fun gremlinGraph(
name: String,
block: suspend GremlinGraphResourceBuilder.() -> Unit,
): GremlinGraph {
val builder = GremlinGraphResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GremlinGraph].
* @param name The _unique_ name of the resulting resource.
*/
public fun gremlinGraph(name: String): GremlinGraph {
val builder = GremlinGraphResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy