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

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

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

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.SqlFunctionArgs.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 an SQL User Defined Function.
 * ## 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 exampleSqlFunction = new azure.cosmosdb.SqlFunction("example", {
 *     name: "test-function",
 *     containerId: exampleSqlContainer.id,
 *     body: "function trigger(){}",
 * });
 * ```
 * ```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_function = azure.cosmosdb.SqlFunction("example",
 *     name="test-function",
 *     container_id=example_sql_container.id,
 *     body="function trigger(){}")
 * ```
 * ```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 exampleSqlFunction = new Azure.CosmosDB.SqlFunction("example", new()
 *     {
 *         Name = "test-function",
 *         ContainerId = exampleSqlContainer.Id,
 *         Body = "function trigger(){}",
 *     });
 * });
 * ```
 * ```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.NewSqlFunction(ctx, "example", &cosmosdb.SqlFunctionArgs{
 * 			Name:        pulumi.String("test-function"),
 * 			ContainerId: exampleSqlContainer.ID(),
 * 			Body:        pulumi.String("function trigger(){}"),
 * 		})
 * 		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.SqlFunction;
 * import com.pulumi.azure.cosmosdb.SqlFunctionArgs;
 * 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 exampleSqlFunction = new SqlFunction("exampleSqlFunction", SqlFunctionArgs.builder()
 *             .name("test-function")
 *             .containerId(exampleSqlContainer.id())
 *             .body("function trigger(){}")
 *             .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
 *   exampleSqlFunction:
 *     type: azure:cosmosdb:SqlFunction
 *     name: example
 *     properties:
 *       name: test-function
 *       containerId: ${exampleSqlContainer.id}
 *       body: function trigger(){}
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:cosmosdb:getAccount
 *       Arguments:
 *         name: tfex-cosmosdb-account
 *         resourceGroupName: tfex-cosmosdb-account-rg
 * ```
 * 
 * ## Import
 * SQL User Defined Functions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/sqlFunction:SqlFunction example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1/sqlDatabases/database1/containers/container1/userDefinedFunctions/userDefinedFunction1
 * ```
 * @property body Body of the User Defined Function.
 * @property containerId The id of the Cosmos DB SQL Container to create the SQL User Defined Function within. Changing this forces a new SQL User Defined Function to be created.
 * @property name The name which should be used for this SQL User Defined Function. Changing this forces a new SQL User Defined Function to be created.
 */
public data class SqlFunctionArgs(
    public val body: Output? = null,
    public val containerId: Output? = null,
    public val name: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.cosmosdb.SqlFunctionArgs =
        com.pulumi.azure.cosmosdb.SqlFunctionArgs.builder()
            .body(body?.applyValue({ args0 -> args0 }))
            .containerId(containerId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SqlFunctionArgs].
 */
@PulumiTagMarker
public class SqlFunctionArgsBuilder internal constructor() {
    private var body: Output? = null

    private var containerId: Output? = null

    private var name: Output? = null

    /**
     * @param value Body of the User Defined Function.
     */
    @JvmName("qiokmlyawyqbvnig")
    public suspend fun body(`value`: Output) {
        this.body = value
    }

    /**
     * @param value The id of the Cosmos DB SQL Container to create the SQL User Defined Function within. Changing this forces a new SQL User Defined Function to be created.
     */
    @JvmName("dlxjghtpeqgaipck")
    public suspend fun containerId(`value`: Output) {
        this.containerId = value
    }

    /**
     * @param value The name which should be used for this SQL User Defined Function. Changing this forces a new SQL User Defined Function to be created.
     */
    @JvmName("vvuvtqaebcjaybot")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Body of the User Defined Function.
     */
    @JvmName("nmrxorbrmcvfminh")
    public suspend fun body(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.body = mapped
    }

    /**
     * @param value The id of the Cosmos DB SQL Container to create the SQL User Defined Function within. Changing this forces a new SQL User Defined Function to be created.
     */
    @JvmName("nscaqvfefbohplrk")
    public suspend fun containerId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.containerId = mapped
    }

    /**
     * @param value The name which should be used for this SQL User Defined Function. Changing this forces a new SQL User Defined Function to be created.
     */
    @JvmName("mqmgdslxmcargglj")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    internal fun build(): SqlFunctionArgs = SqlFunctionArgs(
        body = body,
        containerId = containerId,
        name = name,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy