| 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 | export interface GetMetricStreamRequest extends Omit< |
| 7 | cloudwatch.GetMetricStreamInput, |
| 8 | "Name" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `cloudwatch:GetMetricStream` — read the |
| 13 | * configuration and state of the bound {@link MetricStream}; the stream |
| 14 | * name is injected automatically. |
| 15 | * |
| 16 | * Provide `CloudWatch.GetMetricStreamHttp` on the hosting Lambda Function |
| 17 | * to satisfy the requirement. |
| 18 | * ### Reading Metric Streams |
| 19 | * **Example:** Read a Bound Metric Stream |
| 20 | * ```typescript |
| 21 | * // init — grants cloudwatch:GetMetricStream on the stream |
| 22 | * const getMetricStream = yield* AWS.CloudWatch.GetMetricStream(metricStream); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const result = yield* getMetricStream(); |
| 26 | * const state = result.State; // "running" | "stopped" |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface GetMetricStream extends Binding.Service< |
| 32 | GetMetricStream, |
| 33 | "AWS.CloudWatch.GetMetricStream", |
| 34 | ( |
| 35 | metricStream: MetricStream, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request?: GetMetricStreamRequest, |
| 39 | ) => Effect.Effect< |
| 40 | cloudwatch.GetMetricStreamOutput, |
| 41 | cloudwatch.GetMetricStreamError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const GetMetricStream = Binding.Service<GetMetricStream>( |
| 47 | "AWS.CloudWatch.GetMetricStream", |
| 48 | ); |