com.pulumi.azurenative.compute.Image Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-native Show documentation
Show all versions of azure-native Show documentation
A native Pulumi package for creating and managing Azure resources.
// *** 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.azurenative.compute;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.compute.ImageArgs;
import com.pulumi.azurenative.compute.outputs.ExtendedLocationResponse;
import com.pulumi.azurenative.compute.outputs.ImageStorageProfileResponse;
import com.pulumi.azurenative.compute.outputs.SubResourceResponse;
import com.pulumi.core.Alias;
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 java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
* Azure REST API version: 2023-03-01. Prior API version in Azure Native 1.x: 2020-12-01.
*
* Other available API versions: 2023-07-01, 2023-09-01, 2024-03-01, 2024-07-01.
*
* ## Example Usage
* ### Create a virtual machine image from a blob with DiskEncryptionSet resource.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.DiskEncryptionSetParametersArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .blobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
* .diskEncryptionSet(DiskEncryptionSetParametersArgs.builder()
* .id("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")
* .build())
* .osState("Generalized")
* .osType("Linux")
* .build())
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from a blob.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .blobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
* .osState("Generalized")
* .osType("Linux")
* .build())
* .zoneResilient(true)
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from a managed disk with DiskEncryptionSet resource.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.DiskEncryptionSetParametersArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .diskEncryptionSet(DiskEncryptionSetParametersArgs.builder()
* .id("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")
* .build())
* .osState("Generalized")
* .osType("Linux")
* .snapshot(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")
* .build())
* .build())
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from a managed disk.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .managedDisk(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")
* .build())
* .osState("Generalized")
* .osType("Linux")
* .build())
* .zoneResilient(true)
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from a snapshot with DiskEncryptionSet resource.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.DiskEncryptionSetParametersArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .diskEncryptionSet(DiskEncryptionSetParametersArgs.builder()
* .id("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")
* .build())
* .managedDisk(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")
* .build())
* .osState("Generalized")
* .osType("Linux")
* .build())
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from a snapshot.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .osDisk(ImageOSDiskArgs.builder()
* .osState("Generalized")
* .osType("Linux")
* .snapshot(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")
* .build())
* .build())
* .zoneResilient(false)
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image from an existing virtual machine.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .sourceVirtualMachine(SubResourceArgs.builder()
* .id("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image that includes a data disk from a blob.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .dataDisks(ImageDataDiskArgs.builder()
* .blobUri("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd")
* .lun(1)
* .build())
* .osDisk(ImageOSDiskArgs.builder()
* .blobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
* .osState("Generalized")
* .osType("Linux")
* .build())
* .zoneResilient(false)
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image that includes a data disk from a managed disk.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .dataDisks(ImageDataDiskArgs.builder()
* .lun(1)
* .managedDisk(SubResourceArgs.builder()
* .id("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2")
* .build())
* .build())
* .osDisk(ImageOSDiskArgs.builder()
* .managedDisk(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")
* .build())
* .osState("Generalized")
* .osType("Linux")
* .build())
* .zoneResilient(false)
* .build())
* .build());
*
* }
* }
*
* }
*
* ### Create a virtual machine image that includes a data disk from a snapshot.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.compute.Image;
* import com.pulumi.azurenative.compute.ImageArgs;
* import com.pulumi.azurenative.compute.inputs.ImageStorageProfileArgs;
* import com.pulumi.azurenative.compute.inputs.ImageOSDiskArgs;
* import com.pulumi.azurenative.compute.inputs.SubResourceArgs;
* 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 image = new Image("image", ImageArgs.builder()
* .imageName("myImage")
* .location("West US")
* .resourceGroupName("myResourceGroup")
* .storageProfile(ImageStorageProfileArgs.builder()
* .dataDisks(ImageDataDiskArgs.builder()
* .lun(1)
* .snapshot(SubResourceArgs.builder()
* .id("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2")
* .build())
* .build())
* .osDisk(ImageOSDiskArgs.builder()
* .osState("Generalized")
* .osType("Linux")
* .snapshot(SubResourceArgs.builder()
* .id("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")
* .build())
* .build())
* .zoneResilient(true)
* .build())
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:compute:Image myImage /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}
* ```
*
*/
@ResourceType(type="azure-native:compute:Image")
public class Image extends com.pulumi.resources.CustomResource {
/**
* The extended location of the Image.
*
*/
@Export(name="extendedLocation", refs={ExtendedLocationResponse.class}, tree="[0]")
private Output* @Nullable */ ExtendedLocationResponse> extendedLocation;
/**
* @return The extended location of the Image.
*
*/
public Output> extendedLocation() {
return Codegen.optional(this.extendedLocation);
}
/**
* Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource.
*
*/
@Export(name="hyperVGeneration", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> hyperVGeneration;
/**
* @return Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource.
*
*/
public Output> hyperVGeneration() {
return Codegen.optional(this.hyperVGeneration);
}
/**
* Resource location
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return Resource location
*
*/
public Output location() {
return this.location;
}
/**
* Resource name
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Resource name
*
*/
public Output name() {
return this.name;
}
/**
* The provisioning state.
*
*/
@Export(name="provisioningState", refs={String.class}, tree="[0]")
private Output provisioningState;
/**
* @return The provisioning state.
*
*/
public Output provisioningState() {
return this.provisioningState;
}
/**
* The source virtual machine from which Image is created.
*
*/
@Export(name="sourceVirtualMachine", refs={SubResourceResponse.class}, tree="[0]")
private Output* @Nullable */ SubResourceResponse> sourceVirtualMachine;
/**
* @return The source virtual machine from which Image is created.
*
*/
public Output> sourceVirtualMachine() {
return Codegen.optional(this.sourceVirtualMachine);
}
/**
* Specifies the storage settings for the virtual machine disks.
*
*/
@Export(name="storageProfile", refs={ImageStorageProfileResponse.class}, tree="[0]")
private Output* @Nullable */ ImageStorageProfileResponse> storageProfile;
/**
* @return Specifies the storage settings for the virtual machine disks.
*
*/
public Output> storageProfile() {
return Codegen.optional(this.storageProfile);
}
/**
* Resource tags
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return Resource tags
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* Resource type
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return Resource type
*
*/
public Output type() {
return this.type;
}
/**
*
* @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-native:compute:Image", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Image(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:compute:Image", name, null, 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())
.aliases(List.of(
Output.of(Alias.builder().type("azure-native:compute/v20160430preview:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20170330:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20171201:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20180401:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20180601:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20181001:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20190301:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20190701:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20191201:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20200601:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20201201:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210301:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210401:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20210701:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20211101:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20220301:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20220801:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20221101:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230301:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230701:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20230901:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20240301:Image").build()),
Output.of(Alias.builder().type("azure-native:compute/v20240701:Image").build())
))
.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 options Optional settings to control the behavior of the CustomResource.
*/
public static Image get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Image(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy