UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

138 lines 6.79 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.PowerFeed = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/powerfeed/): * * > A power feed represents the distribution of power from a power panel to a particular device, typically a power distribution unit (PDU). The power port (inlet) on a device can be connected via a cable to a power feed. A power feed may optionally be assigned to a rack to allow more easily tracking the distribution of power among racks. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * const test = new netbox.dcim.Site("test", { * name: "Site 1", * status: "active", * }); * const testLocation = new netbox.dcim.Location("test", { * name: "Location 1", * siteId: test.id, * }); * const testPowerPanel = new netbox.dcim.PowerPanel("test", { * name: "Power Panel 1", * siteId: test.id, * locationId: testLocation.id, * }); * const testPowerFeed = new netbox.dcim.PowerFeed("test", { * powerPanelId: testPowerPanel.id, * name: "Power Feed 1", * status: "active", * type: "primary", * supply: "ac", * phase: "single-phase", * voltage: 250, * amperage: 100, * maxPercentUtilization: 80, * }); * ``` */ class PowerFeed extends pulumi.CustomResource { /** * Get an existing PowerFeed 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 PowerFeed(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of PowerFeed. 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'] === PowerFeed.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["amperage"] = state ? state.amperage : undefined; resourceInputs["comments"] = state ? state.comments : undefined; resourceInputs["customFields"] = state ? state.customFields : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["markConnected"] = state ? state.markConnected : undefined; resourceInputs["maxPercentUtilization"] = state ? state.maxPercentUtilization : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["phase"] = state ? state.phase : undefined; resourceInputs["powerPanelId"] = state ? state.powerPanelId : undefined; resourceInputs["rackId"] = state ? state.rackId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["supply"] = state ? state.supply : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["voltage"] = state ? state.voltage : undefined; } else { const args = argsOrState; if ((!args || args.amperage === undefined) && !opts.urn) { throw new Error("Missing required property 'amperage'"); } if ((!args || args.maxPercentUtilization === undefined) && !opts.urn) { throw new Error("Missing required property 'maxPercentUtilization'"); } if ((!args || args.phase === undefined) && !opts.urn) { throw new Error("Missing required property 'phase'"); } if ((!args || args.powerPanelId === undefined) && !opts.urn) { throw new Error("Missing required property 'powerPanelId'"); } if ((!args || args.status === undefined) && !opts.urn) { throw new Error("Missing required property 'status'"); } if ((!args || args.supply === undefined) && !opts.urn) { throw new Error("Missing required property 'supply'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } if ((!args || args.voltage === undefined) && !opts.urn) { throw new Error("Missing required property 'voltage'"); } resourceInputs["amperage"] = args ? args.amperage : undefined; resourceInputs["comments"] = args ? args.comments : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["markConnected"] = args ? args.markConnected : undefined; resourceInputs["maxPercentUtilization"] = args ? args.maxPercentUtilization : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["phase"] = args ? args.phase : undefined; resourceInputs["powerPanelId"] = args ? args.powerPanelId : undefined; resourceInputs["rackId"] = args ? args.rackId : undefined; resourceInputs["status"] = args ? args.status : undefined; resourceInputs["supply"] = args ? args.supply : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["voltage"] = args ? args.voltage : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(PowerFeed.__pulumiType, name, resourceInputs, opts); } } exports.PowerFeed = PowerFeed; /** @internal */ PowerFeed.__pulumiType = 'netbox:dcim/powerFeed:PowerFeed'; //# sourceMappingURL=powerFeed.js.map