export type UpdateApiNetIfacesNamespaceArgs = {namespace: string, body: {host_dev_name?: string | undefined, iface_id?: string | undefined, guest_mac?: string | undefined, guest_addr?: string | undefined, unique_addr?: string | undefined}}; export type UpdateApiNetIfacesNamespaceOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Put a vm network * * PUT /net-ifaces/{namespace} */ export const updateApiNetIfacesNamespace = async (args: UpdateApiNetIfacesNamespaceArgs, options?: UpdateApiNetIfacesNamespaceOptions) => { const {baseUrl = "http://localhost:8080", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/net-ifaces/${encodeURIComponent(String(args.namespace))}${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 };