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

com.pulumi.azure.appservice.kotlin.ServicePlan.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.appservice.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

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

    public var args: ServicePlanArgs = ServicePlanArgs()

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

/**
 * Manages an App Service: Service Plan.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleServicePlan = new azure.appservice.ServicePlan("example", {
 *     name: "example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     osType: "Linux",
 *     skuName: "P1v2",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_service_plan = azure.appservice.ServicePlan("example",
 *     name="example",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     os_type="Linux",
 *     sku_name="P1v2")
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         OsType = "Linux",
 *         SkuName = "P1v2",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			OsType:            pulumi.String("Linux"),
 * 			SkuName:           pulumi.String("P1v2"),
 * 		})
 * 		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.appservice.ServicePlan;
 * import com.pulumi.azure.appservice.ServicePlanArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .osType("Linux")
 *             .skuName("P1v2")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleServicePlan:
 *     type: azure:appservice:ServicePlan
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       osType: Linux
 *       skuName: P1v2
 * ```
 * 
 * ## Import
 * AppServices can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/servicePlan:ServicePlan example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/serverFarms/farm1
 * ```
 */
public class ServicePlan internal constructor(
    override val javaResource: com.pulumi.azure.appservice.ServicePlan,
) : KotlinCustomResource(javaResource, ServicePlanMapper) {
    /**
     * The ID of the App Service Environment to create this Service Plan in.
     * > **NOTE:** Requires an Isolated SKU. Use one of `I1`, `I2`, `I3` for `azure.appservice.Environment`, or `I1v2`, `I2v2`, `I3v2` for `azure.appservice.EnvironmentV3`
     */
    public val appServiceEnvironmentId: Output?
        get() = javaResource.appServiceEnvironmentId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A string representing the Kind of Service Plan.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * The Azure Region where the Service Plan should exist. Changing this forces a new Service Plan to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The maximum number of workers to use in an Elastic SKU Plan. Cannot be set unless using an Elastic SKU.
     */
    public val maximumElasticWorkerCount: Output
        get() = javaResource.maximumElasticWorkerCount().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Service Plan. Changing this forces a new Service Plan to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The O/S type for the App Services to be hosted in this plan. Possible values include `Windows`, `Linux`, and `WindowsContainer`. Changing this forces a new resource to be created.
     */
    public val osType: Output
        get() = javaResource.osType().applyValue({ args0 -> args0 })

    /**
     * Should Per Site Scaling be enabled. Defaults to `false`.
     */
    public val perSiteScalingEnabled: Output?
        get() = javaResource.perSiteScalingEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether this is a reserved Service Plan Type. `true` if `os_type` is `Linux`, otherwise `false`.
     */
    public val reserved: Output
        get() = javaResource.reserved().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the Service Plan should exist. Changing this forces a new Service Plan to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The SKU for the plan. Possible values include `B1`, `B2`, `B3`, `D1`, `F1`, `I1`, `I2`, `I3`, `I1v2`, `I2v2`, `I3v2`, `I4v2`, `I5v2`, `I6v2`, `P1v2`, `P2v2`, `P3v2`, `P0v3`, `P1v3`, `P2v3`, `P3v3`, `P1mv3`, `P2mv3`, `P3mv3`, `P4mv3`, `P5mv3`, `S1`, `S2`, `S3`, `SHARED`, `EP1`, `EP2`, `EP3`, `FC1`, `WS1`, `WS2`, `WS3`, and `Y1`.
     * > **NOTE:** Isolated SKUs (`I1`, `I2`, `I3`, `I1v2`, `I2v2`, and `I3v2`) can only be used with App Service Environments
     * > **NOTE:** Elastic and Consumption SKUs (`Y1`, `FC1`, `EP1`, `EP2`, and `EP3`) are for use with Function Apps.
     */
    public val skuName: Output
        get() = javaResource.skuName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the AppService.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The number of Workers (instances) to be allocated.
     */
    public val workerCount: Output
        get() = javaResource.workerCount().applyValue({ args0 -> args0 })

    /**
     * Should the Service Plan balance across Availability Zones in the region. Changing this forces a new resource to be created.
     * > **NOTE:** If this setting is set to `true` and the `worker_count` value is specified, it should be set to a multiple of the number of availability zones in the region. Please see the Azure documentation for the number of Availability Zones in your region.
     */
    public val zoneBalancingEnabled: Output?
        get() = javaResource.zoneBalancingEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object ServicePlanMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appservice.ServicePlan::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy