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

com.pulumi.azure.maintenance.AssignmentVirtualMachine 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.maintenance;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.maintenance.AssignmentVirtualMachineArgs;
import com.pulumi.azure.maintenance.inputs.AssignmentVirtualMachineState;
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.String;
import javax.annotation.Nullable;

/**
 * Manages a maintenance assignment to virtual machine.
 * 
 * ## 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.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.NetworkInterface;
 * import com.pulumi.azure.network.NetworkInterfaceArgs;
 * import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
 * import com.pulumi.azure.compute.LinuxVirtualMachine;
 * import com.pulumi.azure.compute.LinuxVirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineAdminSshKeyArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineSourceImageReferenceArgs;
 * import com.pulumi.azure.maintenance.Configuration;
 * import com.pulumi.azure.maintenance.ConfigurationArgs;
 * import com.pulumi.azure.maintenance.AssignmentVirtualMachine;
 * import com.pulumi.azure.maintenance.AssignmentVirtualMachineArgs;
 * 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 exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("example-network")
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 * 
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("internal")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 * 
 *         var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name("example-nic")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("internal")
 *                 .subnetId(exampleSubnet.id())
 *                 .privateIpAddressAllocation("Dynamic")
 *                 .build())
 *             .build());
 * 
 *         var exampleLinuxVirtualMachine = new LinuxVirtualMachine("exampleLinuxVirtualMachine", LinuxVirtualMachineArgs.builder()
 *             .name("example-machine")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .size("Standard_F2")
 *             .adminUsername("adminuser")
 *             .networkInterfaceIds(exampleNetworkInterface.id())
 *             .adminSshKeys(LinuxVirtualMachineAdminSshKeyArgs.builder()
 *                 .username("adminuser")
 *                 .publicKey(StdFunctions.file(FileArgs.builder()
 *                     .input("~/.ssh/id_rsa.pub")
 *                     .build()).result())
 *                 .build())
 *             .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
 *                 .caching("ReadWrite")
 *                 .storageAccountType("Standard_LRS")
 *                 .build())
 *             .sourceImageReference(LinuxVirtualMachineSourceImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .build());
 * 
 *         var exampleConfiguration = new Configuration("exampleConfiguration", ConfigurationArgs.builder()
 *             .name("example-mc")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .scope("All")
 *             .build());
 * 
 *         var exampleAssignmentVirtualMachine = new AssignmentVirtualMachine("exampleAssignmentVirtualMachine", AssignmentVirtualMachineArgs.builder()
 *             .location(example.location())
 *             .maintenanceConfigurationId(exampleConfiguration.id())
 *             .virtualMachineId(exampleLinuxVirtualMachine.id())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Maintenance Assignment can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:maintenance/assignmentVirtualMachine:AssignmentVirtualMachine example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Maintenance/configurationAssignments/assign1 * ``` * */ @ResourceType(type="azure:maintenance/assignmentVirtualMachine:AssignmentVirtualMachine") public class AssignmentVirtualMachine extends com.pulumi.resources.CustomResource { /** * Specifies the supported Azure location where the resource 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 resource exists. Changing this forces a new resource to be created. * */ public Output location() { return this.location; } /** * Specifies the ID of the Maintenance Configuration Resource. Changing this forces a new resource to be created. * */ @Export(name="maintenanceConfigurationId", refs={String.class}, tree="[0]") private Output maintenanceConfigurationId; /** * @return Specifies the ID of the Maintenance Configuration Resource. Changing this forces a new resource to be created. * */ public Output maintenanceConfigurationId() { return this.maintenanceConfigurationId; } /** * Specifies the Virtual Machine ID to which the Maintenance Configuration will be assigned. Changing this forces a new resource to be created. * */ @Export(name="virtualMachineId", refs={String.class}, tree="[0]") private Output virtualMachineId; /** * @return Specifies the Virtual Machine ID to which the Maintenance Configuration will be assigned. Changing this forces a new resource to be created. * */ public Output virtualMachineId() { return this.virtualMachineId; } /** * * @param name The _unique_ name of the resulting resource. */ public AssignmentVirtualMachine(java.lang.String name) { this(name, AssignmentVirtualMachineArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AssignmentVirtualMachine(java.lang.String name, AssignmentVirtualMachineArgs 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 AssignmentVirtualMachine(java.lang.String name, AssignmentVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:maintenance/assignmentVirtualMachine:AssignmentVirtualMachine", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AssignmentVirtualMachine(java.lang.String name, Output id, @Nullable AssignmentVirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:maintenance/assignmentVirtualMachine:AssignmentVirtualMachine", name, state, makeResourceOptions(options, id), false); } private static AssignmentVirtualMachineArgs makeArgs(AssignmentVirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AssignmentVirtualMachineArgs.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()) .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 AssignmentVirtualMachine get(java.lang.String name, Output id, @Nullable AssignmentVirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AssignmentVirtualMachine(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy