export type DetectionRuleUrn = string; export type DeleteApiCatalogV1DetectionRulesUrnArgs = {urn: DetectionRuleUrn}; export type DeleteApiCatalogV1DetectionRulesUrnOptions = {baseUrl?: string | undefined, JWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete detection rule * * DELETE /catalog/v1/detection-rules/{urn} */ export const deleteApiCatalogV1DetectionRulesUrn = async (args: DeleteApiCatalogV1DetectionRulesUrnArgs, options?: DeleteApiCatalogV1DetectionRulesUrnOptions) => { const {baseUrl = "https://your-environment.ataccama.one/api", fetch: fetchFn = fetch, JWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWT !== undefined) headers.set('authorization', `Bearer ${JWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/catalog/v1/detection-rules/${encodeURIComponent(String(args.urn))}${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 };