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

com.pulumi.azure.lab.kotlin.Lab.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.lab.kotlin

import com.pulumi.azure.lab.kotlin.outputs.LabAutoShutdown
import com.pulumi.azure.lab.kotlin.outputs.LabConnectionSetting
import com.pulumi.azure.lab.kotlin.outputs.LabNetwork
import com.pulumi.azure.lab.kotlin.outputs.LabRoster
import com.pulumi.azure.lab.kotlin.outputs.LabSecurity
import com.pulumi.azure.lab.kotlin.outputs.LabVirtualMachine
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.Map
import com.pulumi.azure.lab.kotlin.outputs.LabAutoShutdown.Companion.toKotlin as labAutoShutdownToKotlin
import com.pulumi.azure.lab.kotlin.outputs.LabConnectionSetting.Companion.toKotlin as labConnectionSettingToKotlin
import com.pulumi.azure.lab.kotlin.outputs.LabNetwork.Companion.toKotlin as labNetworkToKotlin
import com.pulumi.azure.lab.kotlin.outputs.LabRoster.Companion.toKotlin as labRosterToKotlin
import com.pulumi.azure.lab.kotlin.outputs.LabSecurity.Companion.toKotlin as labSecurityToKotlin
import com.pulumi.azure.lab.kotlin.outputs.LabVirtualMachine.Companion.toKotlin as labVirtualMachineToKotlin

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

    public var args: LabArgs = LabArgs()

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

/**
 * Manages a Lab Service Lab.
 * !> **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.
 * ## 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 exampleLab = new azure.lab.Lab("example", {
 *     name: "example-lab",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     title: "Test Title",
 *     security: {
 *         openAccessEnabled: false,
 *     },
 *     virtualMachine: {
 *         adminUser: {
 *             username: "testadmin",
 *             password: "Password1234!",
 *         },
 *         imageReference: {
 *             publisher: "Canonical",
 *             offer: "0001-com-ubuntu-server-jammy",
 *             sku: "22_04-lts",
 *             version: "latest",
 *         },
 *         sku: {
 *             name: "Classic_Fsv2_2_4GB_128_S_SSD",
 *             capacity: 0,
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_lab = azure.lab.Lab("example",
 *     name="example-lab",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     title="Test Title",
 *     security={
 *         "open_access_enabled": False,
 *     },
 *     virtual_machine={
 *         "admin_user": {
 *             "username": "testadmin",
 *             "password": "Password1234!",
 *         },
 *         "image_reference": {
 *             "publisher": "Canonical",
 *             "offer": "0001-com-ubuntu-server-jammy",
 *             "sku": "22_04-lts",
 *             "version": "latest",
 *         },
 *         "sku": {
 *             "name": "Classic_Fsv2_2_4GB_128_S_SSD",
 *             "capacity": 0,
 *         },
 *     })
 * ```
 * ```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 exampleLab = new Azure.Lab.Lab("example", new()
 *     {
 *         Name = "example-lab",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Title = "Test Title",
 *         Security = new Azure.Lab.Inputs.LabSecurityArgs
 *         {
 *             OpenAccessEnabled = false,
 *         },
 *         VirtualMachine = new Azure.Lab.Inputs.LabVirtualMachineArgs
 *         {
 *             AdminUser = new Azure.Lab.Inputs.LabVirtualMachineAdminUserArgs
 *             {
 *                 Username = "testadmin",
 *                 Password = "Password1234!",
 *             },
 *             ImageReference = new Azure.Lab.Inputs.LabVirtualMachineImageReferenceArgs
 *             {
 *                 Publisher = "Canonical",
 *                 Offer = "0001-com-ubuntu-server-jammy",
 *                 Sku = "22_04-lts",
 *                 Version = "latest",
 *             },
 *             Sku = new Azure.Lab.Inputs.LabVirtualMachineSkuArgs
 *             {
 *                 Name = "Classic_Fsv2_2_4GB_128_S_SSD",
 *                 Capacity = 0,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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.NewLab(ctx, "example", &lab.LabArgs{
 * 			Name:              pulumi.String("example-lab"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Title:             pulumi.String("Test Title"),
 * 			Security: &lab.LabSecurityArgs{
 * 				OpenAccessEnabled: pulumi.Bool(false),
 * 			},
 * 			VirtualMachine: &lab.LabVirtualMachineArgs{
 * 				AdminUser: &lab.LabVirtualMachineAdminUserArgs{
 * 					Username: pulumi.String("testadmin"),
 * 					Password: pulumi.String("Password1234!"),
 * 				},
 * 				ImageReference: &lab.LabVirtualMachineImageReferenceArgs{
 * 					Publisher: pulumi.String("Canonical"),
 * 					Offer:     pulumi.String("0001-com-ubuntu-server-jammy"),
 * 					Sku:       pulumi.String("22_04-lts"),
 * 					Version:   pulumi.String("latest"),
 * 				},
 * 				Sku: &lab.LabVirtualMachineSkuArgs{
 * 					Name:     pulumi.String("Classic_Fsv2_2_4GB_128_S_SSD"),
 * 					Capacity: pulumi.Int(0),
 * 				},
 * 			},
 * 		})
 * 		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.Lab;
 * import com.pulumi.azure.lab.LabArgs;
 * import com.pulumi.azure.lab.inputs.LabSecurityArgs;
 * import com.pulumi.azure.lab.inputs.LabVirtualMachineArgs;
 * import com.pulumi.azure.lab.inputs.LabVirtualMachineAdminUserArgs;
 * import com.pulumi.azure.lab.inputs.LabVirtualMachineImageReferenceArgs;
 * import com.pulumi.azure.lab.inputs.LabVirtualMachineSkuArgs;
 * 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 exampleLab = new Lab("exampleLab", LabArgs.builder()
 *             .name("example-lab")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .title("Test Title")
 *             .security(LabSecurityArgs.builder()
 *                 .openAccessEnabled(false)
 *                 .build())
 *             .virtualMachine(LabVirtualMachineArgs.builder()
 *                 .adminUser(LabVirtualMachineAdminUserArgs.builder()
 *                     .username("testadmin")
 *                     .password("Password1234!")
 *                     .build())
 *                 .imageReference(LabVirtualMachineImageReferenceArgs.builder()
 *                     .publisher("Canonical")
 *                     .offer("0001-com-ubuntu-server-jammy")
 *                     .sku("22_04-lts")
 *                     .version("latest")
 *                     .build())
 *                 .sku(LabVirtualMachineSkuArgs.builder()
 *                     .name("Classic_Fsv2_2_4GB_128_S_SSD")
 *                     .capacity(0)
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleLab:
 *     type: azure:lab:Lab
 *     name: example
 *     properties:
 *       name: example-lab
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       title: Test Title
 *       security:
 *         openAccessEnabled: false
 *       virtualMachine:
 *         adminUser:
 *           username: testadmin
 *           password: Password1234!
 *         imageReference:
 *           publisher: Canonical
 *           offer: 0001-com-ubuntu-server-jammy
 *           sku: 22_04-lts
 *           version: latest
 *         sku:
 *           name: Classic_Fsv2_2_4GB_128_S_SSD
 *           capacity: 0
 * ```
 * 
 * ## Import
 * Lab Service Labs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:lab/lab:Lab example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.LabServices/labs/lab1
 * ```
 */
