@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
109 lines • 4.75 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.RackReservation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/models/dcim/rackreservation/):
*
* > Users can reserve specific units within a rack for future use. An arbitrary set of units within a rack can be associated with a single reservation, but reservations cannot span multiple racks. A description is required for each reservation, reservations may optionally be associated with a specific tenant.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const test = new netbox.dcim.Site("test", {
* name: "test",
* status: "active",
* });
* const testRack = new netbox.dcim.Rack("test", {
* name: "test",
* siteId: test.id,
* status: "active",
* width: 10,
* uHeight: 40,
* });
* const testRackReservation = new netbox.dcim.RackReservation("test", {
* rackId: testRack.id,
* units: [
* 1,
* 2,
* 3,
* 4,
* 5,
* ],
* userId: 1,
* description: "my description",
* });
* ```
*/
class RackReservation extends pulumi.CustomResource {
/**
* Get an existing RackReservation 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 RackReservation(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RackReservation. 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'] === RackReservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["comments"] = state ? state.comments : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["rackId"] = state ? state.rackId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["units"] = state ? state.units : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.description === undefined) && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if ((!args || args.rackId === undefined) && !opts.urn) {
throw new Error("Missing required property 'rackId'");
}
if ((!args || args.units === undefined) && !opts.urn) {
throw new Error("Missing required property 'units'");
}
if ((!args || args.userId === undefined) && !opts.urn) {
throw new Error("Missing required property 'userId'");
}
resourceInputs["comments"] = args ? args.comments : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["rackId"] = args ? args.rackId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["units"] = args ? args.units : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RackReservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.RackReservation = RackReservation;
/** @internal */
RackReservation.__pulumiType = 'netbox:dcim/rackReservation:RackReservation';
//# sourceMappingURL=rackReservation.js.map