From 2bcfe67838706118736f48ccb28ce086c133aa7b Mon Sep 17 00:00:00 2001 From: Stamsy Date: Mon, 2 Dec 2024 16:25:42 +0200 Subject: [PATCH] add solarwinds ipam credentials --- .../SolarWindsIpamApi.credentials.ts | 68 ++++++++++++++++++ .../credentials/icons/SolarWindsIpam.svg | 71 +++++++++++++++++++ packages/nodes-base/package.json | 1 + 3 files changed, 140 insertions(+) create mode 100644 packages/nodes-base/credentials/SolarWindsIpamApi.credentials.ts create mode 100644 packages/nodes-base/credentials/icons/SolarWindsIpam.svg diff --git a/packages/nodes-base/credentials/SolarWindsIpamApi.credentials.ts b/packages/nodes-base/credentials/SolarWindsIpamApi.credentials.ts new file mode 100644 index 0000000000..987890023d --- /dev/null +++ b/packages/nodes-base/credentials/SolarWindsIpamApi.credentials.ts @@ -0,0 +1,68 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class SolarWindsIpamApi implements ICredentialType { + name = 'solarWindsIpamApi'; + + displayName = 'SolarWinds IPAM'; + + documentationUrl = 'solarwindsipam'; + + icon = { + light: 'file:icons/SolarWindsIpam.svg', + dark: 'file:icons/SolarWindsIpam.svg', + } as const; + + properties: INodeProperties[] = [ + { + displayName: 'Instance URL', + name: 'url', + type: 'string', + default: '', + required: true, + description: + 'Base URL of your SolarWinds IPAM instance (e.g., https://your-instance.solarwinds.com).', + }, + { + displayName: 'API Token', + name: 'apiToken', + type: 'string', + default: '', + required: true, + typeOptions: { password: true }, + description: 'Your API token for authenticating requests to SolarWinds IPAM.', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + Authorization: '=Bearer {{$credentials.apiToken}}', + 'Content-Type': 'application/json', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials.url}}'.replace(/\/$/, ''), + url: '', //TODO + method: 'GET', + }, + rules: [ + { + type: 'responseSuccessBody', + properties: { + key: 'error', + value: 'invalid_auth', + message: 'Invalid access token', + }, + }, + ], + }; +} diff --git a/packages/nodes-base/credentials/icons/SolarWindsIpam.svg b/packages/nodes-base/credentials/icons/SolarWindsIpam.svg new file mode 100644 index 0000000000..814afbdb7c --- /dev/null +++ b/packages/nodes-base/credentials/icons/SolarWindsIpam.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index d195b512d0..2ae2d5678c 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -319,6 +319,7 @@ "dist/credentials/Sms77Api.credentials.js", "dist/credentials/Smtp.credentials.js", "dist/credentials/Snowflake.credentials.js", + "dist/credentials/SolarWindsIpamApi.credentials.js", "dist/credentials/SplunkApi.credentials.js", "dist/credentials/SpontitApi.credentials.js", "dist/credentials/SpotifyOAuth2Api.credentials.js",