com.pulumi.azure.compute.Image Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
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.
// *** 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.compute;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.compute.ImageArgs;
import com.pulumi.azure.compute.inputs.ImageState;
import com.pulumi.azure.compute.outputs.ImageDataDisk;
import com.pulumi.azure.compute.outputs.ImageOsDisk;
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 custom virtual machine image that can be used to create virtual machines.
*
* ## Example Usage
*
* > **Note:** For a more complete example, see the `examples/image` directory within the GitHub Repository.
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.compute.ComputeFunctions;
* import com.pulumi.azure.compute.inputs.GetVirtualMachineArgs;
* import com.pulumi.azure.compute.Image;
* import com.pulumi.azure.compute.ImageArgs;
* 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) {
* final var example = ComputeFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
* .name("examplevm")
* .resourceGroupName("example-resources")
* .build());
*
* var exampleImage = new Image("exampleImage", ImageArgs.builder()
* .name("exampleimage")
* .location(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.location()))
* .resourceGroupName(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.name()))
* .sourceVirtualMachineId(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.id()))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Images can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:compute/image:Image example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/images/image1
* ```
*
*/
@ResourceType(type="azure:compute/image:Image")
public class Image extends com.pulumi.resources.CustomResource {
/**
* One or more `data_disk` blocks as defined below.
*
*/
@Export(name="dataDisks", refs={List.class,ImageDataDisk.class}, tree="[0,1]")
private Output* @Nullable */ List> dataDisks;
/**
* @return One or more `data_disk` blocks as defined below.
*
*/
public Output>> dataDisks() {
return Codegen.optional(this.dataDisks);
}
/**
* The HyperVGenerationType of the VirtualMachine created from the image as `V1`, `V2`. Defaults to `V1`. Changing this forces a new resource to be created.
*
* > **Note:** `zone_resilient` can only be set to `true` if the image is stored in a region that supports availability zones.
*
*/
@Export(name="hyperVGeneration", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> hyperVGeneration;
/**
* @return The HyperVGenerationType of the VirtualMachine created from the image as `V1`, `V2`. Defaults to `V1`. Changing this forces a new resource to be created.
*
* > **Note:** `zone_resilient` can only be set to `true` if the image is stored in a region that supports availability zones.
*
*/
public Output> hyperVGeneration() {
return Codegen.optional(this.hyperVGeneration);
}
/**
* Specified 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 Specified 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 name of the image. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Specifies the name of the image. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* One or more `os_disk` blocks as defined below. Changing this forces a new resource to be created.
*
*/
@Export(name="osDisk", refs={ImageOsDisk.class}, tree="[0]")
private Output* @Nullable */ ImageOsDisk> osDisk;
/**
* @return One or more `os_disk` blocks as defined below. Changing this forces a new resource to be created.
*
*/
public Output> osDisk() {
return Codegen.optional(this.osDisk);
}
/**
* The name of the resource group in which to create the image. 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 to create the image. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* The Virtual Machine ID from which to create the image.
*
*/
@Export(name="sourceVirtualMachineId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sourceVirtualMachineId;
/**
* @return The Virtual Machine ID from which to create the image.
*
*/
public Output> sourceVirtualMachineId() {
return Codegen.optional(this.sourceVirtualMachineId);
}
/**
* A mapping of tags to assign to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags to assign to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* Is zone resiliency enabled? Defaults to `false`. Changing this forces a new resource to be created.
*
*/
@Export(name="zoneResilient", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> zoneResilient;
/**
* @return Is zone resiliency enabled? Defaults to `false`. Changing this forces a new resource to be created.
*
*/
public Output> zoneResilient() {
return Codegen.optional(this.zoneResilient);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Image(java.lang.String name) {
this(name, ImageArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Image(java.lang.String name, ImageArgs 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 Image(java.lang.String name, ImageArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:compute/image:Image", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Image(java.lang.String name, Output id, @Nullable ImageState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:compute/image:Image", name, state, makeResourceOptions(options, id), false);
}
private static ImageArgs makeArgs(ImageArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ImageArgs.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 Image get(java.lang.String name, Output id, @Nullable ImageState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Image(name, id, state, options);
}
}