UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

116 lines 4.96 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.VirtualDisk = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `vsphere.VirtualDisk` resource can be used to create virtual disks outside * of any given `vsphere.VirtualMachine` * resource. These disks can be attached to a virtual machine by creating a disk * block with the `attach` parameter. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const datacenter = vsphere.getDatacenter({ * name: "dc-01", * }); * const datastore = vsphere.getDatacenter({ * name: "datastore-01", * }); * const virtualDisk = new vsphere.VirtualDisk("virtual_disk", { * size: 40, * type: "thin", * vmdkPath: "/foo/foo.vmdk", * createDirectories: true, * datacenter: datacenter.then(datacenter => datacenter.name), * datastore: datastoreVsphereDatastore.name, * }); * ``` * * ## Import * * An existing virtual disk can be imported into this resource * * via supplying the full datastore path to the virtual disk. An example is below: * * [docs-import]: https://developer.hashicorp.com/terraform/cli/import * * ```sh * $ pulumi import vsphere:index/virtualDisk:VirtualDisk virtual_disk \ * ``` * * '{"virtual_disk_path": "/dc-01/[datastore-01]foo/bar.vmdk", \ "create_directories": "true"}' * * The above would import the virtual disk located at `foo/bar.vmdk` in the `datastore-01` * * datastore of the `dc-01` datacenter with `create_directories` set as `true`. */ class VirtualDisk extends pulumi.CustomResource { /** * Get an existing VirtualDisk 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 VirtualDisk(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of VirtualDisk. 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'] === VirtualDisk.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["adapterType"] = state ? state.adapterType : undefined; resourceInputs["createDirectories"] = state ? state.createDirectories : undefined; resourceInputs["datacenter"] = state ? state.datacenter : undefined; resourceInputs["datastore"] = state ? state.datastore : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["vmdkPath"] = state ? state.vmdkPath : undefined; } else { const args = argsOrState; if ((!args || args.datastore === undefined) && !opts.urn) { throw new Error("Missing required property 'datastore'"); } if ((!args || args.size === undefined) && !opts.urn) { throw new Error("Missing required property 'size'"); } if ((!args || args.vmdkPath === undefined) && !opts.urn) { throw new Error("Missing required property 'vmdkPath'"); } resourceInputs["adapterType"] = args ? args.adapterType : undefined; resourceInputs["createDirectories"] = args ? args.createDirectories : undefined; resourceInputs["datacenter"] = args ? args.datacenter : undefined; resourceInputs["datastore"] = args ? args.datastore : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["vmdkPath"] = args ? args.vmdkPath : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VirtualDisk.__pulumiType, name, resourceInputs, opts); } } exports.VirtualDisk = VirtualDisk; /** @internal */ VirtualDisk.__pulumiType = 'vsphere:index/virtualDisk:VirtualDisk'; //# sourceMappingURL=virtualDisk.js.map