2024-07-04 06:07:17 -07:00
|
|
|
import type {
|
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
2021-09-28 11:50:15 -07:00
|
|
|
|
|
|
|
export class SplunkApi implements ICredentialType {
|
|
|
|
name = 'splunkApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-28 11:50:15 -07:00
|
|
|
displayName = 'Splunk API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-28 11:50:15 -07:00
|
|
|
documentationUrl = 'splunk';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-28 11:50:15 -07:00
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Auth Token',
|
|
|
|
name: 'authToken',
|
|
|
|
type: 'string',
|
2023-08-01 04:08:25 -07:00
|
|
|
typeOptions: { password: true },
|
2021-09-28 11:50:15 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Base URL',
|
|
|
|
name: 'baseUrl',
|
|
|
|
type: 'string',
|
|
|
|
description: 'Protocol, domain and port',
|
|
|
|
placeholder: 'e.g. https://localhost:8089',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Allow Self-Signed Certificates',
|
|
|
|
name: 'allowUnauthorizedCerts',
|
|
|
|
type: 'boolean',
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether to connect even if SSL certificate validation is not possible',
|
2021-09-28 11:50:15 -07:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
];
|
2024-07-04 06:07:17 -07:00
|
|
|
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
headers: {
|
|
|
|
Authorization: '=Bearer {{$credentials?.authToken}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
url: '={{$credentials.baseUrl}}/services/alerts/fired_alerts',
|
|
|
|
method: 'GET',
|
|
|
|
skipSslCertificateValidation: '={{$credentials?.allowUnauthorizedCerts}}',
|
|
|
|
},
|
|
|
|
};
|
2021-09-28 11:50:15 -07:00
|
|
|
}
|