import * as CloudWatchSDK from '@aws-sdk/client-cloudwatch-logs'; import * as IamSdk from '@aws-sdk/client-iam'; import * as LambdaSDK from '@aws-sdk/client-lambda'; import * as S3SDK from '@aws-sdk/client-s3'; import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas'; import * as StsSdk from '@aws-sdk/client-sts'; import {getServiceClient, type ServiceMapping} from './get-service-client'; import type {AwsRegion} from './regions'; import type {CustomCredentials} from './shared-constants'; import type {RequestHandler} from './types'; export type GetAwsClientInput = { region: AwsRegion; service: T; customCredentials?: CustomCredentials | null; forcePathStyle?: boolean; requestHandler?: RequestHandler; }; type SdkMapping = { s3: typeof S3SDK; cloudwatch: typeof CloudWatchSDK; iam: typeof IamSdk; lambda: typeof LambdaSDK; servicequotas: typeof ServiceQuotasSDK; sts: typeof StsSdk; }; export type GetAwsClientOutput = { client: ServiceMapping[T]; sdk: SdkMapping[T]; }; /* * @description Exposes full access to the AWS SDK used by Remotion, allowing interaction with AWS infrastructure beyond provided functionalities. * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient) */ export const getAwsClient = ({ region, service, customCredentials, forcePathStyle, requestHandler, }: GetAwsClientInput): GetAwsClientOutput => { return { client: getServiceClient({ region, service, customCredentials: customCredentials ?? null, forcePathStyle: forcePathStyle ?? false, requestHandler, }), sdk: { lambda: LambdaSDK, cloudwatch: CloudWatchSDK, iam: IamSdk, s3: S3SDK, servicequotas: ServiceQuotasSDK, sts: StsSdk, }[service], }; };