export type ReIPInfo = {address?: string | undefined, control_address?: string | undefined, control_broadcast?: string | undefined, node_name?: string | undefined}; export type ReIPParams = {catalog_path?: string | undefined, re_ip_list?: Array | undefined}; export type UpdateApiCatalogReIpArgs = {body: ReIPParams}; export type UpdateApiCatalogReIpOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update IP addresses of nodes using catalog editor. * * PUT /catalog/re-ip */ export const updateApiCatalogReIp = async (args: UpdateApiCatalogReIpArgs, options: UpdateApiCatalogReIpOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/catalog/re-ip${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };