export type ConcentrationRuleId = {name: string, vCluster?: string | undefined}; export type DeleteApiGatewayV2ConcentrationRuleArgs = {body: ConcentrationRuleId}; export type DeleteApiGatewayV2ConcentrationRuleOptions = {baseUrl: string, httpAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /gateway/v2/concentration-rule */ export const deleteApiGatewayV2ConcentrationRule = async (args: DeleteApiGatewayV2ConcentrationRuleArgs, options: DeleteApiGatewayV2ConcentrationRuleOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (httpAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${httpAuth.username}:${httpAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/gateway/v2/concentration-rule${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };