UNPKG

@aws-sdk/core

Version:

Core functions & classes shared by multiple AWS SDK clients.

16 lines (15 loc) • 822 B
import { normalizeProvider } from "@smithy/core/client"; import { DEFAULT_ACCOUNT_ID_ENDPOINT_MODE, validateAccountIdEndpointMode } from "./AccountIdEndpointModeConstants"; export const resolveAccountIdEndpointModeConfig = (input) => { const { accountIdEndpointMode } = input; const accountIdEndpointModeProvider = normalizeProvider(accountIdEndpointMode ?? DEFAULT_ACCOUNT_ID_ENDPOINT_MODE); return Object.assign(input, { accountIdEndpointMode: async () => { const accIdMode = await accountIdEndpointModeProvider(); if (!validateAccountIdEndpointMode(accIdMode)) { throw new Error(`Invalid value for accountIdEndpointMode: ${accIdMode}. Valid values are: "required", "preferred", "disabled".`); } return accIdMode; }, }); };