Safe Haskell | None |
---|---|
Language | Haskell2010 |
pipes
Producer
s for downloading data from AWS S3 objects.
Synopsis
- fromS3 :: MonadSafe m => Bucket -> Object -> Maybe ContentRange -> Producer ByteString m ()
- fromS3' :: MonadSafe m => Configuration -> S3Configuration NormalQuery -> Bucket -> Object -> Maybe ContentRange -> Producer ByteString m ()
- fromS3WithManager :: MonadSafe m => Manager -> Configuration -> S3Configuration NormalQuery -> Bucket -> Object -> Maybe ContentRange -> Producer ByteString m ()
- data ContentRange = ContentRange {}
- data S3DownloadError = S3DownloadError Bucket Object Status
Documentation
These may fail with either an S3DownloadError
or a S3Error
.
:: MonadSafe m | |
=> Bucket | |
-> Object | |
-> Maybe ContentRange | The requested |
-> 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.
:: MonadSafe m | |
=> Configuration | e.g. from |
-> S3Configuration NormalQuery | e.g. |
-> Bucket | |
-> Object | |
-> Maybe ContentRange | The requested |
-> 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 <- liftIObaseConfiguration
fromS3'
cfgdefServiceConfig
bucket object Nothing
:: MonadSafe m | |
=> Manager | |
-> Configuration | e.g. from |
-> S3Configuration NormalQuery | e.g. |
-> Bucket | |
-> Object | |
-> Maybe ContentRange | The requested |
-> 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 <- liftIObaseConfiguration
mgr <- liftIO $newManager
tlsManagerSettings
fromS3WithManager
mgr cfgdefServiceConfig
bucket object Nothing
data ContentRange Source #
A byte range within an object.
Instances
Eq ContentRange Source # | |
Defined in Pipes.Aws.S3.Download (==) :: ContentRange -> ContentRange -> Bool # (/=) :: ContentRange -> ContentRange -> Bool # | |
Ord ContentRange Source # | |
Defined in Pipes.Aws.S3.Download compare :: ContentRange -> ContentRange -> Ordering # (<) :: ContentRange -> ContentRange -> Bool # (<=) :: ContentRange -> ContentRange -> Bool # (>) :: ContentRange -> ContentRange -> Bool # (>=) :: ContentRange -> ContentRange -> Bool # max :: ContentRange -> ContentRange -> ContentRange # min :: ContentRange -> ContentRange -> ContentRange # | |
Show ContentRange Source # | |
Defined in Pipes.Aws.S3.Download showsPrec :: Int -> ContentRange -> ShowS # show :: ContentRange -> String # showList :: [ContentRange] -> ShowS # |
Error handling
data S3DownloadError Source #
Thrown when an unknown status code is returned from an S3 download request.
Instances
Show S3DownloadError Source # | |
Defined in Pipes.Aws.S3.Download showsPrec :: Int -> S3DownloadError -> ShowS # show :: S3DownloadError -> String # showList :: [S3DownloadError] -> ShowS # | |
Exception S3DownloadError Source # | |
Defined in Pipes.Aws.S3.Download |