UNPKG

awscdk-construct-scte-scheduler

Version:

AWS CDK Construct for scheduling SCTE-35 events using the MediaLive schedule API

20 lines (19 loc) 718 B
import { getSmithyContext } from "@smithy/core/client"; import { toEndpointV1 } from "@smithy/core/endpoints"; import { operation } from "../schemas/operation"; export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => { const { operationSchema } = getSmithyContext(context); const [, ns, n, t, i, o] = operationSchema ?? []; const endpoint = context.endpointV2 ? async () => toEndpointV1(context.endpointV2) : config.endpoint; const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, { ...config, ...context, endpoint, }); return next({ ...args, request, }); };