Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.cosmosdb.kotlin
import com.pulumi.azure.cosmosdb.SqlStoredProcedureArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* Manages a SQL Stored Procedure within a Cosmos DB Account SQL Database.
* ## 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: "tfex-cosmos-db",
* resourceGroupName: example.then(example => example.resourceGroupName),
* accountName: example.then(example => example.name),
* throughput: 400,
* });
* 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: "/id",
* });
* const exampleSqlStoredProcedure = new azure.cosmosdb.SqlStoredProcedure("example", {
* name: "test-stored-proc",
* resourceGroupName: example.then(example => example.resourceGroupName),
* accountName: example.then(example => example.name),
* databaseName: exampleSqlDatabase.name,
* containerName: exampleSqlContainer.name,
* body: " function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }\n",
* });
* ```
* ```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="tfex-cosmos-db",
* resource_group_name=example.resource_group_name,
* account_name=example.name,
* throughput=400)
* 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="/id")
* example_sql_stored_procedure = azure.cosmosdb.SqlStoredProcedure("example",
* name="test-stored-proc",
* resource_group_name=example.resource_group_name,
* account_name=example.name,
* database_name=example_sql_database.name,
* container_name=example_sql_container.name,
* body=" function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }\n")
* ```
* ```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 = "tfex-cosmos-db",
* ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
* AccountName = example.Apply(getAccountResult => getAccountResult.Name),
* Throughput = 400,
* });
* 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 = "/id",
* });
* var exampleSqlStoredProcedure = new Azure.CosmosDB.SqlStoredProcedure("example", new()
* {
* Name = "test-stored-proc",
* ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
* AccountName = example.Apply(getAccountResult => getAccountResult.Name),
* DatabaseName = exampleSqlDatabase.Name,
* ContainerName = exampleSqlContainer.Name,
* Body = @" function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }
* ",
* });
* });
* ```
* ```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("tfex-cosmos-db"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* Throughput: pulumi.Int(400),
* })
* if err != nil {
* return err
* }
* exampleSqlContainer, 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("/id"),
* })
* if err != nil {
* return err
* }
* _, err = cosmosdb.NewSqlStoredProcedure(ctx, "example", &cosmosdb.SqlStoredProcedureArgs{
* Name: pulumi.String("test-stored-proc"),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* AccountName: pulumi.String(example.Name),
* DatabaseName: exampleSqlDatabase.Name,
* ContainerName: exampleSqlContainer.Name,
* Body: pulumi.String(" function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }\n"),
* })
* 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.SqlStoredProcedure;
* import com.pulumi.azure.cosmosdb.SqlStoredProcedureArgs;
* 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("tfex-cosmos-db")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .throughput(400)
* .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("/id")
* .build());
* var exampleSqlStoredProcedure = new SqlStoredProcedure("exampleSqlStoredProcedure", SqlStoredProcedureArgs.builder()
* .name("test-stored-proc")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .databaseName(exampleSqlDatabase.name())
* .containerName(exampleSqlContainer.name())
* .body("""
* function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }
* """)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleSqlDatabase:
* type: azure:cosmosdb:SqlDatabase
* name: example
* properties:
* name: tfex-cosmos-db
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* throughput: 400
* exampleSqlContainer:
* type: azure:cosmosdb:SqlContainer
* name: example
* properties:
* name: example-container
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* databaseName: ${exampleSqlDatabase.name}
* partitionKeyPath: /id
* exampleSqlStoredProcedure:
* type: azure:cosmosdb:SqlStoredProcedure
* name: example
* properties:
* name: test-stored-proc
* resourceGroupName: ${example.resourceGroupName}
* accountName: ${example.name}
* databaseName: ${exampleSqlDatabase.name}
* containerName: ${exampleSqlContainer.name}
* body: |2
* function () { var context = getContext(); var response = context.getResponse(); response.setBody('Hello, World'); }
* variables:
* example:
* fn::invoke:
* Function: azure:cosmosdb:getAccount
* Arguments:
* name: tfex-cosmosdb-account
* resourceGroupName: tfex-cosmosdb-account-rg
* ```
*
* ## Import
* CosmosDB SQL Stored Procedures can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:cosmosdb/sqlStoredProcedure:SqlStoredProcedure db1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/sqlDatabases/db1/containers/c1/storedProcedures/sp1
* ```
* @property accountName The name of the Cosmos DB Account to create the stored procedure within. Changing this forces a new resource to be created.
* @property body The body of the stored procedure.
* @property containerName The name of the Cosmos DB SQL Container to create the stored procedure within. Changing this forces a new resource to be created.
* @property databaseName The name of the Cosmos DB SQL Database to create the stored procedure within. Changing this forces a new resource to be created.
* @property name Specifies the name of the Cosmos DB SQL Stored Procedure. Changing this forces a new resource to be created.
* @property resourceGroupName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
*/
public data class SqlStoredProcedureArgs(
public val accountName: Output? = null,
public val body: Output? = null,
public val containerName: Output? = null,
public val databaseName: Output? = null,
public val name: Output? = null,
public val resourceGroupName: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.cosmosdb.SqlStoredProcedureArgs =
com.pulumi.azure.cosmosdb.SqlStoredProcedureArgs.builder()
.accountName(accountName?.applyValue({ args0 -> args0 }))
.body(body?.applyValue({ args0 -> args0 }))
.containerName(containerName?.applyValue({ args0 -> args0 }))
.databaseName(databaseName?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [SqlStoredProcedureArgs].
*/
@PulumiTagMarker
public class SqlStoredProcedureArgsBuilder internal constructor() {
private var accountName: Output? = null
private var body: Output? = null
private var containerName: Output? = null
private var databaseName: Output? = null
private var name: Output? = null
private var resourceGroupName: Output? = null
/**
* @param value The name of the Cosmos DB Account to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("sgrswffspxokrlru")
public suspend fun accountName(`value`: Output) {
this.accountName = value
}
/**
* @param value The body of the stored procedure.
*/
@JvmName("qqqvmxnchgortwow")
public suspend fun body(`value`: Output) {
this.body = value
}
/**
* @param value The name of the Cosmos DB SQL Container to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("incmgfuwuasvasqu")
public suspend fun containerName(`value`: Output) {
this.containerName = value
}
/**
* @param value The name of the Cosmos DB SQL Database to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("dptfoqmyocxlfehy")
public suspend fun databaseName(`value`: Output) {
this.databaseName = value
}
/**
* @param value Specifies the name of the Cosmos DB SQL Stored Procedure. Changing this forces a new resource to be created.
*/
@JvmName("yusynwheojwvqyjk")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
*/
@JvmName("hphcmwemjmelnrne")
public suspend fun resourceGroupName(`value`: Output) {
this.resourceGroupName = value
}
/**
* @param value The name of the Cosmos DB Account to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("mkajfanpfljtmcom")
public suspend fun accountName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.accountName = mapped
}
/**
* @param value The body of the stored procedure.
*/
@JvmName("oqxkyqpnnwlmkaad")
public suspend fun body(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.body = mapped
}
/**
* @param value The name of the Cosmos DB SQL Container to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("brshbaclhyhlojtu")
public suspend fun containerName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.containerName = mapped
}
/**
* @param value The name of the Cosmos DB SQL Database to create the stored procedure within. Changing this forces a new resource to be created.
*/
@JvmName("gwnqkhjoluermfai")
public suspend fun databaseName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.databaseName = mapped
}
/**
* @param value Specifies the name of the Cosmos DB SQL Stored Procedure. Changing this forces a new resource to be created.
*/
@JvmName("tbcemtkundadpbih")
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 SQL Database is created. Changing this forces a new resource to be created.
*/
@JvmName("nrmrulunneguyxbo")
public suspend fun resourceGroupName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.resourceGroupName = mapped
}
internal fun build(): SqlStoredProcedureArgs = SqlStoredProcedureArgs(
accountName = accountName,
body = body,
containerName = containerName,
databaseName = databaseName,
name = name,
resourceGroupName = resourceGroupName,
)
}