1import type * as sagemaker from "@distilled.cloud/aws/sagemaker";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Endpoint } from "./Endpoint.ts";
5
6export interface UpdateEndpointWeightsAndCapacitiesRequest extends Omit<
7 sagemaker.UpdateEndpointWeightsAndCapacitiesInput,
8 "EndpointName"
9> {}
10
11/**
12 * Runtime binding for `sagemaker:UpdateEndpointWeightsAndCapacities` — shift
13 * traffic between an endpoint's production variants (or resize one variant)
14 * without redeploying.
15 *
16 * Bind this operation to an `Endpoint` inside a function runtime to get a
17 * callable that automatically injects the endpoint name. Only applies to
18 * instance-based variants (serverless variants have no weights/capacities);
19 * the endpoint transitions through `Updating` back to `InService`.
20 * ### Shifting Traffic
21 * **Example:** Canary a Variant
22 * ```typescript
23 * // init
24 * const updateWeights =
25 * yield* AWS.SageMaker.UpdateEndpointWeightsAndCapacities(endpoint);
26 *
27 * // runtime
28 * yield* updateWeights({
29 * DesiredWeightsAndCapacities: [
30 * { VariantName: "Blue", DesiredWeight: 9 },
31 * { VariantName: "Green", DesiredWeight: 1 },
32 * ],
33 * });
34 * ```
35 *
36 * @binding
37 */
38export interface UpdateEndpointWeightsAndCapacities extends Binding.Service<
39 UpdateEndpointWeightsAndCapacities,
40 "AWS.SageMaker.UpdateEndpointWeightsAndCapacities",
41 <E extends Endpoint>(
42 endpoint: E,
43 ) => Effect.Effect<
44 (
45 request: UpdateEndpointWeightsAndCapacitiesRequest,
46 ) => Effect.Effect<
47 sagemaker.UpdateEndpointWeightsAndCapacitiesOutput,
48 sagemaker.UpdateEndpointWeightsAndCapacitiesError
49 >
50 >
51> {}
52export const UpdateEndpointWeightsAndCapacities =
53 Binding.Service<UpdateEndpointWeightsAndCapacities>(
54 "AWS.SageMaker.UpdateEndpointWeightsAndCapacities",
55 );