@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
97 lines • 4.25 kB
JavaScript
;
// *** 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.Vlan = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/vlans/#vlans):
*
* > A VLAN represents an isolated layer two domain, identified by a name and a numeric ID (1-4094) as defined in IEEE 802.1Q. VLANs are arranged into VLAN groups to define scope and to enforce uniqueness.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const example1 = new netbox.ipam.Vlan("example1", {
* name: "VLAN 1",
* vid: 1777,
* tags: [],
* });
* // Assume netbox_tenant, netbox_site, and netbox_tag resources exist
* const example2 = new netbox.ipam.Vlan("example2", {
* name: "VLAN 2",
* vid: 1778,
* status: "reserved",
* description: "Reserved example VLAN",
* tenantId: exNetboxTenant.id,
* siteId: exNetboxSite.id,
* groupId: ex.id,
* tags: [exNetboxTag.name],
* });
* ```
*/
class Vlan extends pulumi.CustomResource {
/**
* Get an existing Vlan 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 Vlan(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Vlan. 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'] === Vlan.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["roleId"] = state ? state.roleId : undefined;
resourceInputs["siteId"] = state ? state.siteId : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["vid"] = state ? state.vid : undefined;
}
else {
const args = argsOrState;
if ((!args || args.vid === undefined) && !opts.urn) {
throw new Error("Missing required property 'vid'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["roleId"] = args ? args.roleId : undefined;
resourceInputs["siteId"] = args ? args.siteId : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["vid"] = args ? args.vid : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Vlan.__pulumiType, name, resourceInputs, opts);
}
}
exports.Vlan = Vlan;
/** @internal */
Vlan.__pulumiType = 'netbox:ipam/vlan:Vlan';
//# sourceMappingURL=vlan.js.map