UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

154 lines 6.27 kB
"use strict"; // *** 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.VappEntity = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `vsphere.VappEntity` resource can be used to describe the behavior of an * entity (virtual machine or sub-vApp container) in a vApp container. * * For more information on vSphere vApps, see [this * page][ref-vsphere-vapp]. * * [ref-vsphere-vapp]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/create-a-vapp-h5-and-flex.html * * ## Example Usage * * The basic example below sets up a vApp container and a virtual machine in a * compute cluster and then creates a vApp entity to change the virtual machine's * power on behavior in the vApp container. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const config = new pulumi.Config(); * const datacenter = config.get("datacenter") || "dc-01"; * const cluster = config.get("cluster") || "cluster-01"; * const datacenterGetDatacenter = vsphere.getDatacenter({ * name: datacenter, * }); * const computeCluster = datacenterGetDatacenter.then(datacenterGetDatacenter => vsphere.getComputeCluster({ * name: cluster, * datacenterId: datacenterGetDatacenter.id, * })); * const network = datacenterGetDatacenter.then(datacenterGetDatacenter => vsphere.getNetwork({ * name: "network1", * datacenterId: datacenterGetDatacenter.id, * })); * const datastore = datacenterGetDatacenter.then(datacenterGetDatacenter => vsphere.getDatastore({ * name: "datastore1", * datacenterId: datacenterGetDatacenter.id, * })); * const vappContainer = new vsphere.VappContainer("vapp_container", { * name: "vapp-container-test", * parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.id), * }); * const vm = new vsphere.VirtualMachine("vm", { * name: "virtual-machine-test", * resourcePoolId: vappContainer.id, * datastoreId: datastore.then(datastore => datastore.id), * numCpus: 2, * memory: 1024, * guestId: "ubuntu64Guest", * disks: [{ * label: "disk0", * size: 1, * }], * networkInterfaces: [{ * networkId: network.then(network => network.id), * }], * }); * const vappEntity = new vsphere.VappEntity("vapp_entity", { * targetId: vm.moid, * containerId: vappContainer.id, * startAction: "none", * }); * ``` * * ## Import * * An existing vApp entity can be imported into this resource via * * the ID of the vApp Entity. * * [docs-import]: https://developer.hashicorp.com/terraform/cli/import * * ```sh * $ pulumi import vsphere:index/vappEntity:VappEntity vapp_entity vm-123:res-456 * ``` * * The above would import the vApp entity that governs the behavior of the virtual * * machine with a [managed object ID][docs-about-morefs] of vm-123 in the vApp * * container with the [managed object ID][docs-about-morefs] res-456. */ class VappEntity extends pulumi.CustomResource { /** * Get an existing VappEntity 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 VappEntity(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of VappEntity. 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'] === VappEntity.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["containerId"] = state?.containerId; resourceInputs["customAttributes"] = state?.customAttributes; resourceInputs["startAction"] = state?.startAction; resourceInputs["startDelay"] = state?.startDelay; resourceInputs["startOrder"] = state?.startOrder; resourceInputs["stopAction"] = state?.stopAction; resourceInputs["stopDelay"] = state?.stopDelay; resourceInputs["tags"] = state?.tags; resourceInputs["targetId"] = state?.targetId; resourceInputs["waitForGuest"] = state?.waitForGuest; } else { const args = argsOrState; if (args?.containerId === undefined && !opts.urn) { throw new Error("Missing required property 'containerId'"); } if (args?.targetId === undefined && !opts.urn) { throw new Error("Missing required property 'targetId'"); } resourceInputs["containerId"] = args?.containerId; resourceInputs["customAttributes"] = args?.customAttributes; resourceInputs["startAction"] = args?.startAction; resourceInputs["startDelay"] = args?.startDelay; resourceInputs["startOrder"] = args?.startOrder; resourceInputs["stopAction"] = args?.stopAction; resourceInputs["stopDelay"] = args?.stopDelay; resourceInputs["tags"] = args?.tags; resourceInputs["targetId"] = args?.targetId; resourceInputs["waitForGuest"] = args?.waitForGuest; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VappEntity.__pulumiType, name, resourceInputs, opts); } } exports.VappEntity = VappEntity; /** @internal */ VappEntity.__pulumiType = 'vsphere:index/vappEntity:VappEntity'; //# sourceMappingURL=vappEntity.js.map