2024-11-05 09:07:01 -08:00
|
|
|
import type {
|
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class Rapid7InsightVmApi implements ICredentialType {
|
|
|
|
name = 'rapid7InsightVmApi';
|
|
|
|
|
2024-11-06 04:12:49 -08:00
|
|
|
displayName = 'Rapid7 InsightVM API';
|
2024-11-05 09:07:01 -08:00
|
|
|
|
2024-11-06 04:12:49 -08:00
|
|
|
documentationUrl = 'rapid7insightvm';
|
2024-11-05 09:07:01 -08:00
|
|
|
|
|
|
|
icon = {
|
|
|
|
light: 'file:icons/Rapid7InsightVm.svg',
|
|
|
|
dark: 'file:icons/Rapid7InsightVm.svg',
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
httpRequestNode = {
|
2024-11-06 04:12:49 -08:00
|
|
|
name: 'Rapid7 InsightVM',
|
2024-11-05 09:07:01 -08:00
|
|
|
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',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|