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

com.pulumi.azure.streamanalytics.kotlin.OutputMssql.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.streamanalytics.kotlin

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.Double
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: OutputMssqlArgs = OutputMssqlArgs()

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

/**
 * Manages a Stream Analytics Output to Microsoft SQL Server Database.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "rg-example",
 *     location: "West Europe",
 * });
 * const example = azure.streamanalytics.getJobOutput({
 *     name: "example-job",
 *     resourceGroupName: exampleResourceGroup.name,
 * });
 * const exampleSqlServer = new azure.sql.SqlServer("example", {
 *     name: "example-server",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     version: "12.0",
 *     administratorLogin: "dbadmin",
 *     administratorLoginPassword: "example-password",
 * });
 * const exampleDatabase = new azure.sql.Database("example", {
 *     name: "exampledb",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     serverName: exampleSqlServer.name,
 *     requestedServiceObjectiveName: "S0",
 *     collation: "SQL_LATIN1_GENERAL_CP1_CI_AS",
 *     maxSizeBytes: "268435456000",
 *     createMode: "Default",
 * });
 * const exampleOutputMssql = new azure.streamanalytics.OutputMssql("example", {
 *     name: "example-output-sql",
 *     streamAnalyticsJobName: example.apply(example => example.name),
 *     resourceGroupName: example.apply(example => example.resourceGroupName),
 *     server: exampleSqlServer.fullyQualifiedDomainName,
 *     user: exampleSqlServer.administratorLogin,
 *     password: exampleSqlServer.administratorLoginPassword,
 *     database: exampleDatabase.name,
 *     table: "ExampleTable",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="rg-example",
 *     location="West Europe")
 * example = azure.streamanalytics.get_job_output(name="example-job",
 *     resource_group_name=example_resource_group.name)
 * example_sql_server = azure.sql.SqlServer("example",
 *     name="example-server",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     version="12.0",
 *     administrator_login="dbadmin",
 *     administrator_login_password="example-password")
 * example_database = azure.sql.Database("example",
 *     name="exampledb",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     server_name=example_sql_server.name,
 *     requested_service_objective_name="S0",
 *     collation="SQL_LATIN1_GENERAL_CP1_CI_AS",
 *     max_size_bytes="268435456000",
 *     create_mode="Default")
 * example_output_mssql = azure.streamanalytics.OutputMssql("example",
 *     name="example-output-sql",
 *     stream_analytics_job_name=example.name,
 *     resource_group_name=example.resource_group_name,
 *     server=example_sql_server.fully_qualified_domain_name,
 *     user=example_sql_server.administrator_login,
 *     password=example_sql_server.administrator_login_password,
 *     database=example_database.name,
 *     table="ExampleTable")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "rg-example",
 *         Location = "West Europe",
 *     });
 *     var example = Azure.StreamAnalytics.GetJob.Invoke(new()
 *     {
 *         Name = "example-job",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *     });
 *     var exampleSqlServer = new Azure.Sql.SqlServer("example", new()
 *     {
 *         Name = "example-server",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         Version = "12.0",
 *         AdministratorLogin = "dbadmin",
 *         AdministratorLoginPassword = "example-password",
 *     });
 *     var exampleDatabase = new Azure.Sql.Database("example", new()
 *     {
 *         Name = "exampledb",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         ServerName = exampleSqlServer.Name,
 *         RequestedServiceObjectiveName = "S0",
 *         Collation = "SQL_LATIN1_GENERAL_CP1_CI_AS",
 *         MaxSizeBytes = "268435456000",
 *         CreateMode = "Default",
 *     });
 *     var exampleOutputMssql = new Azure.StreamAnalytics.OutputMssql("example", new()
 *     {
 *         Name = "example-output-sql",
 *         StreamAnalyticsJobName = example.Apply(getJobResult => getJobResult.Name),
 *         ResourceGroupName = example.Apply(getJobResult => getJobResult.ResourceGroupName),
 *         Server = exampleSqlServer.FullyQualifiedDomainName,
 *         User = exampleSqlServer.AdministratorLogin,
 *         Password = exampleSqlServer.AdministratorLoginPassword,
 *         Database = exampleDatabase.Name,
 *         Table = "ExampleTable",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/sql"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/streamanalytics"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("rg-example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example := streamanalytics.LookupJobOutput(ctx, streamanalytics.GetJobOutputArgs{
 * 			Name:              pulumi.String("example-job"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 		}, nil)
 * 		exampleSqlServer, err := sql.NewSqlServer(ctx, "example", &sql.SqlServerArgs{
 * 			Name:                       pulumi.String("example-server"),
 * 			ResourceGroupName:          exampleResourceGroup.Name,
 * 			Location:                   exampleResourceGroup.Location,
 * 			Version:                    pulumi.String("12.0"),
 * 			AdministratorLogin:         pulumi.String("dbadmin"),
 * 			AdministratorLoginPassword: pulumi.String("example-password"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDatabase, err := sql.NewDatabase(ctx, "example", &sql.DatabaseArgs{
 * 			Name:                          pulumi.String("exampledb"),
 * 			ResourceGroupName:             exampleResourceGroup.Name,
 * 			Location:                      exampleResourceGroup.Location,
 * 			ServerName:                    exampleSqlServer.Name,
 * 			RequestedServiceObjectiveName: pulumi.String("S0"),
 * 			Collation:                     pulumi.String("SQL_LATIN1_GENERAL_CP1_CI_AS"),
 * 			MaxSizeBytes:                  pulumi.String("268435456000"),
 * 			CreateMode:                    pulumi.String("Default"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = streamanalytics.NewOutputMssql(ctx, "example", &streamanalytics.OutputMssqlArgs{
 * 			Name: pulumi.String("example-output-sql"),
 * 			StreamAnalyticsJobName: pulumi.String(example.ApplyT(func(example streamanalytics.GetJobResult) (*string, error) {
 * 				return &example.Name, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			ResourceGroupName: pulumi.String(example.ApplyT(func(example streamanalytics.GetJobResult) (*string, error) {
 * 				return &example.ResourceGroupName, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			Server:   exampleSqlServer.FullyQualifiedDomainName,
 * 			User:     exampleSqlServer.AdministratorLogin,
 * 			Password: exampleSqlServer.AdministratorLoginPassword,
 * 			Database: exampleDatabase.Name,
 * 			Table:    pulumi.String("ExampleTable"),
 * 		})
 * 		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.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.streamanalytics.StreamanalyticsFunctions;
 * import com.pulumi.azure.streamanalytics.inputs.GetJobArgs;
 * import com.pulumi.azure.sql.SqlServer;
 * import com.pulumi.azure.sql.SqlServerArgs;
 * import com.pulumi.azure.sql.Database;
 * import com.pulumi.azure.sql.DatabaseArgs;
 * import com.pulumi.azure.streamanalytics.OutputMssql;
 * import com.pulumi.azure.streamanalytics.OutputMssqlArgs;
 * 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) {
 *         var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("rg-example")
 *             .location("West Europe")
 *             .build());
 *         final var example = StreamanalyticsFunctions.getJob(GetJobArgs.builder()
 *             .name("example-job")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 *         var exampleSqlServer = new SqlServer("exampleSqlServer", SqlServerArgs.builder()
 *             .name("example-server")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .version("12.0")
 *             .administratorLogin("dbadmin")
 *             .administratorLoginPassword("example-password")
 *             .build());
 *         var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
 *             .name("exampledb")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .serverName(exampleSqlServer.name())
 *             .requestedServiceObjectiveName("S0")
 *             .collation("SQL_LATIN1_GENERAL_CP1_CI_AS")
 *             .maxSizeBytes("268435456000")
 *             .createMode("Default")
 *             .build());
 *         var exampleOutputMssql = new OutputMssql("exampleOutputMssql", OutputMssqlArgs.builder()
 *             .name("example-output-sql")
 *             .streamAnalyticsJobName(example.applyValue(getJobResult -> getJobResult).applyValue(example -> example.applyValue(getJobResult -> getJobResult.name())))
 *             .resourceGroupName(example.applyValue(getJobResult -> getJobResult).applyValue(example -> example.applyValue(getJobResult -> getJobResult.resourceGroupName())))
 *             .server(exampleSqlServer.fullyQualifiedDomainName())
 *             .user(exampleSqlServer.administratorLogin())
 *             .password(exampleSqlServer.administratorLoginPassword())
 *             .database(exampleDatabase.name())
 *             .table("ExampleTable")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: rg-example
 *       location: West Europe
 *   exampleSqlServer:
 *     type: azure:sql:SqlServer
 *     name: example
 *     properties:
 *       name: example-server
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       version: '12.0'
 *       administratorLogin: dbadmin
 *       administratorLoginPassword: example-password
 *   exampleDatabase:
 *     type: azure:sql:Database
 *     name: example
 *     properties:
 *       name: exampledb
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       serverName: ${exampleSqlServer.name}
 *       requestedServiceObjectiveName: S0
 *       collation: SQL_LATIN1_GENERAL_CP1_CI_AS
 *       maxSizeBytes: '268435456000'
 *       createMode: Default
 *   exampleOutputMssql:
 *     type: azure:streamanalytics:OutputMssql
 *     name: example
 *     properties:
 *       name: example-output-sql
 *       streamAnalyticsJobName: ${example.name}
 *       resourceGroupName: ${example.resourceGroupName}
 *       server: ${exampleSqlServer.fullyQualifiedDomainName}
 *       user: ${exampleSqlServer.administratorLogin}
 *       password: ${exampleSqlServer.administratorLoginPassword}
 *       database: ${exampleDatabase.name}
 *       table: ExampleTable
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:streamanalytics:getJob
 *       Arguments:
 *         name: example-job
 *         resourceGroupName: ${exampleResourceGroup.name}
 * ```
 * 
 * ## Import
 * Stream Analytics Outputs to Microsoft SQL Server Database can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:streamanalytics/outputMssql:OutputMssql example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/outputs/output1
 * ```
 */
