Question: You are creating a notebook application. Your task is to implement the AWS Lambda function that will perform basic authentication and return the notes of

You are creating a notebook application. Your task is to implement the AWS Lambda function that will perform basic authentication and return the notes of the authenticated user. The notes and authentication data are stored in DynamoDB tables. The lambda function is later exposed through the API Gateway and serves as an HTTP request handler. Runtime for this Lambda handler is Java 8. Notes The DynamoDB table holding notes is named user-notes. Each note has the following attributes: -\(1 d \), which is a UUID V4; - user, which is an owner's email; - create date, which is a creation date, stored as a string in ISO_8601 format; - text, which holds actual note content. Example table rows: Database keys and indexes The table consists of a Partition key (user) and a Sort key (create_date). Authentication /r/n The DynamoDB table holding the authentication data is named token-ema1l-1ookup. The table has two fields: token and email. Each authentication token maps to the email of the user owning the given token. The table has a Partition key on the token field. Example table rows: Authentication header Tokens are passed to the lambda through the Authentication HTTP request header. The headers are available in the event. headers object. The Authentication header value takes the Bearer STOKEN> format. To query the user-notes table with the user email, you should get it from token-email-1ookup ones, reading the token from the HTTP request. Requirements /r/n Your task is to finish the implementation of the given lambda function. The function should: - return the user notes sorted by the create date attribute (in descending order),- return a maximum of 10 notes per query, - return an error (status 403) if token is invalid or empty (Bearer),- return an error (status 400) if the Authentication header is malformed or missing. You can focus on retuming the notes first and sort them later; the operations are scored separately. Technical notes Please note that handleRequest and getAuthenticateduserEmail functions are hooked with a testing framework. Don't change their names and signatures. Of course, you can add new functions. For querying DynamoDB please use specified table objects (eg. Table table \(=\) DynamoDBClient client getTable(tableName) :). You can look up their definitions in the official AWS Java DynamoDB SDK documentation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!