UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

124 lines 5.64 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.Cable = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/cable/): * * > All connections between device components in NetBox are represented using cables. A cable represents a direct physical connection between two sets of endpoints (A and B), such as a console port and a patch panel port, or between two network interfaces. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // assumes that the referenced console port resources exist * const test = new netbox.dcim.Cable("test", { * aTerminations: [ * { * objectType: "dcim.consoleserverport", * objectId: kvm1.id, * }, * { * objectType: "dcim.consoleserverport", * objectId: kvm2.id, * }, * ], * bTerminations: [ * { * objectType: "dcim.consoleport", * objectId: server1.id, * }, * { * objectType: "dcim.consoleport", * objectId: server2.id, * }, * ], * status: "connected", * label: "KVM cable", * type: "cat8", * colorHex: "123456", * length: 10, * lengthUnit: "m", * }); * ``` */ class Cable extends pulumi.CustomResource { /** * Get an existing Cable 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 Cable(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Cable. 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'] === Cable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aTerminations"] = state ? state.aTerminations : undefined; resourceInputs["bTerminations"] = state ? state.bTerminations : undefined; resourceInputs["colorHex"] = state ? state.colorHex : undefined; resourceInputs["comments"] = state ? state.comments : undefined; resourceInputs["customFields"] = state ? state.customFields : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["length"] = state ? state.length : undefined; resourceInputs["lengthUnit"] = state ? state.lengthUnit : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tenantId"] = state ? state.tenantId : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.aTerminations === undefined) && !opts.urn) { throw new Error("Missing required property 'aTerminations'"); } if ((!args || args.bTerminations === undefined) && !opts.urn) { throw new Error("Missing required property 'bTerminations'"); } if ((!args || args.status === undefined) && !opts.urn) { throw new Error("Missing required property 'status'"); } resourceInputs["aTerminations"] = args ? args.aTerminations : undefined; resourceInputs["bTerminations"] = args ? args.bTerminations : undefined; resourceInputs["colorHex"] = args ? args.colorHex : undefined; resourceInputs["comments"] = args ? args.comments : undefined; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["length"] = args ? args.length : undefined; resourceInputs["lengthUnit"] = args ? args.lengthUnit : undefined; resourceInputs["status"] = args ? args.status : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tenantId"] = args ? args.tenantId : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cable.__pulumiType, name, resourceInputs, opts); } } exports.Cable = Cable; /** @internal */ Cable.__pulumiType = 'netbox:dcim/cable:Cable'; //# sourceMappingURL=cable.js.map