public class OutputMssql internal constructor(
    override val javaResource: com.pulumi.azure.streamanalytics.OutputMssql,
) : KotlinCustomResource(javaResource, OutputMssqlMapper) {
    /**
     * The authentication mode for the Stream Output. Possible values are `Msi` and `ConnectionString`. Defaults to `ConnectionString`.
     */
    public val authenticationMode: Output?
        get() = javaResource.authenticationMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The MS SQL database name where the reference table exists. Changing this forces a new resource to be created.
     */
    public val database: Output
        get() = javaResource.database().applyValue({ args0 -> args0 })

    /**
     * The max batch count to write to the SQL Database. Defaults to `10000`. Possible values are between `1` and `1073741824`.
     */
    public val maxBatchCount: Output?
        get() = javaResource.maxBatchCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The max writer count for the SQL Database. Defaults to `1`. Possible values are `0` which bases the writer count on the query partition and `1` which corresponds to a single writer.
     */
    public val maxWriterCount: Output?
        get() = javaResource.maxWriterCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * Password used together with username, to login to the Microsoft SQL Server. Required if `authentication_mode` is `ConnectionString`.
     */
    public val password: Output?
        get() = javaResource.password().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the Resource Group where the Stream Analytics Job exists. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The SQL server url. Changing this forces a new resource to be created.
     */
    public val server: Output
        get() = javaResource.server().applyValue({ args0 -> args0 })

    /**
     * The name of the Stream Analytics Job. Changing this forces a new resource to be created.
     */
    public val streamAnalyticsJobName: Output
        get() = javaResource.streamAnalyticsJobName().applyValue({ args0 -> args0 })

    /**
     * Table in the database that the output points to. Changing this forces a new resource to be created.
     */
    public val table: Output
        get() = javaResource.table().applyValue({ args0 -> args0 })

    /**
     * Username used to login to the Microsoft SQL Server. Changing this forces a new resource to be created. Required if `authentication_mode` is `ConnectionString`.
     */
    public val user: Output?
        get() = javaResource.user().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object OutputMssqlMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.streamanalytics.OutputMssql::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy