Add Splunk node (#2180)

*  Create Splunk node

* 🔨 Move rejectUnauthorized to credentials

* 🔨 Remove trailing slash

* 🔨 Clarify 401 error

* 🔥 Remove unused params

* 🔥 Remove unused logic

*  Guard against code missing

* 🔨 Refactor filter

* 🔥 Remove params with no effect

* 🔥 Remove superfluous description

* 🔥 Remove params for unimplemented resource

* 🔥 Remove param with no effect

* 🐛 Fix multiple roles in user create and upate

* 🔥 Remove logging

*  Simplify ID handling

* 👕 Fix lint

*  Add cred test

* 🎨 Format import

* ✏️ Apply Product feedback

* 🐛 Make axiox errors compatible

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Iván Ovejero
2021-09-28 20:50:15 +02:00
committed by GitHub
parent 62d1d69710
commit db134f0abe
13 changed files with 1910 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const firedAlertOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'firedAlert',
],
},
},
options: [
{
name: 'Get Report',
value: 'getReport',
description: 'Retrieve a fired alerts report',
},
],
default: 'getReport',
},
];

View File

@@ -0,0 +1,159 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const searchConfigurationOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
},
},
options: [
{
name: 'Delete',
value: 'delete',
description: 'Delete a search configuration',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a search configuration',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all search configurations',
},
],
default: 'delete',
},
];
export const searchConfigurationFields: INodeProperties[] = [
// ----------------------------------------
// searchConfiguration: delete
// ----------------------------------------
{
displayName: 'Search Configuration ID',
name: 'searchConfigurationId',
description: 'ID of the search configuration to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// searchConfiguration: get
// ----------------------------------------
{
displayName: 'Search Configuration ID',
name: 'searchConfigurationId',
description: 'ID of the search configuration to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// searchConfiguration: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'searchConfiguration',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Add Orphan Field',
name: 'add_orphan_field',
description: 'Whether to include a boolean value for each saved search to show whether the search is orphaned, meaning that it has no valid owner',
type: 'boolean',
default: false,
},
{
displayName: 'List Default Actions',
name: 'listDefaultActionArgs',
type: 'boolean',
default: false,
},
],
},
];

View File

@@ -0,0 +1,418 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const searchJobOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'searchJob',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a search job',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a search job',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a search job',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all search jobs',
},
],
default: 'create',
},
];
export const searchJobFields: INodeProperties[] = [
// ----------------------------------------
// searchJob: create
// ----------------------------------------
{
displayName: 'Query',
name: 'search',
description: 'Search language string to execute, in Splunk\'s <a href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/WhatsInThisManual">Search Processing Language</a>',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Ad Hoc Search Level',
name: 'adhoc_search_level',
type: 'options',
default: 'verbose',
options: [
{
name: 'Fast',
value: 'fast',
},
{
name: 'Smart',
value: 'smart',
},
{
name: 'Verbose',
value: 'verbose',
},
],
},
{
displayName: 'Auto-Cancel After (Seconds)',
name: 'auto_cancel',
type: 'number',
default: 0,
description: 'Seconds after which the search job automatically cancels',
},
{
displayName: 'Auto-Finalize After (Num Events)',
name: 'auto_finalize_ec',
type: 'number',
default: 0,
description: 'Auto-finalize the search after at least this many events are processed',
},
{
displayName: 'Auto Pause After (Seconds)',
name: 'auto_pause',
type: 'number',
default: 0,
description: 'Seconds of inactivity after which the search job automatically pauses',
},
{
displayName: 'Earliest Index',
name: 'index_earliest',
type: 'dateTime',
default: '',
description: 'The earliest index time for the search (inclusive)',
},
{
displayName: 'Earliest Time',
name: 'earliest_time',
type: 'dateTime',
default: '',
description: 'The earliest cut-off for the search (inclusive)',
},
{
displayName: 'Exec Mode',
name: 'exec_mode',
type: 'options',
default: 'blocking',
options: [
{
name: 'Blocking',
value: 'blocking',
},
{
name: 'Normal',
value: 'normal',
},
{
name: 'One Shot',
value: 'oneshot',
},
],
},
{
displayName: 'Indexed Real Time Offset',
name: 'indexedRealtimeOffset',
type: 'number',
default: 0,
description: 'Seconds of disk sync delay for indexed real-time search',
},
{
displayName: 'Latest Index',
name: 'index_latest',
type: 'dateTime',
default: '',
description: 'The latest index time for the search (inclusive)',
},
{
displayName: 'Latest Time',
name: 'latest_time',
type: 'dateTime',
default: '',
description: 'The latest cut-off for the search (inclusive)',
},
{
displayName: 'Max Time',
name: 'max_time',
type: 'number',
default: 0,
description: 'Number of seconds to run this search before finalizing. Enter <code>0</code> to never finalize.',
},
{
displayName: 'Namespace',
name: 'namespace',
type: 'string',
default: '',
description: 'Application namespace in which to restrict searches',
},
{
displayName: 'Reduce Frequency',
name: 'reduce_freq',
type: 'number',
default: 0,
description: 'How frequently to run the MapReduce reduce phase on accumulated map values',
},
{
displayName: 'Remote Server List',
name: 'remote_server_list',
type: 'string',
default: '',
description: 'Comma-separated list of (possibly wildcarded) servers from which raw events should be pulled. This same server list is to be used in subsearches.',
},
{
displayName: 'Reuse Limit (Seconds)',
name: 'reuse_max_seconds_ago',
type: 'number',
default: 0,
description: 'Number of seconds ago to check when an identical search is started and return the job\s search ID instead of starting a new job',
},
{
displayName: 'Required Field',
name: 'rf',
type: 'string',
default: '',
description: 'Name of a required field to add to the search. Even if not referenced or used directly by the search, a required field is still included in events and summary endpoints.',
},
{
displayName: 'Search Mode',
name: 'search_mode',
type: 'options',
default: 'normal',
options: [
{
name: 'Normal',
value: 'normal',
},
{
name: 'Real Time',
value: 'realtime',
},
],
},
{
displayName: 'Status Buckets',
name: 'status_buckets',
type: 'number',
default: 0,
description: 'The most status buckets to generate. Set <code>0</code> generate no timeline information.',
},
{
displayName: 'Timeout',
name: 'timeout',
type: 'number',
default: 86400,
description: 'Number of seconds to keep this search after processing has stopped',
},
{
displayName: 'Workload Pool',
name: 'workload_pool',
type: 'string',
default: '',
description: 'New workload pool where the existing running search should be placed',
},
],
},
// ----------------------------------------
// searchJob: delete
// ----------------------------------------
{
displayName: 'Search ID',
name: 'searchJobId',
description: 'ID of the search job to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// searchJob: get
// ----------------------------------------
{
displayName: 'Search ID',
name: 'searchJobId',
description: 'ID of the search job to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// searchJob: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'searchJob',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Sort Direction',
name: 'sort_dir',
type: 'options',
options: [
{
name: 'Ascending',
value: 'asc',
},
{
name: 'Descending',
value: 'desc',
},
],
default: 'asc',
},
{
displayName: 'Sort Key',
name: 'sort_key',
description: 'Key name to use for sorting',
type: 'string',
default: '',
},
{
displayName: 'Sort Mode',
name: 'sort_mode',
type: 'options',
options: [
{
name: 'Automatic',
value: 'auto',
description: 'If all field values are numeric, collate numerically. Otherwise, collate alphabetically.',
},
{
name: 'Alphabetic',
value: 'alpha',
description: 'Collate alphabetically, case-insensitive',
},
{
name: 'Alphabetic and Case-Sensitive',
value: 'alpha_case',
description: 'Collate alphabetically, case-sensitive',
},
{
name: 'Numeric',
value: 'num',
description: 'Collate numerically',
},
],
default: 'auto',
},
],
},
];

