pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox resources.
73 lines • 3.85 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.Device = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/core-functionality/devices/#devices):
*
* > Every piece of hardware which is installed within a site or rack exists in NetBox as a device. Devices are measured in rack units (U) and can be half depth or full depth. A device may have a height of 0U: These devices do not consume vertical rack space and cannot be assigned to a particular rack unit. A common example of a 0U device is a vertically-mounted PDU.
*/
class Device extends pulumi.CustomResource {
/**
* Get an existing Device 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 Device(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Device. 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'] === Device.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["comments"] = state ? state.comments : undefined;
resourceInputs["deviceTypeId"] = state ? state.deviceTypeId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["primaryIpv4"] = state ? state.primaryIpv4 : undefined;
resourceInputs["roleId"] = state ? state.roleId : undefined;
resourceInputs["serial"] = state ? state.serial : 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.deviceTypeId === undefined) && !opts.urn) {
throw new Error("Missing required property 'deviceTypeId'");
}
resourceInputs["comments"] = args ? args.comments : undefined;
resourceInputs["deviceTypeId"] = args ? args.deviceTypeId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["roleId"] = args ? args.roleId : undefined;
resourceInputs["serial"] = args ? args.serial : undefined;
resourceInputs["siteId"] = args ? args.siteId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["primaryIpv4"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Device.__pulumiType, name, resourceInputs, opts);
}
}
exports.Device = Device;
/** @internal */
Device.__pulumiType = 'netbox:index/device:Device';
//# sourceMappingURL=device.js.map