export type DeleteApiGatewayV2VirtualClusterVClusterArgs = {vCluster: string}; export type DeleteApiGatewayV2VirtualClusterVClusterOptions = {baseUrl: string, httpAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /gateway/v2/virtual-cluster/{vCluster} */ export const deleteApiGatewayV2VirtualClusterVCluster = async (args: DeleteApiGatewayV2VirtualClusterVClusterArgs, options: DeleteApiGatewayV2VirtualClusterVClusterOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (httpAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${httpAuth.username}:${httpAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/gateway/v2/virtual-cluster/${encodeURIComponent(String(args.vCluster))}${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 };