View File

@@ -0,0 +1,166 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const searchResultOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'searchResult',
],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all search results for a search job',
},
],
default: 'getAll',
},
];
export const searchResultFields: INodeProperties[] = [
// ----------------------------------------
// searchResult: getAll
// ----------------------------------------
{
displayName: 'Search ID',
name: 'searchJobId',
description: 'ID of the search whose results to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'searchResult',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'searchResult',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'searchResult',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: [
'searchResult',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Key-Value Match',
name: 'keyValueMatch',
description: 'Key-value pair to match against. Example: if "Key" is set to <code>user</code> and "Field" is set to <code>john</code>, only the results where <code>user</code> is <code>john</code> will be returned. ',
type: 'fixedCollection',
default: {},
placeholder: 'Add Key-Value Pair',
options: [
{
displayName: 'Key-Value Pair',
name: 'keyValuePair',
values: [
{
displayName: 'Key',
name: 'key',
description: 'Key to match against',
type: 'string',
default: '',
},
{
displayName: 'Value',
name: 'value',
description: 'value to match against',
type: 'string',
default: '',
},
],
},
],
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: [
'searchResult',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Add Summary to Metadata',
name: 'add_summary_to_metadata',
description: 'Whether to include field summary statistics in the response',
type: 'boolean',
default: false,
},
],
},
];

View File

@@ -0,0 +1,300 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const userOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create an user',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an user',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve an user',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all users',
},
{
name: 'Update',
value: 'update',
description: 'Update an user',
},
],
default: 'create',
},
];
export const userFields: INodeProperties[] = [
// ----------------------------------------
// user: create
// ----------------------------------------
{
displayName: 'Name',
name: 'name',
description: 'Login name of the user',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Roles',
name: 'roles',
type: 'multiOptions',
description: 'Comma-separated list of roles to assign to the user',
required: true,
default: [],
typeOptions: {
loadOptionsMethod: 'getRoles',
},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Password',
name: 'password',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
},
{
displayName: 'Full Name',
name: 'realname',
type: 'string',
default: '',
description: 'Full name of the user',
},
],
},
// ----------------------------------------
// user: delete
// ----------------------------------------
{
displayName: 'User ID',
name: 'userId',
description: 'ID of the user to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------------
// user: get
// ----------------------------------------
{
displayName: 'User ID',
name: 'userId',
description: 'ID of the user to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'get',
],
},
},
},
// ----------------------------------------
// user: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
},
// ----------------------------------------
// user: update
// ----------------------------------------
{
displayName: 'User ID',
name: 'userId',
description: 'ID of the user to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
},
{
displayName: 'Full Name',
name: 'realname',
type: 'string',
default: '',
description: 'Full name of the user',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
default: '',
},
{
displayName: 'Roles',
name: 'roles',
type: 'multiOptions',
description: 'Comma-separated list of roles to assign to the user',
required: true,
default: [],
typeOptions: {
loadOptionsMethod: 'getRoles',
},
},
],
},
];

View File

@@ -0,0 +1,5 @@
export * from './FiredAlertDescription';
export * from './SearchConfigurationDescription';
export * from './SearchJobDescription';
export * from './SearchResultDescription';
export * from './UserDescription';