@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
116 lines • 5.99 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VirtualMachineSnapshot = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.VirtualMachineSnapshot` resource can be used to manage snapshots
* for a virtual machine.
*
* For more information on managing snapshots and how they work in VMware, see
* [here][ext-vm-snapshot-management].
*
* [ext-vm-snapshot-management]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-single-host-management-vmware-host-client-8-0/virtual-machine-management-with-the-vsphere-host-client-vSphereSingleHostManagementVMwareHostClient/managing-virtual-machines-in-the-vsphere-host-client-vSphereSingleHostManagementVMwareHostClient/using-snapshots-to-manage-virtual-machines-vSphereSingleHostManagementVMwareHostClient.html
*
* > **NOTE:** A snapshot in VMware differs from traditional disk snapshots, and
* can contain the actual running state of the virtual machine, data for all disks
* that have not been set to be independent from the snapshot (including ones that
* have been attached via the `attach`
* parameter to the `vsphere.VirtualMachine` `disk` block), and even the
* configuration of the virtual machine at the time of the snapshot. Virtual
* machine, disk activity, and configuration changes post-snapshot are not
* included in the original state. Use this resource with care! Neither VMware nor
* HashiCorp recommends retaining snapshots for a extended period of time and does
* NOT recommend using them as as backup feature. For more information on the
* limitation of virtual machine snapshots, see [here][ext-vm-snap-limitations].
*
* [ext-vm-snap-limitations]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0/managing-virtual-machinesvsphere-vm-admin/using-snapshots-to-manage-virtual-machinesvsphere-vm-admin/snapshot-file-names-and-descriptionvsphere-vm-admin.html
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const demo1 = new vsphere.VirtualMachineSnapshot("demo1", {
* virtualMachineUuid: "9aac5551-a351-4158-8c5c-15a71e8ec5c9",
* snapshotName: "Snapshot Name",
* description: "This is Demo Snapshot",
* memory: true,
* quiesce: true,
* removeChildren: false,
* consolidate: true,
* });
* ```
*/
class VirtualMachineSnapshot extends pulumi.CustomResource {
/**
* Get an existing VirtualMachineSnapshot 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 Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new VirtualMachineSnapshot(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VirtualMachineSnapshot. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === VirtualMachineSnapshot.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["consolidate"] = state?.consolidate;
resourceInputs["description"] = state?.description;
resourceInputs["memory"] = state?.memory;
resourceInputs["quiesce"] = state?.quiesce;
resourceInputs["removeChildren"] = state?.removeChildren;
resourceInputs["snapshotName"] = state?.snapshotName;
resourceInputs["virtualMachineUuid"] = state?.virtualMachineUuid;
}
else {
const args = argsOrState;
if (args?.description === undefined && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if (args?.memory === undefined && !opts.urn) {
throw new Error("Missing required property 'memory'");
}
if (args?.quiesce === undefined && !opts.urn) {
throw new Error("Missing required property 'quiesce'");
}
if (args?.snapshotName === undefined && !opts.urn) {
throw new Error("Missing required property 'snapshotName'");
}
if (args?.virtualMachineUuid === undefined && !opts.urn) {
throw new Error("Missing required property 'virtualMachineUuid'");
}
resourceInputs["consolidate"] = args?.consolidate;
resourceInputs["description"] = args?.description;
resourceInputs["memory"] = args?.memory;
resourceInputs["quiesce"] = args?.quiesce;
resourceInputs["removeChildren"] = args?.removeChildren;
resourceInputs["snapshotName"] = args?.snapshotName;
resourceInputs["virtualMachineUuid"] = args?.virtualMachineUuid;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VirtualMachineSnapshot.__pulumiType, name, resourceInputs, opts);
}
}
exports.VirtualMachineSnapshot = VirtualMachineSnapshot;
/** @internal */
VirtualMachineSnapshot.__pulumiType = 'vsphere:index/virtualMachineSnapshot:VirtualMachineSnapshot';
//# sourceMappingURL=virtualMachineSnapshot.js.map