| 1 | import type * as config from "@distilled.cloud/aws/config-service"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ConfigRule } from "./ConfigRule.ts"; |
| 5 | |
| 6 | /** Request for {@link PutExternalEvaluation} — the rule name is injected from the bound rule. */ |
| 7 | export interface PutExternalEvaluationRequest extends Omit< |
| 8 | config.PutExternalEvaluationRequest, |
| 9 | "ConfigRuleName" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `config:PutExternalEvaluation` — push an externally |
| 14 | * computed compliance verdict for one resource into the bound |
| 15 | * {@link ConfigRule} (the rule must use the external evaluation mode); the |
| 16 | * rule name is injected automatically. |
| 17 | * |
| 18 | * Provide `Config.PutExternalEvaluationHttp` on the hosting Lambda Function |
| 19 | * to satisfy the requirement. |
| 20 | * ### Reporting Evaluations (Custom Rules) |
| 21 | * **Example:** Push an External Evaluation |
| 22 | * ```typescript |
| 23 | * // init — grants config:PutExternalEvaluation |
| 24 | * const putExternalEvaluation = yield* AWS.Config.PutExternalEvaluation(rule); |
| 25 | * |
| 26 | * // runtime |
| 27 | * yield* putExternalEvaluation({ |
| 28 | * ExternalEvaluation: { |
| 29 | * ComplianceResourceType: "AWS::S3::Bucket", |
| 30 | * ComplianceResourceId: "my-bucket", |
| 31 | * ComplianceType: "COMPLIANT", |
| 32 | * OrderingTimestamp: new Date(), |
| 33 | * }, |
| 34 | * }); |
| 35 | * ``` |
| 36 | * |
| 37 | * @binding |
| 38 | */ |
| 39 | export interface PutExternalEvaluation extends Binding.Service< |
| 40 | PutExternalEvaluation, |
| 41 | "AWS.Config.PutExternalEvaluation", |
| 42 | ( |
| 43 | rule: ConfigRule, |
| 44 | ) => Effect.Effect< |
| 45 | ( |
| 46 | request: PutExternalEvaluationRequest, |
| 47 | ) => Effect.Effect< |
| 48 | config.PutExternalEvaluationResponse, |
| 49 | config.PutExternalEvaluationError |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | |
| 54 | export const PutExternalEvaluation = Binding.Service<PutExternalEvaluation>( |
| 55 | "AWS.Config.PutExternalEvaluation", |
| 56 | ); |