UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

86 lines 4.04 kB
"use strict"; // *** 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.Location = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * From the [official documentation](https://docs.netbox.dev/en/stable/features/sites-and-racks/#locations): * * > Racks and devices can be grouped by location within a site. A location may represent a floor, room, cage, or similar organizational unit. Locations can be nested to form a hierarchy. For example, you may have floors within a site, and rooms within a floor. * * Each location must have a name that is unique within its parent site and location, if any. * * ## 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"}); * const testTenant = new netbox.tenancy.Tenant("test", {name: "test"}); * const testLocation = new netbox.dcim.Location("test", { * name: "test", * description: "my description", * siteId: test.id, * tenantId: testTenant.id, * }); * ``` */ class Location extends pulumi.CustomResource { /** * Get an existing Location 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 Location(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Location. 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'] === Location.__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["name"] = state ? state.name : undefined; resourceInputs["parentId"] = state ? state.parentId : undefined; resourceInputs["siteId"] = state ? state.siteId : undefined; resourceInputs["slug"] = state ? state.slug : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tenantId"] = state ? state.tenantId : undefined; } else { const args = argsOrState; resourceInputs["customFields"] = args ? args.customFields : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["parentId"] = args ? args.parentId : undefined; resourceInputs["siteId"] = args ? args.siteId : undefined; resourceInputs["slug"] = args ? args.slug : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tenantId"] = args ? args.tenantId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Location.__pulumiType, name, resourceInputs, opts); } } exports.Location = Location; /** @internal */ Location.__pulumiType = 'netbox:dcim/location:Location'; //# sourceMappingURL=location.js.map