| 1 | import * as eventbridge from "@distilled.cloud/aws/eventbridge"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Rule } from "./Rule.ts"; |
| 5 | |
| 6 | export interface DescribeRuleRequest extends Omit< |
| 7 | eventbridge.DescribeRuleRequest, |
| 8 | "Name" | "EventBusName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Reads the configuration of an EventBridge rule (`events:DescribeRule`). |
| 13 | * |
| 14 | * Bind this operation to a {@link Rule} inside a function runtime to get a |
| 15 | * callable that automatically injects the rule and bus names. Provide the |
| 16 | * `DescribeRuleHttp` layer on the Function to satisfy the binding. |
| 17 | * ### Describing Rules |
| 18 | * **Example:** Describe the Bound Rule |
| 19 | * ```typescript |
| 20 | * // init — bind the rule (provide AWS.EventBridge.DescribeRuleHttp on the Function) |
| 21 | * const describeRule = yield* AWS.EventBridge.DescribeRule(rule); |
| 22 | * |
| 23 | * // runtime — read the rule's state and pattern |
| 24 | * const info = yield* describeRule(); |
| 25 | * console.log(info.State, info.EventPattern); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface DescribeRule extends Binding.Service< |
| 31 | DescribeRule, |
| 32 | "AWS.EventBridge.DescribeRule", |
| 33 | ( |
| 34 | rule: Rule, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request?: DescribeRuleRequest, |
| 38 | ) => Effect.Effect< |
| 39 | eventbridge.DescribeRuleResponse, |
| 40 | eventbridge.DescribeRuleError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const DescribeRule = Binding.Service<DescribeRule>( |
| 45 | "AWS.EventBridge.DescribeRule", |
| 46 | ); |