Skip to content

Commit

Permalink
Add schemas for our source plugins (#198)
Browse files Browse the repository at this point in the history
* feat: Added schemas for our source plugins

This is some of the work needed for the UI to generate source
args for Fanout.

* Fix spelling

---------

Co-authored-by: Mauricio Magnani Jr <[email protected]>
Co-authored-by: Sorin Sbarnea <[email protected]>
Co-authored-by: Sorin Sbarnea <[email protected]>
  • Loading branch information
4 people authored Aug 16, 2024
1 parent 4e21dd2 commit 6fde899
Show file tree
Hide file tree
Showing 15 changed files with 677 additions and 28 deletions.
14 changes: 0 additions & 14 deletions extensions/eda/plugins/event_source/range_input_schema.json

This file was deleted.

14 changes: 0 additions & 14 deletions extensions/eda/plugins/event_source/range_output_schema.json

This file was deleted.

49 changes: 49 additions & 0 deletions extensions/eda/plugins/event_source/schemas/alertmanager.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/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",
"title": "Host",
"type": "string",
"default": "127.0.0.1"
},
"port": {
"description": "The TCP port to listen to. Defaults to 5000",
"title": "Port",
"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.",
"title": "Alerts Path",
"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.",
"title": "Host Path",
"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)",
"title": "Path Separator",
"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.",
"title": "Skip Original Data",
"type": "boolean",
"default": false
}
},
"required": [
"host",
"port"
]
}
81 changes: 81 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,81 @@
{
"$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",
"title": "Access Key",
"type": "string",
"format": "password"
},
"secret_key": {
"description": "AWS secret key",
"title": "Secret Key",
"type": "string",
"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",
"title": "Endpoint URL",
"type": "string"
},
"region": {
"description": "AWS region to use",
"title": "Region",
"type": "string"
},
"delay_seconds": {
"description": "The number of seconds to wait between polling",
"title": "Poll Delay",
"type": "integer",
"default": 10
},
"lookup_attributes": {
"description": "Lookup attributes",
"title": "Filters",
"type": "array",
"items": {
"$ref": "#/$defs/lookup"
}
},
"event_category": {
"description": "Event Category",
"title": "Event Category",
"type": "string"
}
},
"$defs": {
"lookup": {
"type": "object",
"required": [
"AttributeKey",
"AttributeValue"
],
"properties": {
"AttributeKey": {
"type": "string",
"title": "Key",
"description": "Specifies an attribute on which to filter the events"
},
"AttributeValue": {
"type": "string",
"title": "Value",
"description": "Specifies a value for the specified AttributeKey"
}
}
}
},
"required": [
"lookup_attributes",
"event_category"
]
}
51 changes: 51 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,51 @@
{
"$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"
]
}
29 changes: 29 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,29 @@
{
"$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"
]
}
20 changes: 20 additions & 0 deletions extensions/eda/plugins/event_source/schemas/file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$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",
"title": "YAML Files",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"files"
]
}
31 changes: 31 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,31 @@
{
"$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"
]
}
Loading

0 comments on commit 6fde899

Please sign in to comment.