| 1 | import * as cloudwatch from "@distilled.cloud/aws/cloudwatch"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { MetricStream } from "./MetricStream.ts"; |
| 5 | |
| 6 | type MetricStreams = [MetricStream, ...MetricStream[]]; |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `cloudwatch:StopMetricStreams` — pause streaming for |
| 10 | * the bound metric streams (e.g. to control Firehose cost during an |
| 11 | * incident). Resume with {@link StartMetricStreams}. Bind it to one or more |
| 12 | * {@link MetricStream} resources; the stream names are injected |
| 13 | * automatically. |
| 14 | * |
| 15 | * Provide `CloudWatch.StopMetricStreamsHttp` on the hosting Lambda |
| 16 | * Function to satisfy the requirement. |
| 17 | * ### Managing Metric Streams |
| 18 | * **Example:** Pause a Metric Stream |
| 19 | * ```typescript |
| 20 | * // init — grants cloudwatch:StopMetricStreams on the stream |
| 21 | * const stopMetricStreams = yield* AWS.CloudWatch.StopMetricStreams(stream); |
| 22 | * |
| 23 | * // runtime |
| 24 | * yield* stopMetricStreams(); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface StopMetricStreams extends Binding.Service< |
| 30 | StopMetricStreams, |
| 31 | "AWS.CloudWatch.StopMetricStreams", |
| 32 | ( |
| 33 | ...streams: MetricStreams |
| 34 | ) => Effect.Effect< |
| 35 | () => Effect.Effect<cloudwatch.StopMetricStreamsOutput, any> |
| 36 | > |
| 37 | > {} |
| 38 | |
| 39 | export const StopMetricStreams = Binding.Service<StopMetricStreams>( |
| 40 | "AWS.CloudWatch.StopMetricStreams", |
| 41 | ); |