@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
97 lines • 5 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.Prefix = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/ipam/#prefixes):
*
* > A prefix is an IPv4 or IPv6 network and mask expressed in CIDR notation (e.g. 192.0.2.0/24). A prefix entails only the "network portion" of an IP address: All bits in the address not covered by the mask must be zero. (In other words, a prefix cannot be a specific IP address.)
* >
* > Prefixes are automatically organized by their parent aggregates. Additionally, each prefix can be assigned to a particular site and virtual routing and forwarding instance (VRF). Each VRF represents a separate IP space or routing table. All prefixes not assigned to a VRF are considered to be in the "global" table.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const myPrefix = new netbox.ipam.Prefix("my_prefix", {
* prefix: "10.0.0.0/24",
* status: "active",
* description: "test prefix",
* });
* ```
*/
class Prefix extends pulumi.CustomResource {
/**
* Get an existing Prefix 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 Prefix(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Prefix. 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'] === Prefix.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["customFields"] = state ? state.customFields : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["isPool"] = state ? state.isPool : undefined;
resourceInputs["markUtilized"] = state ? state.markUtilized : undefined;
resourceInputs["prefix"] = state ? state.prefix : 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.prefix === undefined) && !opts.urn) {
throw new Error("Missing required property 'prefix'");
}
if ((!args || args.status === undefined) && !opts.urn) {
throw new Error("Missing required property 'status'");
}
resourceInputs["customFields"] = args ? args.customFields : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["isPool"] = args ? args.isPool : undefined;
resourceInputs["markUtilized"] = args ? args.markUtilized : undefined;
resourceInputs["prefix"] = args ? args.prefix : 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;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Prefix.__pulumiType, name, resourceInputs, opts);
}
}
exports.Prefix = Prefix;
/** @internal */
Prefix.__pulumiType = 'netbox:ipam/prefix:Prefix';
//# sourceMappingURL=prefix.js.map