@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
119 lines • 6.03 kB
JavaScript
;
// *** 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.DeviceFrontPort = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/frontport/):
*
* > Front ports are pass-through ports which represent physical cable connections that comprise part of a longer path. For example, the ports on the front face of a UTP patch panel would be modeled in NetBox as front ports. Each port is assigned a physical type, and must be mapped to a specific rear port on the same device. A single rear port may be mapped to multiple front ports, using numeric positions to annotate the specific alignment of each.
*
* ## 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,
* });
* const testDeviceFrontPort = new netbox.dcim.DeviceFrontPort("test", {
* deviceId: test.id,
* name: "front port 1",
* type: "8p8c",
* rearPortId: testDeviceRearPort.id,
* rearPortPosition: 2,
* });
* ```
*/
class DeviceFrontPort extends pulumi.CustomResource {
/**
* Get an existing DeviceFrontPort 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 DeviceFrontPort(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DeviceFrontPort. 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'] === DeviceFrontPort.__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["rearPortId"] = state ? state.rearPortId : undefined;
resourceInputs["rearPortPosition"] = state ? state.rearPortPosition : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAlls"] = state ? state.tagsAlls : 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.rearPortId === undefined) && !opts.urn) {
throw new Error("Missing required property 'rearPortId'");
}
if ((!args || args.rearPortPosition === undefined) && !opts.urn) {
throw new Error("Missing required property 'rearPortPosition'");
}
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["rearPortId"] = args ? args.rearPortId : undefined;
resourceInputs["rearPortPosition"] = args ? args.rearPortPosition : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["tagsAlls"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DeviceFrontPort.__pulumiType, name, resourceInputs, opts);
}
}
exports.DeviceFrontPort = DeviceFrontPort;
/** @internal */
DeviceFrontPort.__pulumiType = 'netbox:dcim/deviceFrontPort:DeviceFrontPort';
//# sourceMappingURL=deviceFrontPort.js.map