UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

105 lines 5.3 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.DeviceRearPort = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/rearport/): * * > Like front ports, rear ports are pass-through ports which represent the continuation of a path from one cable to the next. Each rear port is defined with its physical type and a number of positions: Rear ports with more than one position can be mapped to multiple front ports. This can be useful for modeling instances where multiple paths share a common cable (for example, six discrete two-strand fiber connections sharing a 12-strand MPO cable). * * ## 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 testDeviceRearPort = new netbox.dcim.DeviceRearPort("test", { * deviceId: test.id, * name: "rear port 1", * type: "8p8c", * positions: 2, * markConnected: true, * }); * ``` */ class DeviceRearPort extends pulumi.CustomResource { /** * Get an existing DeviceRearPort 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 DeviceRearPort(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DeviceRearPort. 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'] === DeviceRearPort.__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["deviceId"] = state ? state.deviceId : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["markConnected"] = state ? state.markConnected : undefined; resourceInputs["moduleId"] = state ? state.moduleId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["positions"] = state ? state.positions : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.deviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'deviceId'"); } if ((!args || args.positions === undefined) && !opts.urn) { throw new Error("Missing required property 'positions'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["colorHex"] = args ? args.colorHex : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["markConnected"] = args ? args.markConnected : undefined; resourceInputs["moduleId"] = args ? args.moduleId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["positions"] = args ? args.positions : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DeviceRearPort.__pulumiType, name, resourceInputs, opts); } } exports.DeviceRearPort = DeviceRearPort; /** @internal */ DeviceRearPort.__pulumiType = 'netbox:dcim/deviceRearPort:DeviceRearPort'; //# sourceMappingURL=deviceRearPort.js.map