mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-28 22:19:41 -08:00
feat: Add Zabbix credential only node (#11489)
This commit is contained in:
parent
0cbb46c8b9
commit
fbd1ecfb29
78
packages/nodes-base/credentials/ZabbixApi.credentials.ts
Normal file
78
packages/nodes-base/credentials/ZabbixApi.credentials.ts
Normal file
|
@ -0,0 +1,78 @@
|
|||
import type {
|
||||
IAuthenticateGeneric,
|
||||
Icon,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class ZabbixApi implements ICredentialType {
|
||||
name = 'zabbixApi';
|
||||
|
||||
displayName = 'Zabbix API';
|
||||
|
||||
documentationUrl = 'zabbix';
|
||||
|
||||
icon: Icon = 'file:icons/Zabbix.svg';
|
||||
|
||||
httpRequestNode = {
|
||||
name: 'Zabbix',
|
||||
docsUrl: 'https://www.zabbix.com/documentation/current/en/manual/api',
|
||||
apiBaseUrl: '',
|
||||
};
|
||||
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'URL',
|
||||
name: 'url',
|
||||
required: true,
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'API Token',
|
||||
name: 'apiToken',
|
||||
required: true,
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiToken}}',
|
||||
'Content-Type': 'application/json-rpc',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: '={{$credentials.url}}'.replace(/\/$/, ''),
|
||||
url: '/api_jsonrpc.php',
|
||||
method: 'POST',
|
||||
body: {
|
||||
jsonrpc: '2.0',
|
||||
method: 'host.get',
|
||||
params: {
|
||||
output: ['hostid', 'host'],
|
||||
selectInterfaces: ['interfaceid', 'ip'],
|
||||
},
|
||||
id: 2,
|
||||
},
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
type: 'responseSuccessBody',
|
||||
properties: {
|
||||
key: 'result',
|
||||
value: undefined,
|
||||
message: 'Invalid access token',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
1
packages/nodes-base/credentials/icons/Zabbix.svg
Normal file
1
packages/nodes-base/credentials/icons/Zabbix.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg height="655" viewBox="0 0 400.83 104.99" width="2500" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h400.83v104.99h-400.83zm0 0" fill="#d40000"/><path d="m17.14 16h57.96v7.53l-46.65 57.15h47.79v8.31h-60.24v-7.53l46.65-57.15h-45.51zm98.3 9.73-13.54 36.33h27.13zm-5.64-9.73h11.32l28.12 72.99h-10.38l-6.71-18.72h-33.27l-6.72 18.72h-10.53zm60.14 38.13v26.74h16.01c5.37 0 9.35-1.1 11.94-3.3s3.88-5.57 3.88-10.09c0-4.56-1.29-7.93-3.88-10.1-2.59-2.16-6.57-3.25-11.94-3.25zm0-30.02v22h14.78c4.88 0 8.51-.91 10.9-2.71 2.39-1.81 3.58-4.57 3.58-8.28 0-3.68-1.2-6.44-3.58-8.26-2.39-1.82-6.02-2.74-10.9-2.74h-14.78zm-9.98-8.11h25.5c7.61 0 13.48 1.56 17.59 4.69 4.12 3.13 6.17 7.58 6.17 13.35 0 4.46-1.05 8.02-3.16 10.66s-5.21 4.29-9.29 4.94c4.91 1.04 8.72 3.21 11.44 6.52s4.08 7.44 4.08 12.39c0 6.52-2.24 11.55-6.72 15.11-4.48 3.55-10.86 5.33-19.12 5.33h-26.49zm78.32 38.13v26.74h16.02c5.37 0 9.35-1.1 11.93-3.3 2.59-2.2 3.88-5.57 3.88-10.09 0-4.56-1.29-7.93-3.88-10.1-2.59-2.16-6.57-3.25-11.93-3.25zm0-30.02v22h14.78c4.88 0 8.51-.91 10.9-2.71 2.39-1.81 3.58-4.57 3.58-8.28 0-3.68-1.19-6.44-3.58-8.26s-6.02-2.74-10.9-2.74h-14.78zm-9.98-8.11h25.5c7.61 0 13.48 1.56 17.59 4.69 4.12 3.13 6.18 7.58 6.18 13.35 0 4.46-1.05 8.02-3.16 10.66s-5.21 4.29-9.29 4.94c4.91 1.04 8.72 3.21 11.44 6.52s4.08 7.44 4.08 12.39c0 6.52-2.24 11.55-6.72 15.11-4.48 3.55-10.86 5.33-19.12 5.33h-26.5zm97.24 0h10.98l17.35 26.21 17.52-26.21h10.61l-22.84 34.19 25.68 38.8h-10.98l-20.21-30.54-20.41 30.54h-10.61l25.74-38.52zm-28.91 0h9.98v72.99h-9.98zm0 0" fill="#fff"/></svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -380,6 +380,7 @@
|
|||
"dist/credentials/XeroOAuth2Api.credentials.js",
|
||||
"dist/credentials/YourlsApi.credentials.js",
|
||||
"dist/credentials/YouTubeOAuth2Api.credentials.js",
|
||||
"dist/credentials/ZabbixApi.credentials.js",
|
||||
"dist/credentials/ZammadBasicAuthApi.credentials.js",
|
||||
"dist/credentials/ZammadTokenAuthApi.credentials.js",
|
||||
"dist/credentials/ZendeskApi.credentials.js",
|
||||
|
|
Loading…
Reference in a new issue