| 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 | |
| 5 | /** |
| 6 | * Runtime binding for `config:StartResourceEvaluation` — proactively |
| 7 | * evaluate a hypothetical resource configuration against your PROACTIVE |
| 8 | * Config rules before the resource is deployed. |
| 9 | * |
| 10 | * Provide `Config.StartResourceEvaluationHttp` on the hosting Lambda Function to |
| 11 | * satisfy the requirement. |
| 12 | * ### Proactive Resource Evaluation |
| 13 | * **Example:** Evaluate a Resource Before Deploying |
| 14 | * ```typescript |
| 15 | * // init — grants config:StartResourceEvaluation |
| 16 | * const startResourceEvaluation = yield* AWS.Config.StartResourceEvaluation(); |
| 17 | * |
| 18 | * // runtime |
| 19 | * const result = yield* startResourceEvaluation({ |
| 20 | * EvaluationMode: "PROACTIVE", |
| 21 | * ResourceDetails: { |
| 22 | * ResourceId: "my-bucket", |
| 23 | * ResourceType: "AWS::S3::Bucket", |
| 24 | * ResourceConfiguration: JSON.stringify({ |
| 25 | * BucketName: "my-bucket", |
| 26 | * }), |
| 27 | * ResourceConfigurationSchemaType: "CFN_RESOURCE_SCHEMA", |
| 28 | * }, |
| 29 | * }); |
| 30 | * console.log(result.ResourceEvaluationId); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface StartResourceEvaluation extends Binding.Service< |
| 36 | StartResourceEvaluation, |
| 37 | "AWS.Config.StartResourceEvaluation", |
| 38 | () => Effect.Effect< |
| 39 | ( |
| 40 | request: config.StartResourceEvaluationRequest, |
| 41 | ) => Effect.Effect< |
| 42 | config.StartResourceEvaluationResponse, |
| 43 | config.StartResourceEvaluationError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | |
| 48 | export const StartResourceEvaluation = Binding.Service<StartResourceEvaluation>( |
| 49 | "AWS.Config.StartResourceEvaluation", |
| 50 | ); |