com.pulumi.azure.compute.Snapshot 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.SnapshotArgs;
import com.pulumi.azure.compute.inputs.SnapshotState;
import com.pulumi.azure.compute.outputs.SnapshotEncryptionSettings;
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.Integer;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a Disk Snapshot.
*
* ## 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.compute.ManagedDisk;
* import com.pulumi.azure.compute.ManagedDiskArgs;
* import com.pulumi.azure.compute.Snapshot;
* import com.pulumi.azure.compute.SnapshotArgs;
* 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("snapshot-rg")
* .location("West Europe")
* .build());
*
* var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
* .name("managed-disk")
* .location(example.location())
* .resourceGroupName(example.name())
* .storageAccountType("Standard_LRS")
* .createOption("Empty")
* .diskSizeGb("10")
* .build());
*
* var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
* .name("snapshot")
* .location(example.location())
* .resourceGroupName(example.name())
* .createOption("Copy")
* .sourceUri(exampleManagedDisk.id())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Snapshots can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:compute/snapshot:Snapshot example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/snapshots/snapshot1
* ```
*
*/
@ResourceType(type="azure:compute/snapshot:Snapshot")
public class Snapshot extends com.pulumi.resources.CustomResource {
/**
* Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`.
*
* > **Note:** One of `source_uri`, `source_resource_id` or `storage_account_id` must be specified.
*
*/
@Export(name="createOption", refs={String.class}, tree="[0]")
private Output createOption;
/**
* @return Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`.
*
* > **Note:** One of `source_uri`, `source_resource_id` or `storage_account_id` must be specified.
*
*/
public Output createOption() {
return this.createOption;
}
/**
* Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting `network_access_policy` to `AllowPrivate`.
*
*/
@Export(name="diskAccessId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> diskAccessId;
/**
* @return Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting `network_access_policy` to `AllowPrivate`.
*
*/
public Output> diskAccessId() {
return Codegen.optional(this.diskAccessId);
}
/**
* The size of the Snapshotted Disk in GB.
*
*/
@Export(name="diskSizeGb", refs={Integer.class}, tree="[0]")
private Output diskSizeGb;
/**
* @return The size of the Snapshotted Disk in GB.
*
*/
public Output diskSizeGb() {
return this.diskSizeGb;
}
/**
* A `encryption_settings` block as defined below.
*
* > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
*
*/
@Export(name="encryptionSettings", refs={SnapshotEncryptionSettings.class}, tree="[0]")
private Output* @Nullable */ SnapshotEncryptionSettings> encryptionSettings;
/**
* @return A `encryption_settings` block as defined below.
*
* > **NOTE:** Removing `encryption_settings` forces a new resource to be created.
*
*/
public Output> encryptionSettings() {
return Codegen.optional(this.encryptionSettings);
}
/**
* Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
*
*/
@Export(name="incrementalEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> incrementalEnabled;
/**
* @return Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.
*
*/
public Output> incrementalEnabled() {
return Codegen.optional(this.incrementalEnabled);
}
/**
* 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 name of the Snapshot resource. 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 Snapshot resource. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
*
*/
@Export(name="networkAccessPolicy", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> networkAccessPolicy;
/**
* @return Policy for accessing the disk via network. Possible values are `AllowAll`, `AllowPrivate`, or `DenyAll`. Defaults to `AllowAll`.
*
*/
public Output> networkAccessPolicy() {
return Codegen.optional(this.networkAccessPolicy);
}
/**
* Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
*
*/
@Export(name="publicNetworkAccessEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> publicNetworkAccessEnabled;
/**
* @return Policy for controlling export on the disk. Possible values are `true` or `false`. Defaults to `true`.
*
*/
public Output> publicNetworkAccessEnabled() {
return Codegen.optional(this.publicNetworkAccessEnabled);
}
/**
* The name of the resource group in which to create the Snapshot. 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 Snapshot. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
*
*/
@Export(name="sourceResourceId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sourceResourceId;
/**
* @return Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created.
*
*/
public Output> sourceResourceId() {
return Codegen.optional(this.sourceResourceId);
}
/**
* Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
*
*/
@Export(name="sourceUri", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sourceUri;
/**
* @return Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
*
*/
public Output> sourceUri() {
return Codegen.optional(this.sourceUri);
}
/**
* Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
*
*/
@Export(name="storageAccountId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> storageAccountId;
/**
* @return Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
*
*/
public Output> storageAccountId() {
return Codegen.optional(this.storageAccountId);
}
/**
* 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);
}
/**
* Whether Trusted Launch is enabled for the Snapshot.
*
*/
@Export(name="trustedLaunchEnabled", refs={Boolean.class}, tree="[0]")
private Output trustedLaunchEnabled;
/**
* @return Whether Trusted Launch is enabled for the Snapshot.
*
*/
public Output trustedLaunchEnabled() {
return this.trustedLaunchEnabled;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Snapshot(java.lang.String name) {
this(name, SnapshotArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Snapshot(java.lang.String name, SnapshotArgs 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 Snapshot(java.lang.String name, SnapshotArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:compute/snapshot:Snapshot", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Snapshot(java.lang.String name, Output id, @Nullable SnapshotState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:compute/snapshot:Snapshot", name, state, makeResourceOptions(options, id), false);
}
private static SnapshotArgs makeArgs(SnapshotArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? SnapshotArgs.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 Snapshot get(java.lang.String name, Output id, @Nullable SnapshotState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Snapshot(name, id, state, options);
}
}