@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
100 lines • 4.9 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.AvailablePrefix = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
* import * as netbox from "@pulumi/netbox";
*
* const test = netbox.ipam.getPrefix({
* cidr: "10.0.0.0/24",
* });
* const testAvailablePrefix = new netbox.ipam.AvailablePrefix("test", {
* parentPrefixId: test.then(test => test.id),
* prefixLength: 25,
* status: "active",
* });
* ```
*/
class AvailablePrefix extends pulumi.CustomResource {
/**
* Get an existing AvailablePrefix 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 AvailablePrefix(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AvailablePrefix. 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'] === AvailablePrefix.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["isPool"] = state ? state.isPool : undefined;
resourceInputs["markUtilized"] = state ? state.markUtilized : undefined;
resourceInputs["parentPrefixId"] = state ? state.parentPrefixId : undefined;
resourceInputs["prefix"] = state ? state.prefix : undefined;
resourceInputs["prefixLength"] = state ? state.prefixLength : 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["vlanId"] = state ? state.vlanId : undefined;
resourceInputs["vrfId"] = state ? state.vrfId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.parentPrefixId === undefined) && !opts.urn) {
throw new Error("Missing required property 'parentPrefixId'");
}
if ((!args || args.prefixLength === undefined) && !opts.urn) {
throw new Error("Missing required property 'prefixLength'");
}
if ((!args || args.status === undefined) && !opts.urn) {
throw new Error("Missing required property 'status'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["isPool"] = args ? args.isPool : undefined;
resourceInputs["markUtilized"] = args ? args.markUtilized : undefined;
resourceInputs["parentPrefixId"] = args ? args.parentPrefixId : undefined;
resourceInputs["prefixLength"] = args ? args.prefixLength : 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["vlanId"] = args ? args.vlanId : undefined;
resourceInputs["vrfId"] = args ? args.vrfId : undefined;
resourceInputs["prefix"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AvailablePrefix.__pulumiType, name, resourceInputs, opts);
}
}
exports.AvailablePrefix = AvailablePrefix;
/** @internal */
AvailablePrefix.__pulumiType = 'netbox:ipam/availablePrefix:AvailablePrefix';
//# sourceMappingURL=availablePrefix.js.map