export type DeleteApiApiV2ProjectsProjectIdClustersClusterIdArgs = {project_id: string, cluster_id: string, DeleteVolumes?: boolean | undefined, DeleteLoadBalancers?: boolean | undefined}; export type DeleteApiApiV2ProjectsProjectIdClustersClusterIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes the specified cluster * * DELETE /api/v2/projects/{project_id}/clusters/{cluster_id} */ export const deleteApiApiV2ProjectsProjectIdClustersClusterId = async (args: DeleteApiApiV2ProjectsProjectIdClustersClusterIdArgs, options: DeleteApiApiV2ProjectsProjectIdClustersClusterIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.DeleteVolumes != null) headers.set("DeleteVolumes", String(args.DeleteVolumes)) if (args.DeleteLoadBalancers != null) headers.set("DeleteLoadBalancers", String(args.DeleteLoadBalancers)) if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/projects/${encodeURIComponent(String(args.project_id))}/clusters/${encodeURIComponent(String(args.cluster_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };