com.pulumi.azure.devtest.kotlin.WindowsVirtualMachine.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.devtest.kotlin
import com.pulumi.azure.devtest.kotlin.outputs.WindowsVirtualMachineGalleryImageReference
import com.pulumi.azure.devtest.kotlin.outputs.WindowsVirtualMachineInboundNatRule
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.devtest.kotlin.outputs.WindowsVirtualMachineGalleryImageReference.Companion.toKotlin as windowsVirtualMachineGalleryImageReferenceToKotlin
import com.pulumi.azure.devtest.kotlin.outputs.WindowsVirtualMachineInboundNatRule.Companion.toKotlin as windowsVirtualMachineInboundNatRuleToKotlin
/**
* Builder for [WindowsVirtualMachine].
*/
@PulumiTagMarker
public class WindowsVirtualMachineResourceBuilder internal constructor() {
public var name: String? = null
public var args: WindowsVirtualMachineArgs = WindowsVirtualMachineArgs()
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 WindowsVirtualMachineArgsBuilder.() -> Unit) {
val builder = WindowsVirtualMachineArgsBuilder()
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(): WindowsVirtualMachine {
val builtJavaResource = com.pulumi.azure.devtest.WindowsVirtualMachine(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return WindowsVirtualMachine(builtJavaResource)
}
}
/**
* Manages a Windows Virtual Machine within a Dev Test Lab.
* ## 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.devtest.Lab("example", {
* name: "example-devtestlab",
* location: example.location,
* resourceGroupName: example.name,
* tags: {
* Sydney: "Australia",
* },
* });
* const exampleVirtualNetwork = new azure.devtest.VirtualNetwork("example", {
* name: "example-network",
* labName: exampleLab.name,
* resourceGroupName: example.name,
* subnet: {
* usePublicIpAddress: "Allow",
* useInVirtualMachineCreation: "Allow",
* },
* });
* const exampleWindowsVirtualMachine = new azure.devtest.WindowsVirtualMachine("example", {
* name: "example-vm03",
* labName: exampleLab.name,
* resourceGroupName: example.name,
* location: example.location,
* size: "Standard_DS2",
* username: "exampleuser99",
* password: "Pa$w0rd1234!",
* labVirtualNetworkId: exampleVirtualNetwork.id,
* labSubnetName: exampleVirtualNetwork.subnet.apply(subnet => subnet.name),
* storageType: "Premium",
* notes: "Some notes about this Virtual Machine.",
* galleryImageReference: {
* offer: "WindowsServer",
* publisher: "MicrosoftWindowsServer",
* sku: "2019-Datacenter",
* version: "latest",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_lab = azure.devtest.Lab("example",
* name="example-devtestlab",
* location=example.location,
* resource_group_name=example.name,
* tags={
* "Sydney": "Australia",
* })
* example_virtual_network = azure.devtest.VirtualNetwork("example",
* name="example-network",
* lab_name=example_lab.name,
* resource_group_name=example.name,
* subnet=azure.devtest.VirtualNetworkSubnetArgs(
* use_public_ip_address="Allow",
* use_in_virtual_machine_creation="Allow",
* ))
* example_windows_virtual_machine = azure.devtest.WindowsVirtualMachine("example",
* name="example-vm03",
* lab_name=example_lab.name,
* resource_group_name=example.name,
* location=example.location,
* size="Standard_DS2",
* username="exampleuser99",
* password="Pa$w0rd1234!",
* lab_virtual_network_id=example_virtual_network.id,
* lab_subnet_name=example_virtual_network.subnet.name,
* storage_type="Premium",
* notes="Some notes about this Virtual Machine.",
* gallery_image_reference=azure.devtest.WindowsVirtualMachineGalleryImageReferenceArgs(
* offer="WindowsServer",
* publisher="MicrosoftWindowsServer",
* sku="2019-Datacenter",
* version="latest",
* ))
* ```
* ```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.DevTest.Lab("example", new()
* {
* Name = "example-devtestlab",
* Location = example.Location,
* ResourceGroupName = example.Name,
* Tags =
* {
* { "Sydney", "Australia" },
* },
* });
* var exampleVirtualNetwork = new Azure.DevTest.VirtualNetwork("example", new()
* {
* Name = "example-network",
* LabName = exampleLab.Name,
* ResourceGroupName = example.Name,
* Subnet = new Azure.DevTest.Inputs.VirtualNetworkSubnetArgs
* {
* UsePublicIpAddress = "Allow",
* UseInVirtualMachineCreation = "Allow",
* },
* });
* var exampleWindowsVirtualMachine = new Azure.DevTest.WindowsVirtualMachine("example", new()
* {
* Name = "example-vm03",
* LabName = exampleLab.Name,
* ResourceGroupName = example.Name,
* Location = example.Location,
* Size = "Standard_DS2",
* Username = "exampleuser99",
* Password = "Pa$w0rd1234!",
* LabVirtualNetworkId = exampleVirtualNetwork.Id,
* LabSubnetName = exampleVirtualNetwork.Subnet.Apply(subnet => subnet.Name),
* StorageType = "Premium",
* Notes = "Some notes about this Virtual Machine.",
* GalleryImageReference = new Azure.DevTest.Inputs.WindowsVirtualMachineGalleryImageReferenceArgs
* {
* Offer = "WindowsServer",
* Publisher = "MicrosoftWindowsServer",
* Sku = "2019-Datacenter",
* Version = "latest",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/devtest"
* "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
* }
* exampleLab, err := devtest.NewLab(ctx, "example", &devtest.LabArgs{
* Name: pulumi.String("example-devtestlab"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* Tags: pulumi.StringMap{
* "Sydney": pulumi.String("Australia"),
* },
* })
* if err != nil {
* return err
* }
* exampleVirtualNetwork, err := devtest.NewVirtualNetwork(ctx, "example", &devtest.VirtualNetworkArgs{
* Name: pulumi.String("example-network"),
* LabName: exampleLab.Name,
* ResourceGroupName: example.Name,
* Subnet: &devtest.VirtualNetworkSubnetArgs{
* UsePublicIpAddress: pulumi.String("Allow"),
* UseInVirtualMachineCreation: pulumi.String("Allow"),
* },
* })
* if err != nil {
* return err
* }
* _, err = devtest.NewWindowsVirtualMachine(ctx, "example", &devtest.WindowsVirtualMachineArgs{
* Name: pulumi.String("example-vm03"),
* LabName: exampleLab.Name,
* ResourceGroupName: example.Name,
* Location: example.Location,
* Size: pulumi.String("Standard_DS2"),
* Username: pulumi.String("exampleuser99"),
* Password: pulumi.String("Pa$w0rd1234!"),
* LabVirtualNetworkId: exampleVirtualNetwork.ID(),
* LabSubnetName: exampleVirtualNetwork.Subnet.ApplyT(func(subnet devtest.VirtualNetworkSubnet) (*string, error) {
* return &subnet.Name, nil
* }).(pulumi.StringPtrOutput),
* StorageType: pulumi.String("Premium"),
* Notes: pulumi.String("Some notes about this Virtual Machine."),
* GalleryImageReference: &devtest.WindowsVirtualMachineGalleryImageReferenceArgs{
* Offer: pulumi.String("WindowsServer"),
* Publisher: pulumi.String("MicrosoftWindowsServer"),
* Sku: pulumi.String("2019-Datacenter"),
* Version: pulumi.String("latest"),
* },
* })
* 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.devtest.Lab;
* import com.pulumi.azure.devtest.LabArgs;
* import com.pulumi.azure.devtest.VirtualNetwork;
* import com.pulumi.azure.devtest.VirtualNetworkArgs;
* import com.pulumi.azure.devtest.inputs.VirtualNetworkSubnetArgs;
* import com.pulumi.azure.devtest.WindowsVirtualMachine;
* import com.pulumi.azure.devtest.WindowsVirtualMachineArgs;
* import com.pulumi.azure.devtest.inputs.WindowsVirtualMachineGalleryImageReferenceArgs;
* 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-devtestlab")
* .location(example.location())
* .resourceGroupName(example.name())
* .tags(Map.of("Sydney", "Australia"))
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example-network")
* .labName(exampleLab.name())
* .resourceGroupName(example.name())
* .subnet(VirtualNetworkSubnetArgs.builder()
* .usePublicIpAddress("Allow")
* .useInVirtualMachineCreation("Allow")
* .build())
* .build());
* var exampleWindowsVirtualMachine = new WindowsVirtualMachine("exampleWindowsVirtualMachine", WindowsVirtualMachineArgs.builder()
* .name("example-vm03")
* .labName(exampleLab.name())
* .resourceGroupName(example.name())
* .location(example.location())
* .size("Standard_DS2")
* .username("exampleuser99")
* .password("Pa$w0rd1234!")
* .labVirtualNetworkId(exampleVirtualNetwork.id())
* .labSubnetName(exampleVirtualNetwork.subnet().applyValue(subnet -> subnet.name()))
* .storageType("Premium")
* .notes("Some notes about this Virtual Machine.")
* .galleryImageReference(WindowsVirtualMachineGalleryImageReferenceArgs.builder()
* .offer("WindowsServer")
* .publisher("MicrosoftWindowsServer")
* .sku("2019-Datacenter")
* .version("latest")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleLab:
* type: azure:devtest:Lab
* name: example
* properties:
* name: example-devtestlab
* location: ${example.location}
* resourceGroupName: ${example.name}
* tags:
* Sydney: Australia
* exampleVirtualNetwork:
* type: azure:devtest:VirtualNetwork
* name: example
* properties:
* name: example-network
* labName: ${exampleLab.name}
* resourceGroupName: ${example.name}
* subnet:
* usePublicIpAddress: Allow
* useInVirtualMachineCreation: Allow
* exampleWindowsVirtualMachine:
* type: azure:devtest:WindowsVirtualMachine
* name: example
* properties:
* name: example-vm03
* labName: ${exampleLab.name}
* resourceGroupName: ${example.name}
* location: ${example.location}
* size: Standard_DS2
* username: exampleuser99
* password: Pa$w0rd1234!
* labVirtualNetworkId: ${exampleVirtualNetwork.id}
* labSubnetName: ${exampleVirtualNetwork.subnet.name}
* storageType: Premium
* notes: Some notes about this Virtual Machine.
* galleryImageReference:
* offer: WindowsServer
* publisher: MicrosoftWindowsServer
* sku: 2019-Datacenter
* version: latest
* ```
*
* ## Import
* DevTest Windows Virtual Machines can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:devtest/windowsVirtualMachine:WindowsVirtualMachine machine1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/machine1
* ```
*/
public class WindowsVirtualMachine internal constructor(
override val javaResource: com.pulumi.azure.devtest.WindowsVirtualMachine,
) : KotlinCustomResource(javaResource, WindowsVirtualMachineMapper) {
/**
* Can this Virtual Machine be claimed by users? Defaults to `true`.
*/
public val allowClaim: Output?
get() = javaResource.allowClaim().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Should the Virtual Machine be created without a Public IP Address? Changing this forces a new resource to be created.
*/
public val disallowPublicIpAddress: Output?
get() = javaResource.disallowPublicIpAddress().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The FQDN of the Virtual Machine.
*/
public val fqdn: Output
get() = javaResource.fqdn().applyValue({ args0 -> args0 })
/**
* A `gallery_image_reference` block as defined below.
*/
public val galleryImageReference: Output
get() = javaResource.galleryImageReference().applyValue({ args0 ->
args0.let({ args0 ->
windowsVirtualMachineGalleryImageReferenceToKotlin(args0)
})
})
/**
* One or more `inbound_nat_rule` blocks as defined below. Changing this forces a new resource to be created.
* > **NOTE:** If any `inbound_nat_rule` blocks are specified then `disallow_public_ip_address` must be set to `true`.
*/
public val inboundNatRules: Output>?
get() = javaResource.inboundNatRules().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
windowsVirtualMachineInboundNatRuleToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Specifies the name of the Dev Test Lab in which the Virtual Machine should be created. Changing this forces a new resource to be created.
*/
public val labName: Output
get() = javaResource.labName().applyValue({ args0 -> args0 })
/**
* The name of a Subnet within the Dev Test Virtual Network where this machine should exist. Changing this forces a new resource to be created.
*/
public val labSubnetName: Output
get() = javaResource.labSubnetName().applyValue({ args0 -> args0 })
/**
* The ID of the Dev Test Virtual Network where this Virtual Machine should be created. Changing this forces a new resource to be created.
*/
public val labVirtualNetworkId: Output
get() = javaResource.labVirtualNetworkId().applyValue({ args0 -> args0 })
/**
* Specifies the supported Azure location where the Dev Test Lab exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Dev Test Machine. Changing this forces a new resource to be created.
* > **NOTE:** The validation requirements for the Name change based on the `os_type` used in this Virtual Machine. For a Linux VM the name must be between 1-62 characters, and for a Windows VM the name must be between 1-15 characters. It must begin and end with a letter or number, and cannot be all numbers.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Any notes about the Virtual Machine.
*/
public val notes: Output?
get() = javaResource.notes().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The Password associated with the `username` used to login to this Virtual Machine. Changing this forces a new resource to be created.
*/
public val password: Output
get() = javaResource.password().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The Machine Size to use for this Virtual Machine, such as `Standard_F2`. Changing this forces a new resource to be created.
*/
public val size: Output
get() = javaResource.size().applyValue({ args0 -> args0 })
/**
* The type of Storage to use on this Virtual Machine. Possible values are `Standard` and `Premium`. Changing this forces a new resource to be created.
*/
public val storageType: Output
get() = javaResource.storageType().applyValue({ args0 -> args0 })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy