export type Image = {imageType?: ('Standard' | 'Custom') | undefined, imageName: string}; export type Memory = {memoryAmount: number, memoryUnit?: ('Mi' | 'M' | 'Gi' | 'G') | undefined}; export type MountInfo = {mountType: 'New' | 'Existing' | 'None', localPath: string, subPath?: string | undefined, size: number, mountPath: string, accessMode?: ('ReadWriteOnce' | 'ReadWriteMany' | 'ReadOnlyMany') | undefined}; export type NewNotebookRequest = {name: string, namespace: string, proxyUser?: string | undefined, image: Image, cpu: number, memory: Memory, workspaceVolume?: MountInfo | undefined, dataVolume?: MountInfo | undefined, extraResources?: string | undefined, queue?: string | undefined, executorCores?: string | undefined, executorMemory?: string | undefined, executors?: string | undefined, driverMemory?: string | undefined, sparkSessionNum?: number | undefined}; export type CreateApiAideV1NamespacesNamespaceNotebooksArgs = {namespace: unknown, body: NewNotebookRequest}; export type CreateApiAideV1NamespacesNamespaceNotebooksOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a Notebook in the given Namesapce * * POST /aide/v1/namespaces/{namespace}/notebooks */ export const createApiAideV1NamespacesNamespaceNotebooks = async (args: CreateApiAideV1NamespacesNamespaceNotebooksArgs, options?: CreateApiAideV1NamespacesNamespaceNotebooksOptions) => { const {baseUrl = "https://gateway.mlss.aide", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/aide/v1/namespaces/${encodeURIComponent(String(args.namespace))}/notebooks${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };