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

com.pulumi.azure.mssql.kotlin.ElasticPool.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.mssql.kotlin

import com.pulumi.azure.mssql.kotlin.outputs.ElasticPoolPerDatabaseSettings
import com.pulumi.azure.mssql.kotlin.outputs.ElasticPoolSku
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.azure.mssql.kotlin.outputs.ElasticPoolPerDatabaseSettings.Companion.toKotlin as elasticPoolPerDatabaseSettingsToKotlin
import com.pulumi.azure.mssql.kotlin.outputs.ElasticPoolSku.Companion.toKotlin as elasticPoolSkuToKotlin

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

    public var args: ElasticPoolArgs = ElasticPoolArgs()

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

/**
 * Allows you to manage an Azure SQL Elastic Pool.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "my-resource-group",
 *     location: "West Europe",
 * });
 * const exampleServer = new azure.mssql.Server("example", {
 *     name: "my-sql-server",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "4dm1n157r470r",
 *     administratorLoginPassword: "4-v3ry-53cr37-p455w0rd",
 * });
 * const exampleElasticPool = new azure.mssql.ElasticPool("example", {
 *     name: "test-epool",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     serverName: exampleServer.name,
 *     licenseType: "LicenseIncluded",
 *     maxSizeGb: 756,
 *     sku: {
 *         name: "BasicPool",
 *         tier: "Basic",
 *         family: "Gen4",
 *         capacity: 4,
 *     },
 *     perDatabaseSettings: {
 *         minCapacity: 0.25,
 *         maxCapacity: 4,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="my-resource-group",
 *     location="West Europe")
 * example_server = azure.mssql.Server("example",
 *     name="my-sql-server",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     version="12.0",
 *     administrator_login="4dm1n157r470r",
 *     administrator_login_password="4-v3ry-53cr37-p455w0rd")
 * example_elastic_pool = azure.mssql.ElasticPool("example",
 *     name="test-epool",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     server_name=example_server.name,
 *     license_type="LicenseIncluded",
 *     max_size_gb=756,
 *     sku=azure.mssql.ElasticPoolSkuArgs(
 *         name="BasicPool",
 *         tier="Basic",
 *         family="Gen4",
 *         capacity=4,
 *     ),
 *     per_database_settings=azure.mssql.ElasticPoolPerDatabaseSettingsArgs(
 *         min_capacity=0.25,
 *         max_capacity=4,
 *     ))
 * ```
 * ```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 = "my-resource-group",
 *         Location = "West Europe",
 *     });
 *     var exampleServer = new Azure.MSSql.Server("example", new()
 *     {
 *         Name = "my-sql-server",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Version = "12.0",
 *         AdministratorLogin = "4dm1n157r470r",
 *         AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
 *     });
 *     var exampleElasticPool = new Azure.MSSql.ElasticPool("example", new()
 *     {
 *         Name = "test-epool",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         ServerName = exampleServer.Name,
 *         LicenseType = "LicenseIncluded",
 *         MaxSizeGb = 756,
 *         Sku = new Azure.MSSql.Inputs.ElasticPoolSkuArgs
 *         {
 *             Name = "BasicPool",
 *             Tier = "Basic",
 *             Family = "Gen4",
 *             Capacity = 4,
 *         },
 *         PerDatabaseSettings = new Azure.MSSql.Inputs.ElasticPoolPerDatabaseSettingsArgs
 *         {
 *             MinCapacity = 0.25,
 *             MaxCapacity = 4,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
 * 	"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("my-resource-group"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
 * 			Name:                       pulumi.String("my-sql-server"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			Version:                    pulumi.String("12.0"),
 * 			AdministratorLogin:         pulumi.String("4dm1n157r470r"),
 * 			AdministratorLoginPassword: pulumi.String("4-v3ry-53cr37-p455w0rd"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mssql.NewElasticPool(ctx, "example", &mssql.ElasticPoolArgs{
 * 			Name:              pulumi.String("test-epool"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			ServerName:        exampleServer.Name,
 * 			LicenseType:       pulumi.String("LicenseIncluded"),
 * 			MaxSizeGb:         pulumi.Float64(756),
 * 			Sku: &mssql.ElasticPoolSkuArgs{
 * 				Name:     pulumi.String("BasicPool"),
 * 				Tier:     pulumi.String("Basic"),
 * 				Family:   pulumi.String("Gen4"),
 * 				Capacity: pulumi.Int(4),
 * 			},
 * 			PerDatabaseSettings: &mssql.ElasticPoolPerDatabaseSettingsArgs{
 * 				MinCapacity: pulumi.Float64(0.25),
 * 				MaxCapacity: pulumi.Float64(4),
 * 			},
 * 		})
 * 		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.mssql.Server;
 * import com.pulumi.azure.mssql.ServerArgs;
 * import com.pulumi.azure.mssql.ElasticPool;
 * import com.pulumi.azure.mssql.ElasticPoolArgs;
 * import com.pulumi.azure.mssql.inputs.ElasticPoolSkuArgs;
 * import com.pulumi.azure.mssql.inputs.ElasticPoolPerDatabaseSettingsArgs;
 * 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("my-resource-group")
 *             .location("West Europe")
 *             .build());
 *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
 *             .name("my-sql-server")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .version("12.0")
 *             .administratorLogin("4dm1n157r470r")
 *             .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
 *             .build());
 *         var exampleElasticPool = new ElasticPool("exampleElasticPool", ElasticPoolArgs.builder()
 *             .name("test-epool")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .serverName(exampleServer.name())
 *             .licenseType("LicenseIncluded")
 *             .maxSizeGb(756)
 *             .sku(ElasticPoolSkuArgs.builder()
 *                 .name("BasicPool")
 *                 .tier("Basic")
 *                 .family("Gen4")
 *                 .capacity(4)
 *                 .build())
 *             .perDatabaseSettings(ElasticPoolPerDatabaseSettingsArgs.builder()
 *                 .minCapacity(0.25)
 *                 .maxCapacity(4)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: my-resource-group
 *       location: West Europe
 *   exampleServer:
 *     type: azure:mssql:Server
 *     name: example
 *     properties:
 *       name: my-sql-server
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       version: '12.0'
 *       administratorLogin: 4dm1n157r470r
 *       administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
 *   exampleElasticPool:
 *     type: azure:mssql:ElasticPool
 *     name: example
 *     properties:
 *       name: test-epool
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       serverName: ${exampleServer.name}
 *       licenseType: LicenseIncluded
 *       maxSizeGb: 756
 *       sku:
 *         name: BasicPool
 *         tier: Basic
 *         family: Gen4
 *         capacity: 4
 *       perDatabaseSettings:
 *         minCapacity: 0.25
 *         maxCapacity: 4
 * ```
 * 
 * ## Import
 * SQL Elastic Pool can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:mssql/elasticPool:ElasticPool example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/elasticPools/myelasticpoolname
 * ```
 */
public class ElasticPool internal constructor(
    override val javaResource: com.pulumi.azure.mssql.ElasticPool,
) : KotlinCustomResource(javaResource, ElasticPoolMapper) {
    /**
     * Specifies the type of enclave to be used by the elastic pool. When `enclave_type` is not specified (e.g., the default) enclaves are not enabled on the elastic pool.