export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameActionsActionArgs = {serverName: string, action: 'copy' | 'restart' | 'shutdown' | 'start' | 'disableWhipWhep' | 'enableWhipWhep', dstEntryName?: string | undefined, vhostName: string, appName: string}; export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameActionsActionOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Application actions * * PUT /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/actions/{action} */ export const updateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameActionsAction = async (args: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameActionsActionArgs, options?: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameActionsActionOptions) => { const {baseUrl = "http://localhost:8087", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.dstEntryName != null) query.append("dstEntryName", String(args.dstEntryName)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/servers/${encodeURIComponent(String(args.serverName))}/vhosts/${encodeURIComponent(String(args.vhostName))}/applications/${encodeURIComponent(String(args.appName))}/actions/${encodeURIComponent(String(args.action))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };