UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

101 lines 2.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ElasticSecurityApi = void 0; class ElasticSecurityApi { name = 'elasticSecurityApi'; displayName = 'Elastic Security API'; documentationUrl = 'elasticsecurity'; properties = [ { displayName: 'Base URL', name: 'baseUrl', type: 'string', default: '', placeholder: 'e.g. https://mydeployment.kb.us-central1.gcp.cloud.es.io:9243', description: "Referred to as Kibana 'endpoint' in the Elastic deployment dashboard", required: true, }, { displayName: 'Type', name: 'type', type: 'options', options: [ { name: 'API Key', value: 'apiKey', }, { name: 'Basic Auth', value: 'basicAuth', }, ], default: 'basicAuth', }, { displayName: 'Username', name: 'username', type: 'string', default: '', required: true, displayOptions: { show: { type: ['basicAuth'], }, }, }, { displayName: 'Password', name: 'password', type: 'string', typeOptions: { password: true, }, default: '', required: true, displayOptions: { show: { type: ['basicAuth'], }, }, }, { displayName: 'API Key', name: 'apiKey', required: true, type: 'string', typeOptions: { password: true }, default: '', displayOptions: { show: { type: ['apiKey'], }, }, }, ]; async authenticate(credentials, requestOptions) { if (credentials.type === 'apiKey') { requestOptions.headers = { Authorization: `ApiKey ${credentials.apiKey}`, }; } else { requestOptions.auth = { username: credentials.username, password: credentials.password, }; requestOptions.headers = { 'kbn-xsrf': true, }; } return requestOptions; } test = { request: { baseURL: '={{$credentials.baseUrl}}', url: '/api/endpoint/metadata', method: 'GET', }, }; } exports.ElasticSecurityApi = ElasticSecurityApi; //# sourceMappingURL=ElasticSecurityApi.credentials.js.map