export type DeleteApiApiV2RoutingRulesArgs = {slug: string, force?: boolean | undefined}; export type DeleteApiApiV2RoutingRulesOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, appKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an AI Gateway routing rule * * DELETE /api/v2/routing-rules * * Also accepts auth: AuthZ */ export const deleteApiApiV2RoutingRules = async (args: DeleteApiApiV2RoutingRulesArgs, options?: DeleteApiApiV2RoutingRulesOptions) => { const {baseUrl = "https://api.datadoghq.com", fetch: fetchFn = fetch, apiKeyAuth, appKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.slug != null) query.append("slug", String(args.slug)) if (args.force != null) query.append("force", String(args.force)) if (apiKeyAuth !== undefined) headers.set("DD-API-KEY", apiKeyAuth) if (appKeyAuth !== undefined) headers.set("DD-APPLICATION-KEY", appKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/routing-rules${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 };