export type GovernanceControlParametersMap = {[key: string]: unknown}; export type GovernanceMitigationRequestAttributes = {detection_ids: Array, detection_type: string, mitigation_parameters?: GovernanceControlParametersMap | undefined, mitigation_type?: string | undefined}; export type GovernanceControlDetectionResourceType = 'governance_control_detection'; export type GovernanceMitigationRequestData = {attributes?: GovernanceMitigationRequestAttributes | undefined, type: GovernanceControlDetectionResourceType}; export type GovernanceMitigationRequest = {data: GovernanceMitigationRequestData}; export type CreateApiApiV2GovernanceDetectionsMitigateArgs = {body: GovernanceMitigationRequest}; export type CreateApiApiV2GovernanceDetectionsMitigateOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, appKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Mitigate detections * * POST /api/v2/governance/detections/mitigate * * Also accepts auth: AuthZ */ export const createApiApiV2GovernanceDetectionsMitigate = async (args: CreateApiApiV2GovernanceDetectionsMitigateArgs, options?: CreateApiApiV2GovernanceDetectionsMitigateOptions) => { const {baseUrl = "https://api.datadoghq.com", fetch: fetchFn = fetch, apiKeyAuth, appKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyAuth !== undefined) headers.set("DD-API-KEY", apiKeyAuth) if (appKeyAuth !== undefined) headers.set("DD-APPLICATION-KEY", appKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/governance/detections/mitigate${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };