pipes-s3-0.3.0.2: A simple interface for streaming data to and from Amazon S3

Safe HaskellNone
LanguageHaskell2010

Pipes.Aws.S3.Download

Contents

Description

pipes Producers for downloading data from AWS S3 objects.

Synopsis

Documentation

These may fail with either an S3DownloadError or a S3Error.

fromS3 Source #

Arguments

:: MonadSafe m 
=> Bucket 
-> Object 
-> Maybe ContentRange

The requested ContentRange. Nothing implies entire object.

-> Producer ByteString m () 

Download an object from S3

Note that this makes no attempt at reusing a Manager and therefore may not be very efficient for many small requests. See fromS3WithManager for more control over the Manager used.

fromS3' Source #

Arguments

:: MonadSafe m 
=> Configuration

e.g. from baseConfiguration

-> S3Configuration NormalQuery

e.g. defServiceConfig

-> Bucket 
-> Object 
-> Maybe ContentRange

The requested ContentRange. Nothing implies entire object.

-> Producer ByteString m () 

Download an object from S3 explicitly specifying an aws Configuration, which provides credentials and logging configuration.

Note that this makes no attempt at reusing a Manager and therefore may not be very efficient for many small requests. See fromS3WithManager for more control over the Manager used.

import qualified Aws.Core as Aws

getWholeObject :: MonadSafe m => Bucket -> Object -> Producer BS.ByteString m ()
getWholeObject bucket object = do
    cfg <- liftIO baseConfiguration
    fromS3' cfg defServiceConfig bucket object Nothing

fromS3WithManager Source #

Arguments

:: MonadSafe m 
=> Manager 
-> Configuration

e.g. from baseConfiguration

-> S3Configuration NormalQuery

e.g. defServiceConfig

-> Bucket 
-> Object 
-> Maybe ContentRange

The requested ContentRange. Nothing implies entire object.

-> Producer ByteString m () 

Download an object from S3 explicitly specifying an http-client Manager and aws Configuration (which provides credentials and logging configuration).

This can be more efficient when submitting many small requests as it allows re-use of the Manager across requests. Note that the Manager provided must support TLS; such a manager can be created with

import qualified Aws.Core as Aws
import qualified Network.HTTP.Client as HTTP.Client
import qualified Network.HTTP.Client.TLS as HTTP.Client.TLS

getWholeObject :: MonadSafe m => Bucket -> Object -> Producer BS.ByteString m ()
getWholeObject bucket object = do
    cfg <- liftIO baseConfiguration
    mgr <- liftIO $ newManager tlsManagerSettings
    fromS3WithManager mgr cfg defServiceConfig bucket object Nothing

Error handling