UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

119 lines 5.75 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.InventoryItem = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/inventoryitem/): * * > Inventory items represent hardware components installed within a device, such as a power supply or CPU or line card. They are intended to be used primarily for inventory purposes. * * ## 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, * tenantId: testNetboxTenant.id, * roleId: testNetboxDeviceRole.id, * siteId: testNetboxSite.id, * }); * const testDeviceRearPort = new netbox.dcim.DeviceRearPort("test", { * deviceId: test.id, * name: "rear port", * type: "8p8c", * positions: 1, * markConnected: true, * }); * const parent = new netbox.dcim.InventoryItem("parent", { * deviceId: test.id, * name: "Parent Item", * }); * const testInventoryItem = new netbox.dcim.InventoryItem("test", { * deviceId: test.id, * name: "Child Item", * parentId: parent.id, * componentType: "dcim.rearport", * componentId: testDeviceRearPort.id, * }); * ``` */ class InventoryItem extends pulumi.CustomResource { /** * Get an existing InventoryItem 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 InventoryItem(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of InventoryItem. 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'] === InventoryItem.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["assetTag"] = state ? state.assetTag : undefined; resourceInputs["componentId"] = state ? state.componentId : undefined; resourceInputs["componentType"] = state ? state.componentType : undefined; resourceInputs["customFields"] = state ? state.customFields : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["deviceId"] = state ? state.deviceId : undefined; resourceInputs["discovered"] = state ? state.discovered : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["manufacturerId"] = state ? state.manufacturerId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parentId"] = state ? state.parentId : undefined; resourceInputs["partId"] = state ? state.partId : undefined; resourceInputs["roleId"] = state ? state.roleId : undefined; resourceInputs["serial"] = state ? state.serial : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.deviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'deviceId'"); } resourceInputs["assetTag"] = args ? args.assetTag : undefined; resourceInputs["componentId"] = args ? args.componentId : undefined; resourceInputs["componentType"] = args ? args.componentType : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["discovered"] = args ? args.discovered : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["manufacturerId"] = args ? args.manufacturerId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["parentId"] = args ? args.parentId : undefined; resourceInputs["partId"] = args ? args.partId : undefined; resourceInputs["roleId"] = args ? args.roleId : undefined; resourceInputs["serial"] = args ? args.serial : undefined; resourceInputs["tags"] = args ? args.tags : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InventoryItem.__pulumiType, name, resourceInputs, opts); } } exports.InventoryItem = InventoryItem; /** @internal */ InventoryItem.__pulumiType = 'netbox:dcim/inventoryItem:InventoryItem'; //# sourceMappingURL=inventoryItem.js.map