Documentation ¶
Index ¶
- Constants
- func AddFileToS3(s *session.Session, bucket string, filePath string, destPath string) error
- func AddPickToS3(s *session.Session, pickBytes []byte, pickPath string)
- func GetPickLocal() (int, string, string)
- func GetPickS3(s *session.Session) (int, []byte, string)
- func GetValidSesAddresses(s *session.Session) []string
- func ParseHtml(s string) (bool, string)
- func ReadFileFromS3(s *session.Session, bucket string, key string) ([]byte, error)
- func ReadPickLocal(path string, n int) (string, string, error)
- func SendSESEmail(s *session.Session, Sender string, Recipients []string, Subject string, ...)
- func WriteBufferToS3(s *session.Session, bucket string, buffer []byte, destPath string) error
- func WritePickLocal(s string, n int, outDir string)
Constants ¶
const (
// The character encoding for the email.
CharSet = "UTF-8"
)
Variables ¶
This section is empty.
Functions ¶
func AddFileToS3 ¶
AddFileToS3 will upload a single file to S3, it will require a pre-built aws session and will set file info like content type and encryption on the uploaded file. NOTE: This was the original boilerplate I copied from https://golangcode.com/uploading-a-file-to-s3/ It is _not_ currently used in the package because it was adapted into WriteBufferToS3() for our purposes.
func AddPickToS3 ¶
This is a placeholder to write the byte array of the picked paragraph to a text file in S3, but it will be replaced by something to write the paragraph into an email instead.
func GetPickLocal ¶
Picks a random paragraph from fbutils.OutDir and returns the number of the pick (int), the the text retrieved from the picked file (string), and the file path that the text came from (string). Note that it will panic on an unexpected error through PanicNonPathError(). We may want to refactor this to return errors later, but given the missingErr pattern it was easier to do this.
func GetPickS3 ¶
Picks a random paragraph from S3 and returns the number of the pick (int), the byte slice of the text retrieved from S3 ([]byte), and the S3 path that the slice came from (string). Note that it will panic on an unexpected error through PanicNonS3Missing(). We may want to refactor this to return errors later, but given the missingErr pattern it was easier to do this.
func GetValidSesAddresses ¶
func ReadFileFromS3 ¶
Reads a file from S3 into a buffer. This function requires a pre-built aws session.
func ReadPickLocal ¶
Read a file from directory passed to path and filename of n zero-padded to 5 digits.
func SendSESEmail ¶
func WriteBufferToS3 ¶
WriteBufferToS3 uploads a buffer (byte slice) to a file in S3. The `destPath` argument is often called a `key` in S3 terminology. Destination file will be at s3://[bucket]/[destPath] This function requires a pre-built aws session and will set file info like content type and encryption on the uploaded file.
func WritePickLocal ¶
Write string to file in outDir with filename of n zero-padded to 5 digits.
Types ¶
This section is empty.