netbox.EventRule
Explore with Pulumi AI
From the official documentation:
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
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const testWebhook = new netbox.Webhook("testWebhook", {payloadUrl: "https://example.com/webhook"});
const testEventRule = new netbox.EventRule("testEventRule", {
contentTypes: [
"dcim.site",
"virtualization.cluster",
],
actionType: "webhook",
actionObjectId: testWebhook.webhookId,
eventTypes: [
"object_created",
"object_updated",
"object_deleted",
"job_started",
"job_completed",
"job_failed",
"job_errored",
],
});
import pulumi
import pulumi_netbox as netbox
test_webhook = netbox.Webhook("testWebhook", payload_url="https://example.com/webhook")
test_event_rule = netbox.EventRule("testEventRule",
content_types=[
"dcim.site",
"virtualization.cluster",
],
action_type="webhook",
action_object_id=test_webhook.webhook_id,
event_types=[
"object_created",
"object_updated",
"object_deleted",
"job_started",
"job_completed",
"job_failed",
"job_errored",
])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testWebhook, err := netbox.NewWebhook(ctx, "testWebhook", &netbox.WebhookArgs{
PayloadUrl: pulumi.String("https://example.com/webhook"),
})
if err != nil {
return err
}
_, err = netbox.NewEventRule(ctx, "testEventRule", &netbox.EventRuleArgs{
ContentTypes: pulumi.StringArray{
pulumi.String("dcim.site"),
pulumi.String("virtualization.cluster"),
},
ActionType: pulumi.String("webhook"),
ActionObjectId: testWebhook.WebhookId,
EventTypes: pulumi.StringArray{
pulumi.String("object_created"),
pulumi.String("object_updated"),
pulumi.String("object_deleted"),
pulumi.String("job_started"),
pulumi.String("job_completed"),
pulumi.String("job_failed"),
pulumi.String("job_errored"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
var testWebhook = new Netbox.Webhook("testWebhook", new()
{
PayloadUrl = "https://example.com/webhook",
});
var testEventRule = new Netbox.EventRule("testEventRule", new()
{
ContentTypes = new[]
{
"dcim.site",
"virtualization.cluster",
},
ActionType = "webhook",
ActionObjectId = testWebhook.WebhookId,
EventTypes = new[]
{
"object_created",
"object_updated",
"object_deleted",
"job_started",
"job_completed",
"job_failed",
"job_errored",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Webhook;
import com.pulumi.netbox.WebhookArgs;
import com.pulumi.netbox.EventRule;
import com.pulumi.netbox.EventRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var testWebhook = new Webhook("testWebhook", WebhookArgs.builder()
.payloadUrl("https://example.com/webhook")
.build());
var testEventRule = new EventRule("testEventRule", EventRuleArgs.builder()
.contentTypes(
"dcim.site",
"virtualization.cluster")
.actionType("webhook")
.actionObjectId(testWebhook.webhookId())
.eventTypes(
"object_created",
"object_updated",
"object_deleted",
"job_started",
"job_completed",
"job_failed",
"job_errored")
.build());
}
}
resources:
testWebhook:
type: netbox:Webhook
properties:
payloadUrl: https://example.com/webhook
testEventRule:
type: netbox:EventRule
properties:
contentTypes:
- dcim.site
- virtualization.cluster
actionType: webhook
actionObjectId: ${testWebhook.webhookId}
eventTypes:
- object_created
- object_updated
- object_deleted
- job_started
- job_completed
- job_failed
- job_errored
Create EventRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EventRule(name: string, args: EventRuleArgs, opts?: CustomResourceOptions);
@overload
def EventRule(resource_name: str,
args: EventRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EventRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
action_object_id: Optional[float] = None,
action_type: Optional[str] = None,
content_types: Optional[Sequence[str]] = None,
event_types: Optional[Sequence[str]] = None,
conditions: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
event_rule_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
func NewEventRule(ctx *Context, name string, args EventRuleArgs, opts ...ResourceOption) (*EventRule, error)
public EventRule(string name, EventRuleArgs args, CustomResourceOptions? opts = null)
public EventRule(String name, EventRuleArgs args)
public EventRule(String name, EventRuleArgs args, CustomResourceOptions options)
type: netbox:EventRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var eventRuleResource = new Netbox.EventRule("eventRuleResource", new()
{
ActionObjectId = 0,
ActionType = "string",
ContentTypes = new[]
{
"string",
},
EventTypes = new[]
{
"string",
},
Conditions = "string",
Description = "string",
Enabled = false,
EventRuleId = "string",
Name = "string",
Tags = new[]
{
"string",
},
});
example, err := netbox.NewEventRule(ctx, "eventRuleResource", &netbox.EventRuleArgs{
ActionObjectId: pulumi.Float64(0),
ActionType: pulumi.String("string"),
ContentTypes: pulumi.StringArray{
pulumi.String("string"),
},
EventTypes: pulumi.StringArray{
pulumi.String("string"),
},
Conditions: pulumi.String("string"),
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
EventRuleId: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var eventRuleResource = new EventRule("eventRuleResource", EventRuleArgs.builder()
.actionObjectId(0)
.actionType("string")
.contentTypes("string")
.eventTypes("string")
.conditions("string")
.description("string")
.enabled(false)
.eventRuleId("string")
.name("string")
.tags("string")
.build());
event_rule_resource = netbox.EventRule("eventRuleResource",
action_object_id=0,
action_type="string",
content_types=["string"],
event_types=["string"],
conditions="string",
description="string",
enabled=False,
event_rule_id="string",
name="string",
tags=["string"])
const eventRuleResource = new netbox.EventRule("eventRuleResource", {
actionObjectId: 0,
actionType: "string",
contentTypes: ["string"],
eventTypes: ["string"],
conditions: "string",
description: "string",
enabled: false,
eventRuleId: "string",
name: "string",
tags: ["string"],
});
type: netbox:EventRule
properties:
actionObjectId: 0
actionType: string
conditions: string
contentTypes:
- string
description: string
enabled: false
eventRuleId: string
eventTypes:
- string
name: string
tags:
- string
EventRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The EventRule resource accepts the following input properties:
- Action
Object doubleId - Action
Type string - Valid values are
webhook
. - Content
Types List<string> - Event
Types List<string> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - Conditions string
- Description string
- Enabled bool
- Defaults to
true
. - Event
Rule stringId - The ID of this resource.
- Name string
- List<string>
- Action
Object float64Id - Action
Type string - Valid values are
webhook
. - Content
Types []string - Event
Types []string - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - Conditions string
- Description string
- Enabled bool
- Defaults to
true
. - Event
Rule stringId - The ID of this resource.
- Name string
- []string
- action
Object DoubleId - action
Type String - Valid values are
webhook
. - content
Types List<String> - event
Types List<String> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - conditions String
- description String
- enabled Boolean
- Defaults to
true
. - event
Rule StringId - The ID of this resource.
- name String
- List<String>
- action
Object numberId - action
Type string - Valid values are
webhook
. - content
Types string[] - event
Types string[] - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - conditions string
- description string
- enabled boolean
- Defaults to
true
. - event
Rule stringId - The ID of this resource.
- name string
- string[]
- action_
object_ floatid - action_
type str - Valid values are
webhook
. - content_
types Sequence[str] - event_
types Sequence[str] - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - conditions str
- description str
- enabled bool
- Defaults to
true
. - event_
rule_ strid - The ID of this resource.
- name str
- Sequence[str]
- action
Object NumberId - action
Type String - Valid values are
webhook
. - content
Types List<String> - event
Types List<String> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - conditions String
- description String
- enabled Boolean
- Defaults to
true
. - event
Rule StringId - The ID of this resource.
- name String
- List<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the EventRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EventRule Resource
Get an existing EventRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: EventRuleState, opts?: CustomResourceOptions): EventRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
action_object_id: Optional[float] = None,
action_type: Optional[str] = None,
conditions: Optional[str] = None,
content_types: Optional[Sequence[str]] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
event_rule_id: Optional[str] = None,
event_types: Optional[Sequence[str]] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None) -> EventRule
func GetEventRule(ctx *Context, name string, id IDInput, state *EventRuleState, opts ...ResourceOption) (*EventRule, error)
public static EventRule Get(string name, Input<string> id, EventRuleState? state, CustomResourceOptions? opts = null)
public static EventRule get(String name, Output<String> id, EventRuleState state, CustomResourceOptions options)
resources: _: type: netbox:EventRule get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Action
Object doubleId - Action
Type string - Valid values are
webhook
. - Conditions string
- Content
Types List<string> - Description string
- Enabled bool
- Defaults to
true
. - Event
Rule stringId - The ID of this resource.
- Event
Types List<string> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - Name string
- List<string>
- Action
Object float64Id - Action
Type string - Valid values are
webhook
. - Conditions string
- Content
Types []string - Description string
- Enabled bool
- Defaults to
true
. - Event
Rule stringId - The ID of this resource.
- Event
Types []string - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - Name string
- []string
- action
Object DoubleId - action
Type String - Valid values are
webhook
. - conditions String
- content
Types List<String> - description String
- enabled Boolean
- Defaults to
true
. - event
Rule StringId - The ID of this resource.
- event
Types List<String> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - name String
- List<String>
- action
Object numberId - action
Type string - Valid values are
webhook
. - conditions string
- content
Types string[] - description string
- enabled boolean
- Defaults to
true
. - event
Rule stringId - The ID of this resource.
- event
Types string[] - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - name string
- string[]
- action_
object_ floatid - action_
type str - Valid values are
webhook
. - conditions str
- content_
types Sequence[str] - description str
- enabled bool
- Defaults to
true
. - event_
rule_ strid - The ID of this resource.
- event_
types Sequence[str] - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - name str
- Sequence[str]
- action
Object NumberId - action
Type String - Valid values are
webhook
. - conditions String
- content
Types List<String> - description String
- enabled Boolean
- Defaults to
true
. - event
Rule StringId - The ID of this resource.
- event
Types List<String> - The types of event which will trigger this rule. By default, valid values are
object_created
,oject_updated
,object_deleted
,job_started
,job_completed
,job_failed
andjob_errored
. - name String
- List<String>
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.