1import type * as aas from "@distilled.cloud/aws/application-auto-scaling";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { ScalingPolicy } from "./ScalingPolicy.ts";
5
6/**
7 * `GetPredictiveScalingForecast` request with the policy's identity triple
8 * (`ServiceNamespace`/`ResourceId`/`ScalableDimension`) and `PolicyName`
9 * injected from the bound {@link ScalingPolicy}.
10 */
11export interface GetPredictiveScalingForecastRequest extends Omit<
12 aas.GetPredictiveScalingForecastRequest,
13 "ServiceNamespace" | "ResourceId" | "ScalableDimension" | "PolicyName"
14> {}
15
16/**
17 * Runtime binding for the `GetPredictiveScalingForecast` operation (IAM
18 * action `application-autoscaling:GetPredictiveScalingForecast`).
19 *
20 * Retrieves the load and capacity forecast a predictive scaling policy has
21 * computed for a time window (forecasts are created from at least 24 hours of
22 * historical CloudWatch data). The bound policy must be a `PredictiveScaling`
23 * policy on an ECS service: the API rejects other policy types with the typed
24 * `ValidationException` and namespaces without predictive scaling support
25 * with the typed `PredictiveScalingForecastNotSupported`. Provide the
26 * implementation with
27 * `Effect.provide(AWS.ApplicationAutoScaling.GetPredictiveScalingForecastHttp)`.
28 * ### Reading Forecasts
29 * **Example:** Get the Next 48 Hours of Forecast
30 * ```typescript
31 * // init — bind the operation to the predictive scaling policy
32 * const getPredictiveScalingForecast =
33 * yield* AWS.ApplicationAutoScaling.GetPredictiveScalingForecast(policy);
34 *
35 * // runtime — read the forecast window
36 * const now = yield* Effect.sync(() => Date.now());
37 * const forecast = yield* getPredictiveScalingForecast({
38 * StartTime: new Date(now),
39 * EndTime: new Date(now + 48 * 60 * 60 * 1000),
40 * });
41 * const capacity = forecast.CapacityForecast?.Values ?? [];
42 * ```
43 *
44 * @binding
45 */
46export interface GetPredictiveScalingForecast extends Binding.Service<
47 GetPredictiveScalingForecast,
48 "AWS.ApplicationAutoScaling.GetPredictiveScalingForecast",
49 (
50 policy: ScalingPolicy,
51 ) => Effect.Effect<
52 (
53 request: GetPredictiveScalingForecastRequest,
54 ) => Effect.Effect<
55 aas.GetPredictiveScalingForecastResponse,
56 aas.GetPredictiveScalingForecastError
57 >
58 >
59> {}
60
61export const GetPredictiveScalingForecast =
62 Binding.Service<GetPredictiveScalingForecast>(
63 "AWS.ApplicationAutoScaling.GetPredictiveScalingForecast",
64 );