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

com.pulumi.azure.maintenance.AssignmentVirtualMachineScaleSet Maven / Gradle / Ivy

// *** 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.AssignmentVirtualMachineScaleSetArgs;
import com.pulumi.azure.maintenance.inputs.AssignmentVirtualMachineScaleSetState;
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 a virtual machine scale set.
 * 
 * ## 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.PublicIp;
 * import com.pulumi.azure.network.PublicIpArgs;
 * import com.pulumi.azure.lb.LoadBalancer;
 * import com.pulumi.azure.lb.LoadBalancerArgs;
 * import com.pulumi.azure.lb.inputs.LoadBalancerFrontendIpConfigurationArgs;
 * import com.pulumi.azure.lb.BackendAddressPool;
 * import com.pulumi.azure.lb.BackendAddressPoolArgs;
 * import com.pulumi.azure.lb.Probe;
 * import com.pulumi.azure.lb.ProbeArgs;
 * import com.pulumi.azure.lb.Rule;
 * import com.pulumi.azure.lb.RuleArgs;
 * import com.pulumi.azure.maintenance.Configuration;
 * import com.pulumi.azure.maintenance.ConfigurationArgs;
 * import com.pulumi.azure.maintenance.inputs.ConfigurationWindowArgs;
 * 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.LinuxVirtualMachineOsDiskArgs;
 * import com.pulumi.azure.compute.LinuxVirtualMachineScaleSet;
 * import com.pulumi.azure.compute.LinuxVirtualMachineScaleSetArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetAutomaticOsUpgradePolicyArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetRollingUpgradePolicyArgs;
 * import com.pulumi.azure.maintenance.AssignmentVirtualMachineScaleSet;
 * import com.pulumi.azure.maintenance.AssignmentVirtualMachineScaleSetArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 }{{@code
 *     public static void main(String[] args) }{{@code
 *         Pulumi.run(App::stack);
 *     }}{@code
 * 
 *     public static void stack(Context ctx) }{{@code
 *         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 examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
 *             .name(example.name())
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .allocationMethod("Static")
 *             .build());
 * 
 *         var exampleLoadBalancer = new LoadBalancer("exampleLoadBalancer", LoadBalancerArgs.builder()
 *             .name(example.name())
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .frontendIpConfigurations(LoadBalancerFrontendIpConfigurationArgs.builder()
 *                 .name("internal")
 *                 .publicIpAddressId(examplePublicIp.id())
 *                 .build())
 *             .build());
 * 
 *         var exampleBackendAddressPool = new BackendAddressPool("exampleBackendAddressPool", BackendAddressPoolArgs.builder()
 *             .name("example")
 *             .loadbalancerId(exampleLoadBalancer.id())
 *             .build());
 * 
 *         var exampleProbe = new Probe("exampleProbe", ProbeArgs.builder()
 *             .name("example")
 *             .loadbalancerId(exampleLoadBalancer.id())
 *             .port(22)
 *             .protocol("Tcp")
 *             .build());
 * 
 *         var exampleRule = new Rule("exampleRule", RuleArgs.builder()
 *             .name("example")
 *             .loadbalancerId(exampleLoadBalancer.id())
 *             .probeId(exampleProbe.id())
 *             .frontendIpConfigurationName("internal")
 *             .protocol("Tcp")
 *             .frontendPort(22)
 *             .backendPort(22)
 *             .build());
 * 
 *         var exampleConfiguration = new Configuration("exampleConfiguration", ConfigurationArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .scope("OSImage")
 *             .visibility("Custom")
 *             .window(ConfigurationWindowArgs.builder()
 *                 .startDateTime("2021-12-31 00:00")
 *                 .expirationDateTime("9999-12-31 00:00")
 *                 .duration("06:00")
 *                 .timeZone("Pacific Standard Time")
 *                 .recurEvery("1Days")
 *                 .build())
 *             .build());
 * 
 *         var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name("sample-nic")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("testconfiguration1")
 *                 .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())
 *             .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
 *                 .caching("ReadWrite")
 *                 .storageAccountType("Standard_LRS")
 *                 .build())
 *             .build());
 * 
 *         var exampleLinuxVirtualMachineScaleSet = new LinuxVirtualMachineScaleSet("exampleLinuxVirtualMachineScaleSet", LinuxVirtualMachineScaleSetArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Standard_F2")
 *             .instances(1)
 *             .adminUsername("adminuser")
 *             .adminPassword("P}{@literal @}{@code ssword1234!")
 *             .upgradeMode("Automatic")
 *             .healthProbeId(exampleProbe.id())
 *             .disablePasswordAuthentication(false)
 *             .sourceImageReference(LinuxVirtualMachineScaleSetSourceImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .osDisk(LinuxVirtualMachineScaleSetOsDiskArgs.builder()
 *                 .storageAccountType("Standard_LRS")
 *                 .caching("ReadWrite")
 *                 .build())
 *             .networkInterfaces(LinuxVirtualMachineScaleSetNetworkInterfaceArgs.builder()
 *                 .name("example")
 *                 .primary(true)
 *                 .ipConfigurations(LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
 *                     .name("internal")
 *                     .primary(true)
 *                     .subnetId(exampleSubnet.id())
 *                     .loadBalancerBackendAddressPoolIds(exampleBackendAddressPool.id())
 *                     .build())
 *                 .build())
 *             .automaticOsUpgradePolicy(LinuxVirtualMachineScaleSetAutomaticOsUpgradePolicyArgs.builder()
 *                 .disableAutomaticRollback(true)
 *                 .enableAutomaticOsUpgrade(true)
 *                 .build())
 *             .rollingUpgradePolicy(LinuxVirtualMachineScaleSetRollingUpgradePolicyArgs.builder()
 *                 .maxBatchInstancePercent(20)
 *                 .maxUnhealthyInstancePercent(20)
 *                 .maxUnhealthyUpgradedInstancePercent(20)
 *                 .pauseTimeBetweenBatches("PT0S")
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleRule)
 *                 .build());
 * 
 *         var exampleAssignmentVirtualMachineScaleSet = new AssignmentVirtualMachineScaleSet("exampleAssignmentVirtualMachineScaleSet", AssignmentVirtualMachineScaleSetArgs.builder()
 *             .location(example.location())
 *             .maintenanceConfigurationId(exampleConfiguration.id())
 *             .virtualMachineScaleSetId(exampleLinuxVirtualMachine.id())
 *             .build());
 * 
 *     }}{@code
 * }}{@code
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Maintenance Assignment can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:maintenance/assignmentVirtualMachineScaleSet:AssignmentVirtualMachineScaleSet example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/providers/Microsoft.Maintenance/configurationAssignments/assign1 * ``` * */ @ResourceType(type="azure:maintenance/assignmentVirtualMachineScaleSet:AssignmentVirtualMachineScaleSet") public class AssignmentVirtualMachineScaleSet 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 Scale Set ID to which the Maintenance Configuration will be assigned. Changing this forces a new resource to be created. * */ @Export(name="virtualMachineScaleSetId", refs={String.class}, tree="[0]") private Output virtualMachineScaleSetId; /** * @return Specifies the Virtual Machine Scale Set ID to which the Maintenance Configuration will be assigned. Changing this forces a new resource to be created. * */ public Output virtualMachineScaleSetId() { return this.virtualMachineScaleSetId; } /** * * @param name The _unique_ name of the resulting resource. */ public AssignmentVirtualMachineScaleSet(java.lang.String name) { this(name, AssignmentVirtualMachineScaleSetArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AssignmentVirtualMachineScaleSet(java.lang.String name, AssignmentVirtualMachineScaleSetArgs 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 AssignmentVirtualMachineScaleSet(java.lang.String name, AssignmentVirtualMachineScaleSetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:maintenance/assignmentVirtualMachineScaleSet:AssignmentVirtualMachineScaleSet", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AssignmentVirtualMachineScaleSet(java.lang.String name, Output id, @Nullable AssignmentVirtualMachineScaleSetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:maintenance/assignmentVirtualMachineScaleSet:AssignmentVirtualMachineScaleSet", name, state, makeResourceOptions(options, id), false); } private static AssignmentVirtualMachineScaleSetArgs makeArgs(AssignmentVirtualMachineScaleSetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AssignmentVirtualMachineScaleSetArgs.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 AssignmentVirtualMachineScaleSet get(java.lang.String name, Output id, @Nullable AssignmentVirtualMachineScaleSetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AssignmentVirtualMachineScaleSet(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy