| 1 | import type * as aiops from "@distilled.cloud/aws/aiops"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { InvestigationGroup } from "./InvestigationGroup.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `aiops:GetInvestigationGroupPolicy`. |
| 8 | * |
| 9 | * Reads the IAM resource policy attached to the bound |
| 10 | * {@link InvestigationGroup} (the policy that lets principals like |
| 11 | * `aiops.alarms.cloudwatch.amazonaws.com` create investigations), returned |
| 12 | * as a JSON string. Fails with the typed `ResourceNotFoundException` when no |
| 13 | * policy is attached. The group's ARN is injected from the binding. Provide |
| 14 | * the implementation with |
| 15 | * `Effect.provide(AWS.AIOps.GetInvestigationGroupPolicyHttp)`. |
| 16 | * ### Reading the Resource Policy |
| 17 | * **Example:** Audit Who Can Start Investigations |
| 18 | * ```typescript |
| 19 | * // init — grants aiops:GetInvestigationGroupPolicy on the group |
| 20 | * const getInvestigationGroupPolicy = |
| 21 | * yield* AWS.AIOps.GetInvestigationGroupPolicy(group); |
| 22 | * |
| 23 | * // runtime — no policy attached surfaces as a typed error |
| 24 | * const attached = yield* getInvestigationGroupPolicy().pipe( |
| 25 | * Effect.map((r) => r.policy), |
| 26 | * Effect.catchTag("ResourceNotFoundException", () => |
| 27 | * Effect.succeed(undefined), |
| 28 | * ), |
| 29 | * ); |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface GetInvestigationGroupPolicy extends Binding.Service< |
| 35 | GetInvestigationGroupPolicy, |
| 36 | "AWS.AIOps.GetInvestigationGroupPolicy", |
| 37 | ( |
| 38 | group: InvestigationGroup, |
| 39 | ) => Effect.Effect< |
| 40 | () => Effect.Effect< |
| 41 | aiops.GetInvestigationGroupPolicyResponse, |
| 42 | aiops.GetInvestigationGroupPolicyError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const GetInvestigationGroupPolicy = |
| 47 | Binding.Service<GetInvestigationGroupPolicy>( |
| 48 | "AWS.AIOps.GetInvestigationGroupPolicy", |
| 49 | ); |