export type GetApiKapisTerminalKubesphereIoV1alpha2NamespacesNamespacePodsPodExecArgs = {namespace: string, pod: string}; export type GetApiKapisTerminalKubesphereIoV1alpha2NamespacesNamespacePodsPodExecOptions = {baseUrl: string, BearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create pod terminal session * * GET /kapis/terminal.kubesphere.io/v1alpha2/namespaces/{namespace}/pods/{pod}/exec */ export const getApiKapisTerminalKubesphereIoV1alpha2NamespacesNamespacePodsPodExec = async (args: GetApiKapisTerminalKubesphereIoV1alpha2NamespacesNamespacePodsPodExecArgs, options: GetApiKapisTerminalKubesphereIoV1alpha2NamespacesNamespacePodsPodExecOptions) => { const {baseUrl, fetch: fetchFn = fetch, BearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (BearerToken !== undefined) headers.set("Authorization", BearerToken) const url = `${baseUrl.replace(/\/+$/, '')}/kapis/terminal.kubesphere.io/v1alpha2/namespaces/${encodeURIComponent(String(args.namespace))}/pods/${encodeURIComponent(String(args.pod))}/exec${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };