@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
104 lines • 5.57 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.AvailableIpAddress = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Per [the docs](https://netbox.readthedocs.io/en/stable/models/ipam/ipaddress/):
*
* > An IP address comprises a single host address (either IPv4 or IPv6) and its subnet mask. Its mask should match exactly how the IP address is configured on an interface in the real world.
* Like a prefix, an IP address can optionally be assigned to a VRF (otherwise, it will appear in the "global" table). IP addresses are automatically arranged under parent prefixes within their respective VRFs according to the IP hierarchya.
* >
* > Each IP address can also be assigned an operational status and a functional role. Statuses are hard-coded in NetBox and include the following:
* > * Active
* > * Reserved
* > * Deprecated
* > * DHCP
* > * SLAAC (IPv6 Stateless Address Autoconfiguration)
*
* This resource will retrieve the next available IP address from a given prefix or IP range (specified by ID)
*
* ## Example Usage
*
* ### Creating an IP in a prefix
* ```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 testAvailableIpAddress = new netbox.ipam.AvailableIpAddress("test", {prefixId: test.then(test => test.id)});
* ```
*/
class AvailableIpAddress extends pulumi.CustomResource {
/**
* Get an existing AvailableIpAddress 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 AvailableIpAddress(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AvailableIpAddress. 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'] === AvailableIpAddress.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["deviceInterfaceId"] = state ? state.deviceInterfaceId : undefined;
resourceInputs["dnsName"] = state ? state.dnsName : undefined;
resourceInputs["interfaceId"] = state ? state.interfaceId : undefined;
resourceInputs["ipAddress"] = state ? state.ipAddress : undefined;
resourceInputs["ipRangeId"] = state ? state.ipRangeId : undefined;
resourceInputs["objectType"] = state ? state.objectType : undefined;
resourceInputs["prefixId"] = state ? state.prefixId : undefined;
resourceInputs["role"] = state ? state.role : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["virtualMachineInterfaceId"] = state ? state.virtualMachineInterfaceId : undefined;
resourceInputs["vrfId"] = state ? state.vrfId : undefined;
}
else {
const args = argsOrState;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["deviceInterfaceId"] = args ? args.deviceInterfaceId : undefined;
resourceInputs["dnsName"] = args ? args.dnsName : undefined;
resourceInputs["interfaceId"] = args ? args.interfaceId : undefined;
resourceInputs["ipRangeId"] = args ? args.ipRangeId : undefined;
resourceInputs["objectType"] = args ? args.objectType : undefined;
resourceInputs["prefixId"] = args ? args.prefixId : undefined;
resourceInputs["role"] = args ? args.role : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["virtualMachineInterfaceId"] = args ? args.virtualMachineInterfaceId : undefined;
resourceInputs["vrfId"] = args ? args.vrfId : undefined;
resourceInputs["ipAddress"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AvailableIpAddress.__pulumiType, name, resourceInputs, opts);
}
}
exports.AvailableIpAddress = AvailableIpAddress;
/** @internal */
AvailableIpAddress.__pulumiType = 'netbox:ipam/availableIpAddress:AvailableIpAddress';
//# sourceMappingURL=availableIpAddress.js.map