diff --git a/packages/nodes-base/credentials/Rapid7InsightVmApi.credentials.ts b/packages/nodes-base/credentials/Rapid7InsightVmApi.credentials.ts new file mode 100644 index 0000000000..d46675298b --- /dev/null +++ b/packages/nodes-base/credentials/Rapid7InsightVmApi.credentials.ts @@ -0,0 +1,61 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class Rapid7InsightVmApi implements ICredentialType { + name = 'rapid7InsightVmApi'; + + displayName = 'Rapid7 InsightVm API'; + + documentationUrl = 'Rapid7 InsightVm'; + + icon = { + light: 'file:icons/Rapid7InsightVm.svg', + dark: 'file:icons/Rapid7InsightVm.svg', + } as const; + + httpRequestNode = { + name: 'Rapid7 Insight Vm', + docsUrl: 'https://docs.rapid7.com/', + apiBaseUrlPlaceholder: 'https://insight.rapid7.com/', + }; + + properties: INodeProperties[] = [ + { + displayName: 'URL', + name: 'url', + required: true, + type: 'string', + default: '', + }, + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + 'x-api-key': '={{$credentials.apiKey}}', + Accept: 'application/json', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials.url}}'.replace(/\/$/, ''), + url: '/validate', + method: 'GET', + }, + }; +} diff --git a/packages/nodes-base/credentials/icons/Rapid7InsightVm.svg b/packages/nodes-base/credentials/icons/Rapid7InsightVm.svg new file mode 100644 index 0000000000..509f8287be --- /dev/null +++ b/packages/nodes-base/credentials/icons/Rapid7InsightVm.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index d7c23ff3e0..f04cea20b4 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -286,6 +286,7 @@ "dist/credentials/QuickBooksOAuth2Api.credentials.js", "dist/credentials/RabbitMQ.credentials.js", "dist/credentials/RaindropOAuth2Api.credentials.js", + "dist/credentials/Rapid7InsightVmApi.credentials.js", "dist/credentials/RecordedFutureApi.credentials.js", "dist/credentials/RedditOAuth2Api.credentials.js", "dist/credentials/Redis.credentials.js",