@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
91 lines • 3.81 kB
JavaScript
;
// *** 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.CustomAttribute = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.CustomAttribute` resource can be used to create and manage custom
* attributes, which allow users to associate user-specific meta-information with
* vSphere managed objects. Custom attribute values must be strings and are stored
* on the vCenter Server and not the managed object.
*
* For more information about custom attributes, click [here][ext-custom-attributes].
*
* [ext-custom-attributes]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vcenter-and-host-management-8-0/vsphere-tags-and-attributes-host-management/custom-attributes-in-the-vsphere-client-host-management.html
*
* > **NOTE:** Custom attributes are unsupported on direct ESXi host connections
* and require vCenter Server.
*
* ## Example Usage
*
* This example creates a custom attribute named `test-attribute`. The
* resulting custom attribute can be assigned to VMs only.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const attribute = new vsphere.CustomAttribute("attribute", {
* name: "test-attribute",
* managedObjectType: "VirtualMachine",
* });
* ```
*
* ## Import
*
* An existing custom attribute can be imported into this resource
*
* via its name, using the following command:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/customAttribute:CustomAttribute attribute terraform-test-attribute
* ```
*/
class CustomAttribute extends pulumi.CustomResource {
/**
* Get an existing CustomAttribute 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 CustomAttribute(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of CustomAttribute. 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'] === CustomAttribute.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["managedObjectType"] = state ? state.managedObjectType : undefined;
resourceInputs["name"] = state ? state.name : undefined;
}
else {
const args = argsOrState;
resourceInputs["managedObjectType"] = args ? args.managedObjectType : undefined;
resourceInputs["name"] = args ? args.name : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CustomAttribute.__pulumiType, name, resourceInputs, opts);
}
}
exports.CustomAttribute = CustomAttribute;
/** @internal */
CustomAttribute.__pulumiType = 'vsphere:index/customAttribute:CustomAttribute';
//# sourceMappingURL=customAttribute.js.map