export type OpenapiElasticResource = {region: string, gpuType: string, gpuCount: number}; export type KeyValuePairDTO = {key: string, value: string}; export type OpenapiExposePort = {port: number, protocol?: string | undefined}; export type OpenapiElasticCreateRequest = {name: string, imageRegistry?: string | undefined, image: string, resources: Array, minSingleCardVramInGb?: number | undefined, minSingleCardVcpu?: number | undefined, minSingleCardRamInGb?: number | undefined, workers: number, credentialId?: string | undefined, containerVolumeInGb: number, initializationCommand?: string | undefined, environmentVars?: Array | undefined, expose?: OpenapiExposePort | undefined, serviceMode: string, webhookUrl?: string | undefined}; export type CreateApiOpenapiV1ElasticDeployCreateArgs = {body: OpenapiElasticCreateRequest}; export type CreateApiOpenapiV1ElasticDeployCreateOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create a Elastic deployment * * POST /openapi/v1/elastic/deploy/create */ export const createApiOpenapiV1ElasticDeployCreate = async (args: CreateApiOpenapiV1ElasticDeployCreateArgs, options: CreateApiOpenapiV1ElasticDeployCreateOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/openapi/v1/elastic/deploy/create${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 res.blob() };