com.pulumi.azure.cosmosdb.kotlin.SqlContainerArgs.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.SqlContainerArgs.builder
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerAutoscaleSettingsArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerAutoscaleSettingsArgsBuilder
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerConflictResolutionPolicyArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerConflictResolutionPolicyArgsBuilder
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerIndexingPolicyArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerIndexingPolicyArgsBuilder
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerUniqueKeyArgs
import com.pulumi.azure.cosmosdb.kotlin.inputs.SqlContainerUniqueKeyArgsBuilder
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.collections.List
import kotlin.jvm.JvmName
/**
* Manages a SQL Container 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 exampleSqlDatabase = new azure.cosmosdb.SqlDatabase("example", {
* name: "example-acsd",
* resourceGroupName: example.then(example => example.resourceGroupName),
* accountName: example.then(example => example.name),
* });
* const exampleSqlContainer = new azure.cosmosdb.SqlContainer("example", {
* name: "example-container",
* resourceGroupName: example.then(example => example.resourceGroupName),
* accountName: example.then(example => example.name),
* databaseName: exampleSqlDatabase.name,
* partitionKeyPath: "/definition/id",
* partitionKeyVersion: 1,
* throughput: 400,
* indexingPolicy: {
* indexingMode: "consistent",
* includedPaths: [
* {
* path: "/*",
* },
* {
* path: "/included/?",
* },
* ],
* excludedPaths: [{
* path: "/excluded/?",
* }],
* },
* uniqueKeys: [{
* paths: [
* "/definition/idlong",
* "/definition/idshort",
* ],
* }],
* });
* ```
* ```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_sql_database = azure.cosmosdb.SqlDatabase("example",
* name="example-acsd",
* resource_group_name=example.resource_group_name,
* account_name=example.name)
* example_sql_container = azure.cosmosdb.SqlContainer("example",
* name="example-container",
* resource_group_name=example.resource_group_name,
* account_name=example.name,
* database_name=example_sql_database.name,
* partition_key_path="/definition/id",
* partition_key_version=1,
* throughput=400,
* indexing_policy=azure.cosmosdb.SqlContainerIndexingPolicyArgs(
* indexing_mode="consistent",
* included_paths=[
* azure.cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs(
* path="/*",
* ),
* azure.cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs(
* path="/included/?",
* ),
* ],
* excluded_paths=[azure.cosmosdb.SqlContainerIndexingPolicyExcludedPathArgs(
* path="/excluded/?",
* )],
* ),
* unique_keys=[azure.cosmosdb.SqlContainerUniqueKeyArgs(
* paths=[
* "/definition/idlong",
* "/definition/idshort",
* ],
* )])
* ```
* ```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 exampleSqlDatabase = new Azure.CosmosDB.SqlDatabase("example", new()
* {
* Name = "example-acsd",
* ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
* AccountName = example.Apply(getAccountResult => getAccountResult.Name),
* });
* var exampleSqlContainer = new Azure.CosmosDB.SqlContainer("example", new()
* {
* Name = "example-container",
* ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
* AccountName = example.Apply(getAccountResult => getAccountResult.Name),
* DatabaseName = exampleSqlDatabase.Name,
* PartitionKeyPath = "/definition/id",
* PartitionKeyVersion = 1,
* Throughput = 400,
* IndexingPolicy = new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyArgs
* {
* IndexingMode = "consistent",
* IncludedPaths = new[]
* {
* new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyIncludedPathArgs
* {
* Path = "/*",
* },
* new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyIncludedPathArgs
* {
* Path = "/included/?",
* },
* },
* ExcludedPaths = new[]
* {
* new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyExcludedPathArgs
* {
* Path = "/excluded/?",
* },
* },
* },
* UniqueKeys = new[]
* {
* new Azure.CosmosDB.Inputs.SqlContainerUniqueKeyArgs
* {
* Paths = new[]
* {
* "/definition/idlong",
* "/definition/idshort",
* },
* },
* },
* });
* });
* ```
* ```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
* }
* exampleSqlDatabase, err := cosmosdb.NewSqlDatabase(ctx, "example", &cosmosdb.SqlDatabaseArgs{
* Name: pulumi.String("example-acsd"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* })
* if err != nil {
* return err
* }
* _, err = cosmosdb.NewSqlContainer(ctx, "example", &cosmosdb.SqlContainerArgs{
* Name: pulumi.String("example-container"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* DatabaseName: exampleSqlDatabase.Name,
* PartitionKeyPath: pulumi.String("/definition/id"),
* PartitionKeyVersion: pulumi.Int(1),
* Throughput: pulumi.Int(400),
* IndexingPolicy: &cosmosdb.SqlContainerIndexingPolicyArgs{
* IndexingMode: pulumi.String("consistent"),
* IncludedPaths: cosmosdb.SqlContainerIndexingPolicyIncludedPathArray{
* &cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs{
* Path: pulumi.String("/*"),
* },
* &cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs{
* Path: pulumi.String("/included/?"),
* },
* },
* ExcludedPaths: cosmosdb.SqlContainerIndexingPolicyExcludedPathArray{
* &cosmosdb.SqlContainerIndexingPolicyExcludedPathArgs{
* Path: pulumi.String("/excluded/?"),
* },
* },
* },
* UniqueKeys: cosmosdb.SqlContainerUniqueKeyArray{
* &cosmosdb.SqlContainerUniqueKeyArgs{
* Paths: pulumi.StringArray{
* pulumi.String("/definition/idlong"),
* pulumi.String("/definition/idshort"),
* },
* },
* },
* })
* 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.SqlDatabase;
* import com.pulumi.azure.cosmosdb.SqlDatabaseArgs;
* import com.pulumi.azure.cosmosdb.SqlContainer;
* import com.pulumi.azure.cosmosdb.SqlContainerArgs;
* import com.pulumi.azure.cosmosdb.inputs.SqlContainerIndexingPolicyArgs;
* import com.pulumi.azure.cosmosdb.inputs.SqlContainerUniqueKeyArgs;
* 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 exampleSqlDatabase = new SqlDatabase("exampleSqlDatabase", SqlDatabaseArgs.builder()
* .name("example-acsd")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .build());
* var exampleSqlContainer = new SqlContainer("exampleSqlContainer", SqlContainerArgs.builder()
* .name("example-container")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .databaseName(exampleSqlDatabase.name())
* .partitionKeyPath("/definition/id")
* .partitionKeyVersion(1)
* .throughput(400)
* .indexingPolicy(SqlContainerIndexingPolicyArgs.builder()
* .indexingMode("consistent")
* .includedPaths(
* SqlContainerIndexingPolicyIncludedPathArgs.builder()
* .path("/*")
* .build(),
* SqlContainerIndexingPolicyIncludedPathArgs.builder()
* .path("/included/?")
* .build())
* .excludedPaths(SqlContainerIndexingPolicyExcludedPathArgs.builder()
* .path("/excluded/?")
* .build())
* .build())
* .uniqueKeys(SqlContainerUniqueKeyArgs.builder()
* .paths(
* "/definition/idlong",
* "/definition/idshort")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleSqlDatabase:
* type: azure:cosmosdb:SqlDatabase
* name: example
* properties:
* name: example-acsd
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* exampleSqlContainer:
* type: azure:cosmosdb:SqlContainer
* name: example
* properties:
* name: example-container
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* databaseName: ${exampleSqlDatabase.name}
* partitionKeyPath: /definition/id
* partitionKeyVersion: 1
* throughput: 400
* indexingPolicy:
* indexingMode: consistent
* includedPaths:
* - path: /*
* - path: /included/?
* excludedPaths:
* - path: /excluded/?
* uniqueKeys:
* - paths:
* - /definition/idlong
* - /definition/idshort
* variables:
* example:
* fn::invoke:
* Function: azure:cosmosdb:getAccount
* Arguments:
* name: tfex-cosmosdb-account
* resourceGroupName: tfex-cosmosdb-account-rg
* ```
*
* ## Import
* Cosmos SQL Containers can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:cosmosdb/sqlContainer:SqlContainer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1/sqlDatabases/database1/containers/container1
* ```
* @property accountName The name of the Cosmos DB Account to create the container within. Changing this forces a new resource to be created.
* @property analyticalStorageTtl The default time to live of Analytical Storage for this SQL container. If present and the value is set to `-1`, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number `n` – items will expire `n` seconds after their last modified time.
* @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. Requires `partition_key_path` to be set.
* > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
* @property conflictResolutionPolicy A `conflict_resolution_policy` blocks as defined below. Changing this forces a new resource to be created.
* @property databaseName The name of the Cosmos DB SQL Database to create the container within. Changing this forces a new resource to be created.
* @property defaultTtl The default time to live of SQL container. If missing, items are not expired automatically. If present and the value is set to `-1`, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number `n` – items will expire `n` seconds after their last modified time.
* @property indexingPolicy An `indexing_policy` block as defined below.
* @property name Specifies the name of the Cosmos DB SQL Container. Changing this forces a new resource to be created.
* @property partitionKeyPath Define a partition key. Changing this forces a new resource to be created.
* @property partitionKeyVersion 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.
* @property resourceGroupName The name of the resource group in which the Cosmos DB SQL Container is created. Changing this forces a new resource to be created.
* @property throughput The throughput of SQL container (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon container creation otherwise it cannot be updated without a manual resource destroy-apply.
* @property uniqueKeys One or more `unique_key` blocks as defined below. Changing this forces a new resource to be created.
* */*/*/*/*/*/
*/
public data class SqlContainerArgs(
public val accountName: Output? = null,
public val analyticalStorageTtl: Output? = null,
public val autoscaleSettings: Output? = null,
public val conflictResolutionPolicy: Output? = null,
public val databaseName: Output? = null,
public val defaultTtl: Output? = null,
public val indexingPolicy: Output? = null,
public val name: Output? = null,
public val partitionKeyPath: Output? = null,
public val partitionKeyVersion: Output? = null,
public val resourceGroupName: Output? = null,
public val throughput: Output? = null,
public val uniqueKeys: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.cosmosdb.SqlContainerArgs =
com.pulumi.azure.cosmosdb.SqlContainerArgs.builder()
.accountName(accountName?.applyValue({ args0 -> args0 }))
.analyticalStorageTtl(analyticalStorageTtl?.applyValue({ args0 -> args0 }))
.autoscaleSettings(autoscaleSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.conflictResolutionPolicy(
conflictResolutionPolicy?.applyValue({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
}),
)
.databaseName(databaseName?.applyValue({ args0 -> args0 }))
.defaultTtl(defaultTtl?.applyValue({ args0 -> args0 }))
.indexingPolicy(indexingPolicy?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.name(name?.applyValue({ args0 -> args0 }))
.partitionKeyPath(partitionKeyPath?.applyValue({ args0 -> args0 }))
.partitionKeyVersion(partitionKeyVersion?.applyValue({ args0 -> args0 }))
.resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
.throughput(throughput?.applyValue({ args0 -> args0 }))
.uniqueKeys(
uniqueKeys?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
).build()
}
/**
* Builder for [SqlContainerArgs].
*/
@PulumiTagMarker
public class SqlContainerArgsBuilder internal constructor() {
private var accountName: Output? = null
private var analyticalStorageTtl: Output? = null
private var autoscaleSettings: Output? = null
private var conflictResolutionPolicy: Output? = null
private var databaseName: Output? = null
private var defaultTtl: Output? = null
private var indexingPolicy: Output? = null
private var name: Output? = null
private var partitionKeyPath: Output? = null
private var partitionKeyVersion: Output? = null
private var resourceGroupName: Output? = null
private var throughput: Output? = null
private var uniqueKeys: Output>? = null
/**
* @param value The name of the Cosmos DB Account to create the container within. Changing this forces a new resource to be created.
*/
@JvmName("nrwlrocioavllqxl")
public suspend fun accountName(`value`: Output) {
this.accountName = value
}
/**
* @param value The default time to live of Analytical Storage for this SQL container. If present and the value is set to `-1`, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number `n` – items will expire `n` seconds after their last modified time.
*/
@JvmName("qjurlbklgnpwwbat")
public suspend fun analyticalStorageTtl(`value`: Output) {
this.analyticalStorageTtl = 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. Requires `partition_key_path` to be set.
* > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
*/
@JvmName("tbqwhuijxwivjmqt")
public suspend fun autoscaleSettings(`value`: Output) {
this.autoscaleSettings = value
}
/**
* @param value A `conflict_resolution_policy` blocks as defined below. Changing this forces a new resource to be created.
*/
@JvmName("algjpjgrsryvluud")
public suspend
fun conflictResolutionPolicy(`value`: Output) {
this.conflictResolutionPolicy = value
}
/**
* @param value The name of the Cosmos DB SQL Database to create the container within. Changing this forces a new resource to be created.
*/
@JvmName("aabbyhdlcwrjjwri")
public suspend fun databaseName(`value`: Output) {
this.databaseName = value
}
/**
* @param value The default time to live of SQL container. If missing, items are not expired automatically. If present and the value is set to `-1`, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number `n` – items will expire `n` seconds after their last modified time.
*/
@JvmName("ujmhsvbxvnllvulg")
public suspend fun defaultTtl(`value`: Output) {
this.defaultTtl = value
}
/**
* @param value An `indexing_policy` block as defined below.
*/
@JvmName("qluqqblbwjcojayq")
public suspend fun indexingPolicy(`value`: Output) {
this.indexingPolicy = value
}
/**
* @param value Specifies the name of the Cosmos DB SQL Container. Changing this forces a new resource to be created.
*/
@JvmName("bepmykoxyxgeytuk")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value Define a partition key. Changing this forces a new resource to be created.
*/
@JvmName("njqoktposygepkjo")
public suspend fun partitionKeyPath(`value`: Output) {
this.partitionKeyPath = value
}
/**
* @param value 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.
*/
@JvmName("bnybygxhqjlsowfk")
public suspend fun partitionKeyVersion(`value`: Output) {
this.partitionKeyVersion = value
}
/**
* @param value The name of the resource group in which the Cosmos DB SQL Container is created. Changing this forces a new resource to be created.
*/
@JvmName("endwxkwpiqidmmra")
public suspend fun resourceGroupName(`value`: Output) {
this.resourceGroupName = value
}
/**
* @param value The throughput of SQL container (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon container creation otherwise it cannot be updated without a manual resource destroy-apply.
*/
@JvmName("flbqiurlpjwmkysm")
public suspend fun throughput(`value`: Output) {
this.throughput = value
}
/**
* @param value One or more `unique_key` blocks as defined below. Changing this forces a new resource to be created.
*/
@JvmName("kcxedfkejsiectcu")
public suspend fun uniqueKeys(`value`: Output>) {
this.uniqueKeys = value
}
@JvmName("yuyfxvtgmogihdgm")
public suspend fun uniqueKeys(vararg values: Output) {
this.uniqueKeys = Output.all(values.asList())
}
/**
* @param values One or more `unique_key` blocks as defined below. Changing this forces a new resource to be created.
*/
@JvmName("shgbfajtbxstncvt")
public suspend fun uniqueKeys(values: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy