@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
108 lines • 5.72 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.DeviceInterface = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/device/#interface):
*
* > Interfaces in NetBox represent network interfaces used to exchange data with connected devices. On modern networks, these are most commonly Ethernet, but other types are supported as well. IP addresses and VLANs can be assigned to interfaces.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* // Assumes a device with ID 123 exists
* const test = new netbox.dcim.DeviceInterface("test", {
* name: "testinterface",
* deviceId: 123,
* type: "1000base-t",
* });
* ```
*/
class DeviceInterface extends pulumi.CustomResource {
/**
* Get an existing DeviceInterface 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 DeviceInterface(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DeviceInterface. 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'] === DeviceInterface.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["deviceId"] = state ? state.deviceId : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["lagDeviceInterfaceId"] = state ? state.lagDeviceInterfaceId : undefined;
resourceInputs["macAddress"] = state ? state.macAddress : undefined;
resourceInputs["macAddresses"] = state ? state.macAddresses : undefined;
resourceInputs["mgmtonly"] = state ? state.mgmtonly : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["mtu"] = state ? state.mtu : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["parentDeviceInterfaceId"] = state ? state.parentDeviceInterfaceId : undefined;
resourceInputs["speed"] = state ? state.speed : undefined;
resourceInputs["taggedVlans"] = state ? state.taggedVlans : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAlls"] = state ? state.tagsAlls : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["untaggedVlan"] = state ? state.untaggedVlan : undefined;
}
else {
const args = argsOrState;
if ((!args || args.deviceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'deviceId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["deviceId"] = args ? args.deviceId : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["lagDeviceInterfaceId"] = args ? args.lagDeviceInterfaceId : undefined;
resourceInputs["mgmtonly"] = args ? args.mgmtonly : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["mtu"] = args ? args.mtu : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parentDeviceInterfaceId"] = args ? args.parentDeviceInterfaceId : undefined;
resourceInputs["speed"] = args ? args.speed : undefined;
resourceInputs["taggedVlans"] = args ? args.taggedVlans : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["untaggedVlan"] = args ? args.untaggedVlan : undefined;
resourceInputs["macAddress"] = undefined /*out*/;
resourceInputs["macAddresses"] = undefined /*out*/;
resourceInputs["tagsAlls"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DeviceInterface.__pulumiType, name, resourceInputs, opts);
}
}
exports.DeviceInterface = DeviceInterface;
/** @internal */
DeviceInterface.__pulumiType = 'netbox:dcim/deviceInterface:DeviceInterface';
//# sourceMappingURL=deviceInterface.js.map