Example #1
0
        public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest input, ILambdaContext context)
        {
            if (string.IsNullOrEmpty(input.Body))
            {
                var logMessage = $"Tried to invoke lambda with empty input. Request Id: {context.AwsRequestId}";
                LambdaLogger.Log(logMessage);
                return(FormatResponse(logMessage, 500));
            }

            InitializeFunctionConfiguration();

            return(input.Body switch
            {
                "All" => FormatResponse(_coffeeService.GetAllAvailableCoffees(), 200),
                _ => FormatResponse("Not found", 404)
            });