module Network.Minio
(
ConnectInfo(..)
, awsCI
, minioPlayCI
, Minio
, runMinio
, runResourceT
, MinioErr(..)
, MErrV(..)
, MError(..)
, Bucket
, Object
, BucketInfo(..)
, ObjectInfo(..)
, UploadInfo(..)
, ListPartInfo(..)
, UploadId
, ObjectData(..)
, getService
, getLocation
, makeBucket
, listObjects
, listIncompleteUploads
, listIncompleteParts
, fGetObject
, fPutObject
, putObjectFromSource
, getObject
, statObject
) where
import Control.Monad.Trans.Resource (runResourceT)
import qualified Data.Conduit as C
import qualified Data.Conduit.Binary as CB
import Lib.Prelude
import Network.Minio.Data
import Network.Minio.ListOps
import Network.Minio.PutObject
import Network.Minio.S3API
fGetObject :: Bucket -> Object -> FilePath -> Minio ()
fGetObject bucket object fp = do
src <- getObject bucket object
src C.$$+- CB.sinkFileCautious fp
fPutObject :: Bucket -> Object -> FilePath -> Minio ()
fPutObject bucket object f = void $ putObject bucket object $
ODFile f Nothing
putObjectFromSource :: Bucket -> Object -> C.Producer Minio ByteString
-> Maybe Int64 -> Minio ()
putObjectFromSource bucket object src sizeMay = void $ putObject bucket object $
ODStream src sizeMay
getObject :: Bucket -> Object -> Minio (C.ResumableSource Minio ByteString)
getObject bucket object = snd <$> getObject' bucket object [] []
makeBucket :: Bucket -> Maybe Region -> Minio ()
makeBucket bucket regionMay= do
region <- maybe (asks $ connectRegion . mcConnInfo) return regionMay
putBucket bucket region
statObject :: Bucket -> Object -> Minio ObjectInfo
statObject bucket object = headObject bucket object