This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
await sendMail(event.to, event.subject, event.message); | |
return { success: true }; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
const notes = await getNotes(user.id); // Fetch user notes from database. | |
const translatedNotes = await translate(notes, event.translateTo); // Translate notes to target language. | |
await sendMail(user.email, "Your notes", translatedNotes); // Send translated notes to user. | |
return { message: "You will receive the email soon" }; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
const translation = await translate(event.text, event.language); | |
return { text: translation }; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"StartAt": "translateTask", | |
"Comment": "exportNotes workflow.", | |
"Version": "1.0", | |
"States": { | |
"translateTask": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:x:x:function:translate", | |
"Next": "sendMailTask", | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"StartAt": "translateTask", | |
"Comment": "exportNotes workflow.", | |
"Version": "1.0", | |
"States": { | |
"translateTask": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:x:x:function:translate", | |
"Next": "adapter", | |
"InputPath": "$.translateInput", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const stepFunctions = new AWS.StepFunctions({}); | |
exports.handler = async (event) => { | |
const notes = await getNotes(user.id); // Fetch user notes from database. | |
const sfnInput = { // Prepare Step Functions input | |
translateInput: { // translate Task will use this input. | |
text: notes, | |
language: event.translateTo | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
// Convert translate lambda output to sendMail lambda input. | |
event.sendMailInput.message = event.translateOutput.text; | |
return event; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) | |
type loginSchema struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ClientError is an error whose details to be shared with client. | |
type ClientError interface { | |
Error() string | |
// ResponseBody returns response body. | |
ResponseBody() ([]byte, error) | |
// ResponseHeaders returns http status code and headers. | |
ResponseHeaders() (int, map[string]string) | |
} |
OlderNewer