export type CreateApiApiV2SecurityMonitoringBatchMigrationsBatchIdCancelArgs = {batch_id: string}; export type CreateApiApiV2SecurityMonitoringBatchMigrationsBatchIdCancelOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, appKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel a batch migration * * POST /api/v2/security_monitoring/batch-migrations/{batch_id}/cancel * * Also accepts auth: AuthZ */ export const createApiApiV2SecurityMonitoringBatchMigrationsBatchIdCancel = async (args: CreateApiApiV2SecurityMonitoringBatchMigrationsBatchIdCancelArgs, options?: CreateApiApiV2SecurityMonitoringBatchMigrationsBatchIdCancelOptions) => { const {baseUrl = "https://api.datadoghq.com", fetch: fetchFn = fetch, apiKeyAuth, appKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKeyAuth !== undefined) headers.set("DD-API-KEY", apiKeyAuth) if (appKeyAuth !== undefined) headers.set("DD-APPLICATION-KEY", appKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/security_monitoring/batch-migrations/${encodeURIComponent(String(args.batch_id))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };