@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
98 lines • 3.54 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.Datacenter = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a VMware vSphere datacenter resource. This can be used as the primary
* container of inventory objects such as hosts and virtual machines.
*
* ## Example Usage
*
* ### Create datacenter on the root folder
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const prodDatacenter = new vsphere.Datacenter("prod_datacenter", {name: "my_prod_datacenter"});
* ```
*
* ### Create datacenter on a subfolder
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const researchDatacenter = new vsphere.Datacenter("research_datacenter", {
* name: "my_research_datacenter",
* folder: "/research/",
* });
* ```
*
* ## Import
*
* An existing datacenter can be imported into this resource
*
* via supplying the full path to the datacenter. An example is below:
*
* [docs-import]: /docs/import/index.html
*
* ```sh
* $ pulumi import vsphere:index/datacenter:Datacenter dc /dc1
* ```
*
* The above would import the datacenter named `dc1`.
*/
class Datacenter extends pulumi.CustomResource {
/**
* Get an existing Datacenter 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 Datacenter(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Datacenter. 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'] === Datacenter.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["customAttributes"] = state?.customAttributes;
resourceInputs["folder"] = state?.folder;
resourceInputs["moid"] = state?.moid;
resourceInputs["name"] = state?.name;
resourceInputs["tags"] = state?.tags;
}
else {
const args = argsOrState;
resourceInputs["customAttributes"] = args?.customAttributes;
resourceInputs["folder"] = args?.folder;
resourceInputs["name"] = args?.name;
resourceInputs["tags"] = args?.tags;
resourceInputs["moid"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Datacenter.__pulumiType, name, resourceInputs, opts);
}
}
exports.Datacenter = Datacenter;
/** @internal */
Datacenter.__pulumiType = 'vsphere:index/datacenter:Datacenter';
//# sourceMappingURL=datacenter.js.map