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,61 @@
|
||||
import type { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmCreateDescription: RmmProperties = [
|
||||
{
|
||||
displayName: 'Asset ID',
|
||||
name: 'assetId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Resolved',
|
||||
name: 'resolved',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function addAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const customerId = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const assetId = this.getNodeParameter('assetId', index) as IDataObject;
|
||||
const description = this.getNodeParameter('description', index) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', index);
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
const endpoint = 'rmm_alerts';
|
||||
let body = {} as IDataObject;
|
||||
|
||||
if (additionalFields) {
|
||||
body = additionalFields;
|
||||
}
|
||||
|
||||
body.customer_id = customerId;
|
||||
body.asset_id = assetId;
|
||||
body.description = description;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData.alert as IDataObject);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { rmmCreateDescription as description } from './description';
|
||||
import { addAlert as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmDeleteDescription: RmmProperties = [
|
||||
{
|
||||
displayName: 'RMM Alert ID',
|
||||
name: 'alertId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Delete the RMM alert by ID',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function deleteAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'DELETE';
|
||||
const endpoint = `rmm_alerts/${id}`;
|
||||
const body = {} as IDataObject;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { rmmDeleteDescription as description } from './description';
|
||||
import { deleteAlert as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmGetDescription: RmmProperties = [
|
||||
{
|
||||
displayName: 'RMM Alert ID',
|
||||
name: 'alertId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Get specific RMM alert by ID',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function getAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'GET';
|
||||
const endpoint = `rmm_alerts/${id}`;
|
||||
const body = {} as IDataObject;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData.rmm_alert as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { rmmGetDescription as description } from './description';
|
||||
import { getAlert as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,70 @@
|
||||
import type { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmGetAllDescription: RmmProperties = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
noDataExpression: true,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Active',
|
||||
value: 'active',
|
||||
},
|
||||
{
|
||||
name: 'All',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
name: 'Resolved',
|
||||
value: 'resolved',
|
||||
},
|
||||
],
|
||||
default: 'all',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest, apiRequestAllItems } from '../../../transport';
|
||||
|
||||
export async function getAll(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index);
|
||||
const filters = this.getNodeParameter('filters', index);
|
||||
|
||||
let qs = {} as IDataObject;
|
||||
const requestMethod = 'GET';
|
||||
const endpoint = 'rmm_alerts';
|
||||
const body = {} as IDataObject;
|
||||
|
||||
if (filters) {
|
||||
qs = filters;
|
||||
}
|
||||
|
||||
if (qs.status === undefined) {
|
||||
qs.status = 'all';
|
||||
}
|
||||
|
||||
if (!returnAll) {
|
||||
qs.per_page = this.getNodeParameter('limit', index);
|
||||
}
|
||||
|
||||
let responseData;
|
||||
if (returnAll) {
|
||||
responseData = await apiRequestAllItems.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData);
|
||||
} else {
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData.rmm_alerts as IDataObject[]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { rmmGetAllDescription as description } from './description';
|
||||
import { getAll as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as create from './create';
|
||||
import * as del from './del';
|
||||
import * as get from './get';
|
||||
import * as getAll from './getAll';
|
||||
import * as mute from './mute';
|
||||
|
||||
export { getAll, get, mute, del as delete, create };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create new RMM Alert',
|
||||
action: 'Create an RMM alert',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete RMM Alert',
|
||||
action: 'Delete an RMM alert',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve RMM Alert',
|
||||
action: 'Get an RMM alert',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many RMM Alerts',
|
||||
action: 'Get many RMM alerts',
|
||||
},
|
||||
{
|
||||
name: 'Mute',
|
||||
value: 'mute',
|
||||
description: 'Mute RMM Alert',
|
||||
action: 'Mute an RMM alert',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...getAll.description,
|
||||
...get.description,
|
||||
...create.description,
|
||||
...del.description,
|
||||
...mute.description,
|
||||
] as INodeProperties[];
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmMuteDescription: RmmProperties = [
|
||||
{
|
||||
displayName: 'RMM Alert ID',
|
||||
name: 'alertId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['mute'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Mute the RMM alert by ID',
|
||||
},
|
||||
{
|
||||
displayName: 'Mute Period',
|
||||
name: 'muteFor',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['rmm'],
|
||||
operation: ['mute'],
|
||||
},
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
||||
options: [
|
||||
{
|
||||
name: '1 Hour',
|
||||
value: '1-hour',
|
||||
},
|
||||
{
|
||||
name: '1 Day',
|
||||
value: '1-day',
|
||||
},
|
||||
{
|
||||
name: '2 Days',
|
||||
value: '2-days',
|
||||
},
|
||||
{
|
||||
name: '1 Week',
|
||||
value: '1-week',
|
||||
},
|
||||
{
|
||||
name: '2 Weeks',
|
||||
value: '2-weeks',
|
||||
},
|
||||
{
|
||||
name: '1 Month',
|
||||
value: '1-month',
|
||||
},
|
||||
{
|
||||
name: 'Forever',
|
||||
value: 'forever',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'Length of time to mute alert for',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function muteAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
const mute = this.getNodeParameter('muteFor', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
const endpoint = `rmm_alerts/${id}/mute`;
|
||||
const body = {} as IDataObject;
|
||||
|
||||
body.id = id;
|
||||
body.mute_for = mute;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { rmmMuteDescription as description } from './description';
|
||||
import { muteAlert as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
Reference in New Issue
Block a user