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

com.pulumi.azure.sql.kotlin.SqlServerArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.sql.kotlin

import com.pulumi.azure.sql.SqlServerArgs.builder
import com.pulumi.azure.sql.kotlin.inputs.SqlServerIdentityArgs
import com.pulumi.azure.sql.kotlin.inputs.SqlServerIdentityArgsBuilder
import com.pulumi.azure.sql.kotlin.inputs.SqlServerThreatDetectionPolicyArgs
import com.pulumi.azure.sql.kotlin.inputs.SqlServerThreatDetectionPolicyArgsBuilder
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Microsoft SQL Azure Database Server.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "database-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "examplesa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleSqlServer = new azure.sql.SqlServer("example", {
 *     name: "mssqlserver",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "mradministrator",
 *     administratorLoginPassword: "thisIsDog11",
 *     tags: {
 *         environment: "production",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="database-rg",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="examplesa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_sql_server = azure.sql.SqlServer("example",
 *     name="mssqlserver",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     version="12.0",
 *     administrator_login="mradministrator",
 *     administrator_login_password="thisIsDog11",
 *     tags={
 *         "environment": "production",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "database-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "examplesa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleSqlServer = new Azure.Sql.SqlServer("example", new()
 *     {
 *         Name = "mssqlserver",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Version = "12.0",
 *         AdministratorLogin = "mradministrator",
 *         AdministratorLoginPassword = "thisIsDog11",
 *         Tags =
 *         {
 *             { "environment", "production" },
 *         },
 *     });
 * });
 * ```
 * ```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/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("database-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplesa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = sql.NewSqlServer(ctx, "example", &sql.SqlServerArgs{
 * 			Name:                       pulumi.String("mssqlserver"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			Version:                    pulumi.String("12.0"),
 * 			AdministratorLogin:         pulumi.String("mradministrator"),
 * 			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("production"),
 * 			},
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.sql.SqlServer;
 * import com.pulumi.azure.sql.SqlServerArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("database-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("examplesa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleSqlServer = new SqlServer("exampleSqlServer", SqlServerArgs.builder()
 *             .name("mssqlserver")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .version("12.0")
 *             .administratorLogin("mradministrator")
 *             .administratorLoginPassword("thisIsDog11")
 *             .tags(Map.of("environment", "production"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: database-rg
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplesa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleSqlServer:
 *     type: azure:sql:SqlServer
 *     name: example
 *     properties:
 *       name: mssqlserver
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       version: '12.0'
 *       administratorLogin: mradministrator
 *       administratorLoginPassword: thisIsDog11
 *       tags:
 *         environment: production
 * ```
 * 
 * ## Import
 * SQL Servers can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:sql/sqlServer:SqlServer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver
 * ```
 * @property administratorLogin The administrator login name for the new server. Changing this forces a new resource to be created.
 * @property administratorLoginPassword The password associated with the `administrator_login` user. Needs to comply with Azure's [Password Policy](https://msdn.microsoft.com/library/ms161959.aspx)
 * @property connectionPolicy The connection policy the server will use. Possible values are `Default`, `Proxy`, and `Redirect`. Defaults to `Default`.
 * @property identity An `identity` block as defined below.
 * @property location Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
 * @property name The name of the Microsoft SQL Server. This needs to be globally unique within Azure. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which to create the Microsoft SQL Server. Changing this forces a new resource to be created.
 * @property tags A mapping of tags to assign to the resource.
 * @property threatDetectionPolicy Threat detection policy configuration. The `threat_detection_policy` block supports fields documented below.
 * @property version The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). Changing this forces a new resource to be created.
 */
public data class SqlServerArgs(
    public val administratorLogin: Output? = null,
    public val administratorLoginPassword: Output? = null,
    public val connectionPolicy: Output? = null,
    public val identity: Output? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val tags: Output>? = null,
    public val threatDetectionPolicy: Output? = null,
    public val version: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.sql.SqlServerArgs =
        com.pulumi.azure.sql.SqlServerArgs.builder()
            .administratorLogin(administratorLogin?.applyValue({ args0 -> args0 }))
            .administratorLoginPassword(administratorLoginPassword?.applyValue({ args0 -> args0 }))
            .connectionPolicy(connectionPolicy?.applyValue({ args0 -> args0 }))
            .identity(identity?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .threatDetectionPolicy(
                threatDetectionPolicy?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .version(version?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SqlServerArgs].
 */
@PulumiTagMarker
public class SqlServerArgsBuilder internal constructor() {
    private var administratorLogin: Output? = null

    private var administratorLoginPassword: Output? = null

    private var connectionPolicy: Output? = null

    private var identity: Output? = null

    private var location: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var tags: Output>? = null

    private var threatDetectionPolicy: Output? = null

    private var version: Output? = null

    /**
     * @param value The administrator login name for the new server. Changing this forces a new resource to be created.
     */
    @JvmName("byqtmxkgyhpmvbpd")
    public suspend fun administratorLogin(`value`: Output) {
        this.administratorLogin = value
    }

    /**
     * @param value The password associated with the `administrator_login` user. Needs to comply with Azure's [Password Policy](https://msdn.microsoft.com/library/ms161959.aspx)
     */
    @JvmName("whlmgjhixilkobfl")
    public suspend fun administratorLoginPassword(`value`: Output) {
        this.administratorLoginPassword = value
    }

    /**
     * @param value The connection policy the server will use. Possible values are `Default`, `Proxy`, and `Redirect`. Defaults to `Default`.
     */
    @JvmName("ykoaedudkikplfbq")
    public suspend fun connectionPolicy(`value`: Output) {
        this.connectionPolicy = value
    }

    /**
     * @param value An `identity` block as defined below.
     */
    @JvmName("arkdberqiehxdwlg")
    public suspend fun identity(`value`: Output) {
        this.identity = value
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("kyaeusxbtkrbggad")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value The name of the Microsoft SQL Server. This needs to be globally unique within Azure. Changing this forces a new resource to be created.
     */
    @JvmName("sguhhrirevnjqabx")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the resource group in which to create the Microsoft SQL Server. Changing this forces a new resource to be created.
     */
    @JvmName("qlxrnfshadkgivjh")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("wrbxnxdvjwbkrvjm")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Threat detection policy configuration. The `threat_detection_policy` block supports fields documented below.
     */
    @JvmName("kjrttxduwcmxrbeo")
    public suspend fun threatDetectionPolicy(`value`: Output) {
        this.threatDetectionPolicy = value
    }

    /**
     * @param value The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). Changing this forces a new resource to be created.
     */
    @JvmName("toaxbyrkxgaqgfus")
    public suspend fun version(`value`: Output) {
        this.version = value
    }

    /**
     * @param value The administrator login name for the new server. Changing this forces a new resource to be created.
     */
    @JvmName("jxkdnpsgljbixxqj")
    public suspend fun administratorLogin(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.administratorLogin = mapped
    }

    /**
     * @param value The password associated with the `administrator_login` user. Needs to comply with Azure's [Password Policy](https://msdn.microsoft.com/library/ms161959.aspx)
     */
    @JvmName("hgclscxuhidkkbxv")
    public suspend fun administratorLoginPassword(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.administratorLoginPassword = mapped
    }

    /**
     * @param value The connection policy the server will use. Possible values are `Default`, `Proxy`, and `Redirect`. Defaults to `Default`.
     */
    @JvmName("xjuxiqyfdejpwimt")
    public suspend fun connectionPolicy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.connectionPolicy = mapped
    }

    /**
     * @param value An `identity` block as defined below.
     */
    @JvmName("wicvmtnusfxuiiym")
    public suspend fun identity(`value`: SqlServerIdentityArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.identity = mapped
    }

    /**
     * @param argument An `identity` block as defined below.
     */
    @JvmName("gfgpyipilqfhenpx")
    public suspend fun identity(argument: suspend SqlServerIdentityArgsBuilder.() -> Unit) {
        val toBeMapped = SqlServerIdentityArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.identity = mapped
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("upxadfegkrmjwnmy")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value The name of the Microsoft SQL Server. This needs to be globally unique within Azure. Changing this forces a new resource to be created.
     */
    @JvmName("bnjwhouhypwyqynh")
    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 to create the Microsoft SQL Server. Changing this forces a new resource to be created.
     */
    @JvmName("jvkjlksllsplwhaa")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("oanthkfhgqdotsrn")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("fvbelfmvtlsfkeuf")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Threat detection policy configuration. The `threat_detection_policy` block supports fields documented below.
     */
    @JvmName("mqjnixwwwgtlirwh")
    public suspend fun threatDetectionPolicy(`value`: SqlServerThreatDetectionPolicyArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.threatDetectionPolicy = mapped
    }

    /**
     * @param argument Threat detection policy configuration. The `threat_detection_policy` block supports fields documented below.
     */
    @JvmName("npsltepyxmcfwbto")
    public suspend fun threatDetectionPolicy(argument: suspend SqlServerThreatDetectionPolicyArgsBuilder.() -> Unit) {
        val toBeMapped = SqlServerThreatDetectionPolicyArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.threatDetectionPolicy = mapped
    }

    /**
     * @param value The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). Changing this forces a new resource to be created.
     */
    @JvmName("egeenfmukjfsfnlq")
    public suspend fun version(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.version = mapped
    }

    internal fun build(): SqlServerArgs = SqlServerArgs(
        administratorLogin = administratorLogin,
        administratorLoginPassword = administratorLoginPassword,
        connectionPolicy = connectionPolicy,
        identity = identity,
        location = location,
        name = name,
        resourceGroupName = resourceGroupName,
        tags = tags,
        threatDetectionPolicy = threatDetectionPolicy,
        version = version,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy