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