Repo for coding challenge. The API solution is built as per the requirements specified in the coding challege
This API is executed by sending POST request to https://myservice.altocumulus.it
The API is developed based on Serverless application model using following components.
- AWS Lambda : The application logic is written in .Net Core 2.1 that runs as a serverless AWS Lambda function triggered by API Gateway.
- AWS APIGateway : Is used to host a REST api service end point.
- AWS Cerificate Manager (ACM): To create and manage SSL certificate for custom domain integration with API Gateway.
- Custom domain/Friendly URL: https://myservice.altocumulus.it was created by mapping a CNAME record to API gateway provided regional domain name.
- Created initial version of the application logic as a standalone .Net Application.
- Created AWS Lambda project using AWS .Net SDK using empty function blue print.
- Moved application code into Lambda project and tested the execution of Lambda function in Mock Testing runtime.
- Published the Lambda function to AWS.
- Created an API Gateway end point that is configiured to trigger the Lambda Function.
- Modified the function code to interact with API Gateway using API Gateway Request and Response data types.
- Tested the API using Postman by invoking the unique URL provided by API Gateway.
- Created a new certificate in AWS ACM as this was mandatory requirement for custom domain integration with API Gateway
- Added target domain mapping in API Gateway for custom domain.
- Created a new CNAME record on the DNS server for the sub-domain (myservice.altocumulus.it) mapping to the Regional end point created by API Gateway.
This project consists of:
- Function.cs - class file containing a class with a single function handler method
- aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS
This function was written as part of the codingchallege
This function takes a Payload JSON and rerturns a filtered message as per the
specification provided.
<param name="input"></param>
<param name="context"></param>
A list of shows from the request payload, with DRM enabled (drm: true)
and have at least one episode (episodeCount > 0).
The unit testing project /AWSLambdaJParseUnit.Tests implements the following test scenarios. Note the the success scenario unit tests are prefixed by "Tn" and Failure scenarios by "TnErr" where "n" is the scenario number.
All Tests were executed within Visual Studio by setting up appropriate sampledata in AWSLambdaJParse.SampleData class
- Test for Happy Path : Provided the sample request JSON from specification output matched to sample response JSON
- Test for Empty Reponse: Tested by providing an empty payload or disabling all DRM flags, output was an empty response.
- Test for modified request message : Request data was modified by either changing the DRM flag or changing the episodeCount values to check the correctness of the query.
- Test for invalid JSON handling : Request sent with empty JSON i.e. {} and received a payload not found error as expected.
- Test for invalid JSON handling : Request sent with no JSON body i.e. blank request and received JSON parsing error.
- Test for invalid JSON handling : Request sent with INVALID JSON body i.e. {"payload":} and received JSON parsing error.
- Test for missing payload key : Request sent with incorrect root key such as "pay" and recieved a payload not found error as expected.
