first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import type { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '../../../../../utils/utilities';
|
||||
import { searchJobRLC } from '../../helpers/descriptions';
|
||||
import { formatFeed } from '../../helpers/utils';
|
||||
import { splunkApiJsonRequest, splunkApiRequest } from '../../transport';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
searchJobRLC,
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name of the report',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['create'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
i: number,
|
||||
): Promise<IDataObject | IDataObject[]> {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const searchJobId = this.getNodeParameter('searchJobId', i, '', { extractValue: true }) as string;
|
||||
const endpoint = `/services/search/jobs/${searchJobId}`;
|
||||
|
||||
const searchJob = ((await splunkApiJsonRequest.call(this, 'GET', endpoint)) ?? [])[0];
|
||||
|
||||
const body: IDataObject = {
|
||||
name,
|
||||
search: searchJob.search,
|
||||
alert_type: 'always',
|
||||
'dispatch.earliest_time': searchJob.earliestTime,
|
||||
'dispatch.latest_time': searchJob.latestTime,
|
||||
is_scheduled: searchJob.isScheduled,
|
||||
cron_schedule: searchJob.cronSchedule,
|
||||
};
|
||||
|
||||
const returnData = await splunkApiRequest
|
||||
.call(this, 'POST', '/services/saved/searches', body)
|
||||
.then(formatFeed);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '../../../../../utils/utilities';
|
||||
import { reportRLC } from '../../helpers/descriptions';
|
||||
import { splunkApiRequest } from '../../transport';
|
||||
|
||||
const properties: INodeProperties[] = [reportRLC];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['deleteReport'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
i: number,
|
||||
): Promise<IDataObject | IDataObject[]> {
|
||||
// https://docs.splunk.com/Documentation/Splunk/8.2.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D
|
||||
|
||||
const reportId = this.getNodeParameter('reportId', i, '', { extractValue: true }) as string;
|
||||
const endpoint = `/services/saved/searches/${reportId}`;
|
||||
|
||||
await splunkApiRequest.call(this, 'DELETE', endpoint);
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '../../../../../utils/utilities';
|
||||
import { reportRLC } from '../../helpers/descriptions';
|
||||
import { splunkApiJsonRequest } from '../../transport';
|
||||
|
||||
const properties: INodeProperties[] = [reportRLC];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
i: number,
|
||||
): Promise<IDataObject | IDataObject[]> {
|
||||
// https://docs.splunk.com/Documentation/Splunk/8.2.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D
|
||||
|
||||
const reportId = this.getNodeParameter('reportId', i, '', { extractValue: true }) as string;
|
||||
const endpoint = `/services/saved/searches/${reportId}`;
|
||||
|
||||
const returnData = await splunkApiJsonRequest.call(this, 'GET', endpoint);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import type { INodeProperties, IExecuteFunctions, IDataObject } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '../../../../../utils/utilities';
|
||||
import { populate, setReturnAllOrLimit } from '../../helpers/utils';
|
||||
import { splunkApiJsonRequest } from '../../transport';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
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,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
i: number,
|
||||
): Promise<IDataObject | IDataObject[]> {
|
||||
// https://docs.splunk.com/Documentation/Splunk/8.2.2/RESTREF/RESTsearch#saved.2Fsearches
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
|
||||
populate(options, qs);
|
||||
setReturnAllOrLimit.call(this, qs);
|
||||
|
||||
const endpoint = '/services/saved/searches';
|
||||
const returnData = await splunkApiJsonRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as create from './create.operation';
|
||||
import * as deleteReport from './deleteReport.operation';
|
||||
import * as get from './get.operation';
|
||||
import * as getAll from './getAll.operation';
|
||||
|
||||
export { create, deleteReport, get, getAll };
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create From Search',
|
||||
value: 'create',
|
||||
description: 'Create a search report from a search job',
|
||||
action: 'Create a search report',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'deleteReport',
|
||||
description: 'Delete a search report',
|
||||
action: 'Delete a search report',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a search report',
|
||||
action: 'Get a search report',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many search reports',
|
||||
action: 'Get many search reports',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
|
||||
...create.description,
|
||||
...deleteReport.description,
|
||||
...get.description,
|
||||
...getAll.description,
|
||||
];
|
||||
Reference in New Issue
Block a user