export type LogsState = 'requested' | 'collecting' | 'completed' | 'timeout' | ''; export type LogsProgressParams = {logs_state: LogsState}; export type UpdateApiV2InfraEnvsInfraEnvIdHostsHostIdLogsProgressArgs = {infra_env_id: string, host_id: string, body: LogsProgressParams}; export type UpdateApiV2InfraEnvsInfraEnvIdHostsHostIdLogsProgressOptions = {baseUrl?: string | undefined, agentAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update log collection state and progress. * * PUT /v2/infra-envs/{infra_env_id}/hosts/{host_id}/logs-progress */ export const updateApiV2InfraEnvsInfraEnvIdHostsHostIdLogsProgress = async (args: UpdateApiV2InfraEnvsInfraEnvIdHostsHostIdLogsProgressArgs, options?: UpdateApiV2InfraEnvsInfraEnvIdHostsHostIdLogsProgressOptions) => { const {baseUrl = "http://api.openshift.com/api/assisted-install", fetch: fetchFn = fetch, agentAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (agentAuth !== undefined) headers.set("X-Secret-Key", agentAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v2/infra-envs/${encodeURIComponent(String(args.infra_env_id))}/hosts/${encodeURIComponent(String(args.host_id))}/logs-progress${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 };