n8n/packages/nodes-base/nodes/Splunk/v2/methods/loadOptions.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
472 B
TypeScript
Raw Normal View History

2024-07-04 06:07:17 -07:00
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
import { splunkApiJsonRequest } from '../transport';
export async function getRoles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const endpoint = '/services/authorization/roles';
const responseData = await splunkApiJsonRequest.call(this, 'GET', endpoint);
return (responseData as Array<{ id: string }>).map((entry) => ({
name: entry.id,
value: entry.id,
}));
}