export type RESTProcessProfileEntryConfig = {name: string, path: string, action: string, group: string}; export type RESTProcessProfileConfig = {group: string, alert_disabled?: boolean | undefined, hash_enabled?: boolean | undefined, process_change_list?: Array | undefined, process_delete_list?: Array | undefined, process_replace_list?: Array | undefined}; export type RESTProcessProfileConfigData = {process_profile_config: RESTProcessProfileConfig}; export type PatchApiProcessProfileNameArgs = {'X-Auth-Token': string, name: string, body: RESTProcessProfileConfigData}; export type PatchApiProcessProfileNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update a process profile * * PATCH /process_profile/{name} */ export const patchApiProcessProfileName = async (args: PatchApiProcessProfileNameArgs, options: PatchApiProcessProfileNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Auth-Token'] != null) headers.set("X-Auth-Token", String(args['X-Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/process_profile/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };