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

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

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

package com.pulumi.azure.lab.kotlin

import com.pulumi.azure.lab.kotlin.outputs.ServicePlanDefaultAutoShutdown
import com.pulumi.azure.lab.kotlin.outputs.ServicePlanDefaultConnection
import com.pulumi.azure.lab.kotlin.outputs.ServicePlanSupport
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.lab.kotlin.outputs.ServicePlanDefaultAutoShutdown.Companion.toKotlin as servicePlanDefaultAutoShutdownToKotlin
import com.pulumi.azure.lab.kotlin.outputs.ServicePlanDefaultConnection.Companion.toKotlin as servicePlanDefaultConnectionToKotlin
import com.pulumi.azure.lab.kotlin.outputs.ServicePlanSupport.Companion.toKotlin as servicePlanSupportToKotlin

/**
 * 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.lab.ServicePlan(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ServicePlan(builtJavaResource)
    }
}

/**
 * Manages a Lab Service Plan.
 * !> **Note:** This resource is being [deprecated by Azure](https://learn.microsoft.com/en-us/azure/lab-services/retirement-guide). This resource will be removed in version 4.0 of the provider.
 * > **Note:** Before using this resource, it's required to submit the request of registering the provider with Azure CLI `az provider register --namespace Microsoft.LabServices`.
 * ## 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.lab.ServicePlan("example", {
 *     name: "example-lp",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     allowedRegions: [example.location],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_service_plan = azure.lab.ServicePlan("example",
 *     name="example-lp",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     allowed_regions=[example.location])
 * ```
 * ```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.Lab.ServicePlan("example", new()
 *     {
 *         Name = "example-lp",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AllowedRegions = new[]
 *         {
 *             example.Location,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/lab"
 * 	"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 = lab.NewServicePlan(ctx, "example", &lab.ServicePlanArgs{
 * 			Name:              pulumi.String("example-lp"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			AllowedRegions: pulumi.StringArray{
 * 				example.Location,
 * 			},
 * 		})
 * 		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.lab.ServicePlan;
 * import com.pulumi.azure.lab.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-lp")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .allowedRegions(example.location())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleServicePlan:
 *     type: azure:lab:ServicePlan
 *     name: example
 *     properties:
 *       name: example-lp
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       allowedRegions:
 *         - ${example.location}
 * ```
 * 
 * ## Import
 * Lab Service Plans can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:lab/servicePlan:ServicePlan example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.LabServices/labPlans/labPlan1
 * ```
 */
public class ServicePlan internal constructor(
    override val javaResource: com.pulumi.azure.lab.ServicePlan,
) : KotlinCustomResource(javaResource, ServicePlanMapper) {
    /**
     * The allowed regions for the lab creator to use when creating labs using this Lab Service Plan. The allowed region's count must be between `1` and `28`.
     */
    public val allowedRegions: Output>
        get() = javaResource.allowedRegions().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A `default_auto_shutdown` block as defined below.
     */
    public val defaultAutoShutdown: Output?
        get() = javaResource.defaultAutoShutdown().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> servicePlanDefaultAutoShutdownToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `default_connection` block as defined below.
     */
    public val defaultConnection: Output?
        get() = javaResource.defaultConnection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> servicePlanDefaultConnectionToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The resource ID of the Subnet for the Lab Service Plan network profile.
     */
    public val defaultNetworkSubnetId: Output?
        get() = javaResource.defaultNetworkSubnetId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

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

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

    /**
     * The resource ID of the Shared Image Gallery attached to this Lab Service Plan. When saving a lab template virtual machine image it will be persisted in this gallery. The shared images from the gallery can be made available to use when creating new labs.
     * > **NOTE:** The built-in `Azure Lab Services` Service Principal with role needs to be assigned to the Shared Image Gallery while using this property.
     */
    public val sharedGalleryId: Output?
        get() = javaResource.sharedGalleryId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `support` block as defined below.
     */
    public val support: Output?
        get() = javaResource.support().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    servicePlanSupportToKotlin(args0)
                })
            }).orElse(null)
        })

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

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

    override fun map(javaResource: Resource): ServicePlan = ServicePlan(
        javaResource as
            com.pulumi.azure.lab.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