@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
112 lines • 5.06 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.EventRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/event-rules/):
*
* > NetBox can be configured via Event Rules to transmit outgoing webhooks to remote systems in response to internal object changes. The receiver can act on the data in these webhook messages to perform related tasks.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const test = new netbox.Webhook("test", {
* name: "my-webhook",
* payloadUrl: "https://example.com/webhook",
* });
* const testEventRule = new netbox.EventRule("test", {
* name: "my-event-rule",
* contentTypes: [
* "dcim.site",
* "virtualization.cluster",
* ],
* actionType: "webhook",
* actionObjectId: test.id,
* eventTypes: [
* "object_created",
* "object_updated",
* "object_deleted",
* "job_started",
* "job_completed",
* "job_failed",
* "job_errored",
* ],
* });
* ```
*/
class EventRule extends pulumi.CustomResource {
/**
* Get an existing EventRule 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 EventRule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of EventRule. 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'] === EventRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actionObjectId"] = state ? state.actionObjectId : undefined;
resourceInputs["actionType"] = state ? state.actionType : undefined;
resourceInputs["conditions"] = state ? state.conditions : undefined;
resourceInputs["contentTypes"] = state ? state.contentTypes : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["eventTypes"] = state ? state.eventTypes : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
}
else {
const args = argsOrState;
if ((!args || args.actionObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'actionObjectId'");
}
if ((!args || args.actionType === undefined) && !opts.urn) {
throw new Error("Missing required property 'actionType'");
}
if ((!args || args.contentTypes === undefined) && !opts.urn) {
throw new Error("Missing required property 'contentTypes'");
}
if ((!args || args.eventTypes === undefined) && !opts.urn) {
throw new Error("Missing required property 'eventTypes'");
}
resourceInputs["actionObjectId"] = args ? args.actionObjectId : undefined;
resourceInputs["actionType"] = args ? args.actionType : undefined;
resourceInputs["conditions"] = args ? args.conditions : undefined;
resourceInputs["contentTypes"] = args ? args.contentTypes : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["eventTypes"] = args ? args.eventTypes : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(EventRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.EventRule = EventRule;
/** @internal */
EventRule.__pulumiType = 'netbox:index/eventRule:EventRule';
//# sourceMappingURL=eventRule.js.map