mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
1c229a7b52
* ⬆️ Upgrade linter * 📦 Update `package-lock.json` * 👕 Enable rule * 👕 Apply rule * 📦 Re-update `package-lock.json`
47 lines
968 B
TypeScript
47 lines
968 B
TypeScript
import {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class GrafanaApi implements ICredentialType {
|
|
name = 'grafanaApi';
|
|
displayName = 'Grafana API';
|
|
documentationUrl = 'grafana';
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'API Key',
|
|
name: 'apiKey',
|
|
type: 'string',
|
|
typeOptions: { password: true },
|
|
default: '',
|
|
required: true,
|
|
},
|
|
{
|
|
displayName: 'Base URL',
|
|
name: 'baseUrl',
|
|
type: 'string',
|
|
default: '',
|
|
description: 'Base URL of your Grafana instance',
|
|
placeholder: 'e.g. https://n8n.grafana.net/',
|
|
required: true,
|
|
},
|
|
];
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{$credentials.baseUrl.replace(new RegExp("/$"), "") + "/api" }}',
|
|
url: '/folders',
|
|
},
|
|
};
|
|
}
|