public class Lab internal constructor(
    override val javaResource: com.pulumi.azure.lab.Lab,
) : KotlinCustomResource(javaResource, LabMapper) {
    /**
     * An `auto_shutdown` block as defined below.
     */
    public val autoShutdown: Output?
        get() = javaResource.autoShutdown().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    labAutoShutdownToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `connection_setting` block as defined below.
     */
    public val connectionSetting: Output
        get() = javaResource.connectionSetting().applyValue({ args0 ->
            args0.let({ args0 ->
                labConnectionSettingToKotlin(args0)
            })
        })

    /**
     * The description of the Lab Service Lab.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The resource ID of the Lab Plan that is used during resource creation to provide defaults and acts as a permission container when creating a Lab Service Lab via `labs.azure.com`.
     */
    public val labPlanId: Output?
        get() = javaResource.labPlanId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

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

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

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

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

    /**
     * A `security` block as defined below.
     */
    public val security: Output
        get() = javaResource.security().applyValue({ args0 ->
            args0.let({ args0 ->
                labSecurityToKotlin(args0)
            })
        })

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

    /**
     * The title of the Lab Service Lab.
     */
    public val title: Output
        get() = javaResource.title().applyValue({ args0 -> args0 })

    /**
     * A `virtual_machine` block as defined below.
     */
    public val virtualMachine: Output
        get() = javaResource.virtualMachine().applyValue({ args0 ->
            args0.let({ args0 ->
                labVirtualMachineToKotlin(args0)
            })
        })
}

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

    override fun map(javaResource: Resource): Lab = Lab(javaResource as com.pulumi.azure.lab.Lab)
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy