| 1 | import type * as detective from "@distilled.cloud/aws/detective"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Graph } from "./Graph.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `detective:StartInvestigation`. |
| 8 | * |
| 9 | * Kicks off a Detective investigation into an IAM user or role over a time |
| 10 | * window — the programmatic version of the console's "Run investigation" |
| 11 | * button. A security-automation function can trigger triage the moment a |
| 12 | * GuardDuty finding lands. The graph ARN is injected from the bound |
| 13 | * {@link Graph}. |
| 14 | * Provide the implementation with |
| 15 | * `Effect.provide(AWS.Detective.StartInvestigationHttp)`. |
| 16 | * ### Running Investigations |
| 17 | * **Example:** Investigate A Suspicious Role |
| 18 | * ```typescript |
| 19 | * // init — bind the operation to the behavior graph |
| 20 | * const startInvestigation = yield* AWS.Detective.StartInvestigation(graph); |
| 21 | * |
| 22 | * // runtime |
| 23 | * const { InvestigationId } = yield* startInvestigation({ |
| 24 | * EntityArn: suspiciousRoleArn, |
| 25 | * ScopeStartTime: new Date(Date.now() - 24 * 60 * 60 * 1000), |
| 26 | * ScopeEndTime: new Date(), |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface StartInvestigation extends Binding.Service< |
| 33 | StartInvestigation, |
| 34 | "AWS.Detective.StartInvestigation", |
| 35 | ( |
| 36 | graph: Graph, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: Omit<detective.StartInvestigationRequest, "GraphArn">, |
| 40 | ) => Effect.Effect< |
| 41 | detective.StartInvestigationResponse, |
| 42 | detective.StartInvestigationError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const StartInvestigation = Binding.Service<StartInvestigation>( |
| 47 | "AWS.Detective.StartInvestigation", |
| 48 | ); |