Skip to content

Commit

Permalink
feat: Added schemas for our source plugins
Browse files Browse the repository at this point in the history
This is some of the work needed for the UI to generate source
args for Fanout.
  • Loading branch information
mkanoor committed Feb 19, 2024
1 parent fbf92e8 commit 21a8135
Show file tree
Hide file tree
Showing 14 changed files with 576 additions and 16 deletions.
14 changes: 0 additions & 14 deletions extensions/eda/plugins/event_source/range_output_schema.json

This file was deleted.

40 changes: 40 additions & 0 deletions extensions/eda/plugins/event_source/schemas/alertmanager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/alertmanager.json",
"title": "Alert manager Source Plugin",
"description": "A plugin for Alert Manager",
"type": "object",
"properties": {
"host": {
"description": "The webserver hostname to listen to. Set to 0.0.0.0 to listen on all interfaces. Defaults to 127.0.0.1",
"type": "string",
"default": "127.0.0.1"
},
"port": {
"description": "The TCP port to listen to. Defaults to 5000",
"type": "integer",
"default": 5000
},
"data_alerts_path": {
"description": "The json path to find alert data. Default to alerts Use empty string to treat the whole payload data as one alert.",
"type": "string",
"default": "alerts"
},
"data_host_path": {
"description": "The json path inside the alert data to find alerting host. Use empty string if there is no need to find host. Default to labels.instance.",
"type": "string",
"default": "labels.instance"
},
"data_path_separator": {
"description": "The separator to interpret data_host_path and data_alerts_path. Default is . (dot or period)",
"type": "string",
"default": "."
},
"skip_original_data": {
"description": "If enabled only the alert data will be put in queue, else put sequentially both the received original data and each parsed alert item to the queue.",
"type": "boolean",
"default": "."
}
},
"required": ["host","port"]
}
63 changes: 63 additions & 0 deletions extensions/eda/plugins/event_source/schemas/aws_cloudtrail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/aws_cloudtrail.json",
"title": "Source Plugin for AWS CloudTrail",
"description": "An ansible-rulebook event source module for getting events from an AWS CloudTrail",
"type": "object",
"properties": {
"access_key": {
"description": "AWS access key ID",
"type": "string",
"format": "password"
},
"secret_key": {
"description": "AWS secret key",
"type": "string",
"format": "password"
},
"session_token": {
"description": "STS session token for use with temporary credentials",
"type": "string",
"format": "password"
},
"endpoint_url": {
"description": "URL to connect to instead of the default AWS endpoints",
"type": "string"
},
"region": {
"description": "AWS region to use",
"type": "string"
},
"delay_seconds": {
"description": "The number of seconds to wait between polling",
"type": "integer",
"default": 10
},
"lookup_attributes": {
"description": "The number of seconds to wait between polling",
"type": "array",
"items": { "$ref": "#/$defs/lookup" }
},
"event_category": {
"description": "Event Category",
"type": "string"
}
},
"$defs": {
"lookup": {
"type": "object",
"required": [ "AttributeKey", "AttributeValue"],
"properties": {
"AttributeKey": {
"type": "string",
"description": "Specifies an attribute on which to filter the events"
},
"AttributeValue": {
"type": "string",
"description": "Specifies a value for the specified AttributeKey"
}
}
}
},
"required": ["lookup_attributes","event_category"]
}
49 changes: 49 additions & 0 deletions extensions/eda/plugins/event_source/schemas/aws_sqs_queue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/aws_sqs_queue.json",
"title": "Source Plugin for AWS SQS Queue",
"description": "An ansible-rulebook event source plugin for receiving events via an AWS SQS queue.",
"type": "object",
"properties": {
"access_key": {
"description": "AWS access key ID",
"type": "string",
"title": "Access Key",
"format": "password"
},
"secret_key": {
"description": "AWS secret key",
"type": "string",
"title": "Secret Key",
"format": "password"
},
"session_token": {
"description": "STS session token for use with temporary credentials",
"title": "Session Token",
"type": "string",
"format": "password"
},
"endpoint_url": {
"description": "URL to connect to instead of the default AWS endpoints",
"type": "string",
"title": "End Point URL"
},
"region": {
"description": "AWS region to use",
"type": "string",
"title": "Region"
},
"name": {
"description": "The name of the queue",
"type": "string",
"title": "Queue Name"
},
"delay_seconds": {
"description": "The SQS long polling duration. Set to 0 to disable",
"title": "Polling interval",
"type": "integer",
"default": 2
}
},
"required": ["name"]
}
26 changes: 26 additions & 0 deletions extensions/eda/plugins/event_source/schemas/azure_service_bus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/azure_service_bus.json",
"title": "Azure Service Bus plugin for EDA",
"description": "An ansible-rulebook event source module for receiving events from an Azure service bus",
"type": "object",
"properties": {
"conn_str": {
"description": "The connection string",
"type": "string",
"title": "Connection String"
},
"queue_name": {
"description": "The queue name",
"type": "string",
"title": "Queue Name"
},
"logging_enable": {
"description": "Turn on logging",
"type": "boolean",
"default": true,
"title": "Enable Logging"
}
},
"required": ["conn_str","queue_name"]
}
17 changes: 17 additions & 0 deletions extensions/eda/plugins/event_source/schemas/file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/file.json",
"title": "YAML File monitor plugin for EDA",
"description": "An ansible-rulebook event source plugin for loading facts from YAML files initially and when the file changes.",
"type": "object",
"properties": {
"files": {
"description": "An array of YAML files to monitor",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["files"]
}
28 changes: 28 additions & 0 deletions extensions/eda/plugins/event_source/schemas/file_watch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/file_watch.json",
"title": "File Watcher Source plugin",
"description": "An ansible-rulebook event source plugin for watching file system changes.",
"type": "object",
"properties": {
"path": {
"description": "The directory to watch for changes.",
"type": "string",
"title": "Path"
},
"recursive": {
"description": "Recursively watch the path if true",
"type": "boolean",
"title": "Recursive"
},
"ignore_regexes": {
"description": "A list of regular expressions to ignore changes",
"title": "Ignore Regexes",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["path","recursive"]
}
105 changes: 105 additions & 0 deletions extensions/eda/plugins/event_source/schemas/generic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/generic.json",
"title": "A generic event generator plugin",
"description": "A generic source plugin that allows you to insert custom data.",
"type": "object",
"properties": {
"payload": {
"description": "An array of event payloads",
"title": "Payload",
"type": "array",
"items": { "$ref": "#/$defs/generic_payload" }
},
"randomize": {
"description": "Randomize the events in the payload",
"title": "Randomize",
"type": "boolean",
"default": false
},
"display": {
"description": "Display the event data in stdout",
"title": "Display",
"type": "boolean",
"default": false
},
"timestamp": {
"title": "Time Stamp",
"description": "Add an event timestamp, to every event",
"type": "boolean",
"default": false
},
"time_format": {
"title": "Time Format",
"description": "The time format of event timestamp",
"enum": ["local", "epoch","iso8601"],
"default": "local"
},
"create_index": {
"title": "Index Key",
"description": "The index to create for each event starts at 0",
"type": "string"
},
"startup_delay": {
"title": "Startup Delay",
"description": "Number of seconds to wait before injecting events",
"type": "number",
"default": 0
},
"event_delay": {
"title": "Event Delay",
"description": "Number of seconds to wait before injecting the next event from the payload.",
"type": "number",
"default": 0
},
"repeat_delay": {
"title": "Repeat Delay",
"description": "Number of seconds to wait before injecting a repeated event from the payload",
"type": "number",
"default": 0
},
"loop_delay": {
"title": "Loop Delay",
"description": "Number of seconds to wait before inserting the next set of events.",
"type": "number",
"default": 0
},
"shutdown_after": {
"title": "Shutdown After",
"description": "Number of seconds to wait before shutting down the plugin",
"type": "number",
"default": 0
},
"loop_count": {
"title": "Loop Count",
"description": "Number of times the set of events in the playload should be repeated, -1 loops for ever",
"type": "integer",
"default": 1
},
"repeat_count": {
"title": "Repeat Count",
"description": "Number of times each individual event in the playload should be repeated",
"type": "integer",
"default": 1
},
"blob_size": {
"title": "Blob Size",
"description": "An arbitray blob of blob_size bytes to be inserted into every event payload.",
"type": "integer",
"default": 0
},
"final_payload": {
"title": "Final Payload",
"description": "After all the events have been sent we send the optional final payload which can be used to trigger a shutdown of the rulebook, especially when we are using rulebooks to forward messages to other running rulebooks.",
"$ref": "#/$defs/generic_payload"
}

},
"$defs": {
"generic_payload": {
"type": "object",
"additional_properties": "true"
}
},
"required": ["payload"]
}
15 changes: 15 additions & 0 deletions extensions/eda/plugins/event_source/schemas/journald.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://redhat.com/ansible_events/sources/journald.json",
"title": "A journald source plugin",
"description": "An ansible-events event source plugin that tails systemd journald logs.",
"type": "object",
"properties": {
"match": {
"description": "return messages that matches this field, see see https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html ALL matches all events",
"type": "string",
"examples":["PRIORITY=6","_EXE=/usr/bin/sudo","ALL"]
}
},
"required": ["match"]
}
Loading

0 comments on commit 21a8135

Please sign in to comment.