@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
92 lines • 4.22 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/contacts#contactassignments_1):
*
* > Much like tenancy, contact assignment enables you to track ownership of resources modeled in NetBox.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const test = new netbox.tenancy.Contact("test", {name: "test"});
* const testContactRole = new netbox.tenancy.ContactRole("test", {name: "test"});
* // Assumes that a device with id 123 exists
* const testContactAssignment = new netbox.tenancy.ContactAssignment("test", {
* contentType: "dcim.device",
* objectId: 123,
* contactId: test.id,
* roleId: testContactRole.id,
* priority: "primary",
* });
* ```
*/
class ContactAssignment extends pulumi.CustomResource {
/**
* Get an existing ContactAssignment 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 ContactAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ContactAssignment. 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'] === ContactAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["contactId"] = state ? state.contactId : undefined;
resourceInputs["contentType"] = state ? state.contentType : undefined;
resourceInputs["objectId"] = state ? state.objectId : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["roleId"] = state ? state.roleId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.contactId === undefined) && !opts.urn) {
throw new Error("Missing required property 'contactId'");
}
if ((!args || args.contentType === undefined) && !opts.urn) {
throw new Error("Missing required property 'contentType'");
}
if ((!args || args.objectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'objectId'");
}
if ((!args || args.roleId === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleId'");
}
resourceInputs["contactId"] = args ? args.contactId : undefined;
resourceInputs["contentType"] = args ? args.contentType : undefined;
resourceInputs["objectId"] = args ? args.objectId : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["roleId"] = args ? args.roleId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ContactAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.ContactAssignment = ContactAssignment;
/** @internal */
ContactAssignment.__pulumiType = 'netbox:tenancy/contactAssignment:ContactAssignment';
//# sourceMappingURL=contactAssignment.js.map