UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

104 lines 4.27 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.TagCategory = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `vsphere.TagCategory` resource can be used to create and manage tag * categories, which determine how tags are grouped together and applied to * specific objects. * * For more information about tags, click [here][ext-tags-general]. * * [ext-tags-general]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-tags-and-attributes.html * * ## Example Usage * * This example creates a tag category named `test-category`, with * single cardinality (meaning that only one tag in this category can be assigned * to an object at any given time). Tags in this category can only be assigned to * VMs and datastores. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const category = new vsphere.TagCategory("category", { * name: "test-category", * description: "Managed by Pulumi", * cardinality: "SINGLE", * associableTypes: [ * "VirtualMachine", * "Datastore", * ], * }); * ``` * * ## Import * * An existing tag category 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/tagCategory:TagCategory category terraform-test-category * ``` */ class TagCategory extends pulumi.CustomResource { /** * Get an existing TagCategory 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 TagCategory(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of TagCategory. 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'] === TagCategory.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["associableTypes"] = state ? state.associableTypes : undefined; resourceInputs["cardinality"] = state ? state.cardinality : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["name"] = state ? state.name : undefined; } else { const args = argsOrState; if ((!args || args.associableTypes === undefined) && !opts.urn) { throw new Error("Missing required property 'associableTypes'"); } if ((!args || args.cardinality === undefined) && !opts.urn) { throw new Error("Missing required property 'cardinality'"); } resourceInputs["associableTypes"] = args ? args.associableTypes : undefined; resourceInputs["cardinality"] = args ? args.cardinality : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(TagCategory.__pulumiType, name, resourceInputs, opts); } } exports.TagCategory = TagCategory; /** @internal */ TagCategory.__pulumiType = 'vsphere:index/tagCategory:TagCategory'; //# sourceMappingURL=tagCategory.js.map