UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

96 lines 4.32 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.InventoryItemRole = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/inventoryitemrole/): * * > Inventory items can be organized by functional roles, which are fully customizable by the user. For example, you might create roles for power supplies, fans, interface optics, etc. * * ## 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 testInventoryItemRole = new netbox.dcim.InventoryItemRole("test", { * name: "Role 1", * slug: "role-1-slug", * colorHex: "123456", * }); * const parent = new netbox.dcim.InventoryItem("parent", { * deviceId: test.id, * name: "Inventory Item 1", * roleId: testInventoryItemRole.id, * }); * ``` */ class InventoryItemRole extends pulumi.CustomResource { /** * Get an existing InventoryItemRole 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 InventoryItemRole(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of InventoryItemRole. 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'] === InventoryItemRole.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["colorHex"] = state ? state.colorHex : undefined; resourceInputs["customFields"] = state ? state.customFields : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["slug"] = state ? state.slug : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.colorHex === undefined) && !opts.urn) { throw new Error("Missing required property 'colorHex'"); } if ((!args || args.slug === undefined) && !opts.urn) { throw new Error("Missing required property 'slug'"); } resourceInputs["colorHex"] = args ? args.colorHex : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["slug"] = args ? args.slug : undefined; resourceInputs["tags"] = args ? args.tags : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InventoryItemRole.__pulumiType, name, resourceInputs, opts); } } exports.InventoryItemRole = InventoryItemRole; /** @internal */ InventoryItemRole.__pulumiType = 'netbox:dcim/inventoryItemRole:InventoryItemRole'; //# sourceMappingURL=inventoryItemRole.js.map