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

com.pulumi.azure.devtest.LinuxVirtualMachine Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.devtest;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.devtest.LinuxVirtualMachineArgs;
import com.pulumi.azure.devtest.inputs.LinuxVirtualMachineState;
import com.pulumi.azure.devtest.outputs.LinuxVirtualMachineGalleryImageReference;
import com.pulumi.azure.devtest.outputs.LinuxVirtualMachineInboundNatRule;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Linux Virtual Machine within a Dev Test Lab.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * 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.LinuxVirtualMachine;
 * import com.pulumi.azure.devtest.LinuxVirtualMachineArgs;
 * import com.pulumi.azure.devtest.inputs.LinuxVirtualMachineGalleryImageReferenceArgs;
 * 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 exampleLinuxVirtualMachine = new LinuxVirtualMachine("exampleLinuxVirtualMachine", LinuxVirtualMachineArgs.builder()
 *             .name("example-vm03")
 *             .labName(exampleLab.name())
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .size("Standard_DS2")
 *             .username("exampleuser99")
 *             .sshKey(StdFunctions.file(FileArgs.builder()
 *                 .input("~/.ssh/id_rsa.pub")
 *                 .build()).result())
 *             .labVirtualNetworkId(exampleVirtualNetwork.id())
 *             .labSubnetName(exampleVirtualNetwork.subnet().applyValue(subnet -> subnet.name()))
 *             .storageType("Premium")
 *             .notes("Some notes about this Virtual Machine.")
 *             .galleryImageReference(LinuxVirtualMachineGalleryImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Dev Test Linux Virtual Machines can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:devtest/linuxVirtualMachine:LinuxVirtualMachine machine1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/machine1 * ``` * */ @ResourceType(type="azure:devtest/linuxVirtualMachine:LinuxVirtualMachine") public class LinuxVirtualMachine extends com.pulumi.resources.CustomResource { /** * Can this Virtual Machine be claimed by users? Defaults to `true`. * */ @Export(name="allowClaim", refs={Boolean.class}, tree="[0]") private Output allowClaim; /** * @return Can this Virtual Machine be claimed by users? Defaults to `true`. * */ public Output> allowClaim() { return Codegen.optional(this.allowClaim); } /** * Should the Virtual Machine be created without a Public IP Address? Changing this forces a new resource to be created. * */ @Export(name="disallowPublicIpAddress", refs={Boolean.class}, tree="[0]") private Output disallowPublicIpAddress; /** * @return Should the Virtual Machine be created without a Public IP Address? Changing this forces a new resource to be created. * */ public Output> disallowPublicIpAddress() { return Codegen.optional(this.disallowPublicIpAddress); } /** * The FQDN of the Virtual Machine. * */ @Export(name="fqdn", refs={String.class}, tree="[0]") private Output fqdn; /** * @return The FQDN of the Virtual Machine. * */ public Output fqdn() { return this.fqdn; } /** * A `gallery_image_reference` block as defined below. * */ @Export(name="galleryImageReference", refs={LinuxVirtualMachineGalleryImageReference.class}, tree="[0]") private Output galleryImageReference; /** * @return A `gallery_image_reference` block as defined below. * */ public Output galleryImageReference() { return this.galleryImageReference; } /** * 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`. * */ @Export(name="inboundNatRules", refs={List.class,LinuxVirtualMachineInboundNatRule.class}, tree="[0,1]") private Output> inboundNatRules; /** * @return 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 Output>> inboundNatRules() { return Codegen.optional(this.inboundNatRules); } /** * 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. * */ @Export(name="labName", refs={String.class}, tree="[0]") private Output labName; /** * @return 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 Output labName() { return this.labName; } /** * 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. * */ @Export(name="labSubnetName", refs={String.class}, tree="[0]") private Output labSubnetName; /** * @return 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 Output labSubnetName() { return this.labSubnetName; } /** * The ID of the Dev Test Virtual Network where this Virtual Machine should be created. Changing this forces a new resource to be created. * */ @Export(name="labVirtualNetworkId", refs={String.class}, tree="[0]") private Output labVirtualNetworkId; /** * @return 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 Output labVirtualNetworkId() { return this.labVirtualNetworkId; } /** * Specifies the supported Azure location where the Dev Test Lab exists. Changing this forces a new resource to be created. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return Specifies the supported Azure location where the Dev Test Lab exists. Changing this forces a new resource to be created. * */ public Output location() { return this.location; } /** * 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. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return 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 Output name() { return this.name; } /** * Any notes about the Virtual Machine. * */ @Export(name="notes", refs={String.class}, tree="[0]") private Output notes; /** * @return Any notes about the Virtual Machine. * */ public Output> notes() { return Codegen.optional(this.notes); } /** * The Password associated with the `username` used to login to this Virtual Machine. Changing this forces a new resource to be created. * */ @Export(name="password", refs={String.class}, tree="[0]") private Output password; /** * @return The Password associated with the `username` used to login to this Virtual Machine. Changing this forces a new resource to be created. * */ public Output> password() { return Codegen.optional(this.password); } /** * The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created. * */ @Export(name="resourceGroupName", refs={String.class}, tree="[0]") private Output resourceGroupName; /** * @return The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created. * */ public Output resourceGroupName() { return this.resourceGroupName; } /** * The Machine Size to use for this Virtual Machine, such as `Standard_F2`. Changing this forces a new resource to be created. * */ @Export(name="size", refs={String.class}, tree="[0]") private Output size; /** * @return The Machine Size to use for this Virtual Machine, such as `Standard_F2`. Changing this forces a new resource to be created. * */ public Output size() { return this.size; } /** * The SSH Key associated with the `username` used to login to this Virtual Machine. Changing this forces a new resource to be created. * * > **NOTE:** One or either `password` or `ssh_key` must be specified. * */ @Export(name="sshKey", refs={String.class}, tree="[0]") private Output sshKey; /** * @return The SSH Key associated with the `username` used to login to this Virtual Machine. Changing this forces a new resource to be created. * * > **NOTE:** One or either `password` or `ssh_key` must be specified. * */ public Output> sshKey() { return Codegen.optional(this.sshKey); } /** * 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. * */ @Export(name="storageType", refs={String.class}, tree="[0]") private Output storageType; /** * @return 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 Output storageType() { return this.storageType; } /** * A mapping of tags to assign to the resource. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags to assign to the resource. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * The unique immutable identifier of the Virtual Machine. * */ @Export(name="uniqueIdentifier", refs={String.class}, tree="[0]") private Output uniqueIdentifier; /** * @return The unique immutable identifier of the Virtual Machine. * */ public Output uniqueIdentifier() { return this.uniqueIdentifier; } /** * The Username associated with the local administrator on this Virtual Machine. Changing this forces a new resource to be created. * */ @Export(name="username", refs={String.class}, tree="[0]") private Output username; /** * @return The Username associated with the local administrator on this Virtual Machine. Changing this forces a new resource to be created. * */ public Output username() { return this.username; } /** * * @param name The _unique_ name of the resulting resource. */ public LinuxVirtualMachine(java.lang.String name) { this(name, LinuxVirtualMachineArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public LinuxVirtualMachine(java.lang.String name, LinuxVirtualMachineArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public LinuxVirtualMachine(java.lang.String name, LinuxVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:devtest/linuxVirtualMachine:LinuxVirtualMachine", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private LinuxVirtualMachine(java.lang.String name, Output id, @Nullable LinuxVirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:devtest/linuxVirtualMachine:LinuxVirtualMachine", name, state, makeResourceOptions(options, id), false); } private static LinuxVirtualMachineArgs makeArgs(LinuxVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? LinuxVirtualMachineArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .additionalSecretOutputs(List.of( "password" )) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static LinuxVirtualMachine get(java.lang.String name, Output id, @Nullable LinuxVirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new LinuxVirtualMachine(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy