minio-hs/app/Main.hs
Krishnan Parthasarathi 342d0bc8ff Move Xml Generation to a module
- Make putBucket throw exception of failure
2017-02-13 16:03:42 +05:30

42 lines
1.1 KiB
Haskell

module Main where
import Protolude
import Network.Minio
import Network.Minio.S3API
-- import Network.Minio.S3API
import Control.Monad.Trans.Resource (runResourceT)
-- import qualified Data.Conduit as C
-- import qualified Data.Conduit.List as CL
-- import qualified Network.HTTP.Conduit as NC
main :: IO ()
main = do
mc <- connect defaultConnectInfo
t <- runResourceT $ runMinio mc $ do
res <- getService
print res
-- case res of
-- Left e -> print e
-- Right res1 -> mapM_ print res1
-- liftIO $ print $ NC.responseStatus res
-- liftIO $ print $ NC.responseHeaders res
-- liftIO print $ NC.responseHeaders <$> res
-- let bodyE = NC.responseBody <$> res
-- case bodyE of
-- Left x -> print x
-- Right body -> body C.$$+- CL.mapM_ putStrLn
-- body <- NC.responseBody <$> res
-- NC.responseBody res C.$$+- CL.mapM_ putStrLn
res <- getLocation "test1"
print res
res <- putBucket "test1" res
print res
fGetObject "test1" "passwd" "/tmp/passwd"
print "After runResourceT"
print t