UNPKG

pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox resources.

84 lines 4.01 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.Cluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/core-functionality/virtualization/#clusters): * * > A cluster is a logical grouping of physical resources within which virtual machines run. A cluster must be assigned a type (technological classification), and may optionally be assigned to a cluster group, site, and/or tenant. Each cluster must have a unique name within its assigned group and/or site, if any. * > * > Physical devices may be associated with clusters as hosts. This allows users to track on which host(s) a particular virtual machine may reside. However, NetBox does not support pinning a specific VM within a cluster to a particular host device. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@pulumi/netbox"; * import * as pulumi_netbox from "pulumi-netbox"; * * const dcWest = netbox.getClusterGroup({ * name: "dc-west", * }); * const vmwVsphere = new netbox.ClusterType("vmwVsphere", {}); * const vmwCluster01 = new netbox.Cluster("vmwCluster01", { * clusterTypeId: vmwVsphere.id, * clusterGroupId: dcWest.then(dcWest => dcWest.id), * }); * ``` */ class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster 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 Cluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterGroupId"] = state ? state.clusterGroupId : undefined; resourceInputs["clusterTypeId"] = state ? state.clusterTypeId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["siteId"] = state ? state.siteId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.clusterTypeId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterTypeId'"); } resourceInputs["clusterGroupId"] = args ? args.clusterGroupId : undefined; resourceInputs["clusterTypeId"] = args ? args.clusterTypeId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["siteId"] = args ? args.siteId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'netbox:index/cluster:Cluster'; //# sourceMappingURL=cluster.js.map