UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

119 lines 5.77 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Module = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/module/): * * > A module is a field-replaceable hardware component installed within a device which houses its own child components. The most common example is a chassis-based router or switch. * * Similar to devices, modules are instantiated from module types, and any components associated with the module type are automatically instantiated on the new model. Each module must be installed within a module bay on a device, and each module bay may have only one module installed in it. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // Note that some terraform code is not included in the example for brevity * const test = new netbox.dcim.Device("test", { * name: "%[1]s", * deviceTypeId: testNetboxDeviceType.id, * roleId: testNetboxDeviceRole.id, * siteId: testNetboxSite.id, * }); * const testDeviceModuleBay = new netbox.dcim.DeviceModuleBay("test", { * deviceId: test.id, * name: "SFP", * }); * const testManufacturer = new netbox.dcim.Manufacturer("test", {name: "Dell"}); * const testModuleType = new netbox.dcim.ModuleType("test", { * manufacturerId: testManufacturer.id, * model: "Networking", * }); * const testModule = new netbox.dcim.Module("test", { * deviceId: test.id, * moduleBayId: testDeviceModuleBay.id, * moduleTypeId: testModuleType.id, * status: "active", * description: "SFP card", * }); * ``` */ class Module extends pulumi.CustomResource { /** * Get an existing Module 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 Module(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Module. 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'] === Module.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["assetTag"] = state ? state.assetTag : undefined; resourceInputs["comments"] = state ? state.comments : undefined; resourceInputs["customFields"] = state ? state.customFields : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["deviceId"] = state ? state.deviceId : undefined; resourceInputs["moduleBayId"] = state ? state.moduleBayId : undefined; resourceInputs["moduleTypeId"] = state ? state.moduleTypeId : undefined; resourceInputs["serial"] = state ? state.serial : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAlls"] = state ? state.tagsAlls : undefined; } else { const args = argsOrState; if ((!args || args.deviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'deviceId'"); } if ((!args || args.moduleBayId === undefined) && !opts.urn) { throw new Error("Missing required property 'moduleBayId'"); } if ((!args || args.moduleTypeId === undefined) && !opts.urn) { throw new Error("Missing required property 'moduleTypeId'"); } if ((!args || args.status === undefined) && !opts.urn) { throw new Error("Missing required property 'status'"); } resourceInputs["assetTag"] = args ? args.assetTag : undefined; resourceInputs["comments"] = args ? args.comments : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["moduleBayId"] = args ? args.moduleBayId : undefined; resourceInputs["moduleTypeId"] = args ? args.moduleTypeId : undefined; resourceInputs["serial"] = args ? args.serial : undefined; resourceInputs["status"] = args ? args.status : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tagsAlls"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Module.__pulumiType, name, resourceInputs, opts); } } exports.Module = Module; /** @internal */ Module.__pulumiType = 'netbox:dcim/module:Module'; //# sourceMappingURL=module.js.map