UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

92 lines 4.61 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/features/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 "@natzka-oss/pulumi-netbox"; * import * as netbox from "@pulumi/netbox"; * * // Assumes the 'dc-west' cluster group already exists * const dcWest = netbox.virt.getClusterGroup({ * name: "dc-west", * }); * const vmwVsphere = new netbox.virt.ClusterType("vmw_vsphere", {name: "VMware vSphere 6"}); * const vmwCluster01 = new netbox.virt.Cluster("vmw_cluster_01", { * clusterTypeId: vmwVsphere.id, * name: "vmw-cluster-01", * 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["comments"] = state ? state.comments : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["siteId"] = state ? state.siteId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tenantId"] = state ? state.tenantId : 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["comments"] = args ? args.comments : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["siteId"] = args ? args.siteId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tenantId"] = args ? args.tenantId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'netbox:virt/cluster:Cluster'; //# sourceMappingURL=cluster.js.map