diff --git a/examples/listIncompleteParts.hs b/examples/listIncompleteParts.hs new file mode 100755 index 0000000..8031961 --- /dev/null +++ b/examples/listIncompleteParts.hs @@ -0,0 +1,37 @@ +#!/usr/bin/env stack +-- stack --resolver lts-6.27 runghc --package minio-hs + +{-# Language OverloadedStrings #-} +import Network.Minio + +import qualified Data.Conduit as C +import qualified Data.Conduit.Combinators as CC +import Data.Default (Default(..)) +import Prelude + + +-- | The following example uses minio's play server at +-- https://play.minio.io:9000. The endpoint and associated +-- credentials are provided via the libary constant, +-- +-- > minioPlayCI :: ConnectInfo +-- + +main :: IO () +main = do + let + bucket = "test" + object = "multipartObj" + uid = "0ff9ccb9-d7ff-4def-9a98-571abefd7e2a" + + res <- runResourceT $ runMinio def $ do + listIncompleteParts bucket object uid C.$$ CC.sinkList + + print res + + {- + + Following is the output of the above program on a local Minio server. + + Right [ListPartInfo {piNumber = 2, piETag = "\"62876a639b739ffb7f733a7cb976ba6a\"", piSize = 17731794, piModTime = 2017-02-10 12:19:05.175 UTC}] +-} diff --git a/examples/listIncompleteUploads.hs b/examples/listIncompleteUploads.hs new file mode 100755 index 0000000..c57d875 --- /dev/null +++ b/examples/listIncompleteUploads.hs @@ -0,0 +1,34 @@ +#!/usr/bin/env stack +-- stack --resolver lts-6.27 runghc --package minio-hs + +{-# Language OverloadedStrings #-} +import Network.Minio + +import qualified Data.Conduit as C +import qualified Data.Conduit.Combinators as CC +import Data.Default (Default(..)) +import Prelude + +-- | The following example uses minio's play server at +-- https://play.minio.io:9000. The endpoint and associated +-- credentials are provided via the libary constant, +-- +-- > minioPlayCI :: ConnectInfo +-- + +main :: IO () +main = do + let + bucket = "test" + + -- Performs a recursive listing of incomplete uploads under bucket "test" + -- on a local minio server. + res <- runResourceT $ runMinio def $ do + listIncompleteUploads bucket Nothing True C.$$ CC.sinkList + print res + + {- + Following is the output of the above program on a local Minio server. + + Right [UploadInfo {uiKey = "multipartObj", uiUploadId = "0ff9ccb9-d7ff-4def-9a98-571abefd7e2a", uiInitTime = 2017-02-10 12:19:04.951 UTC}] + -} diff --git a/examples/listObjects.hs b/examples/listObjects.hs new file mode 100755 index 0000000..eb0b5c0 --- /dev/null +++ b/examples/listObjects.hs @@ -0,0 +1,34 @@ +#!/usr/bin/env stack +-- stack --resolver lts-6.27 runghc --package minio-hs + +{-# Language OverloadedStrings #-} +import Network.Minio + +import qualified Data.Conduit as C +import qualified Data.Conduit.Combinators as CC +import Prelude + + +-- | The following example uses minio's play server at +-- https://play.minio.io:9000. The endpoint and associated +-- credentials are provided via the libary constant, +-- +-- > minioPlayCI :: ConnectInfo +-- + +main :: IO () +main = do + let + bucket = "test" + + -- Performs a recursive listing of all objects under bucket "test" + -- on play.minio.io. + res <- runResourceT $ runMinio minioPlayCI $ do + listObjects bucket Nothing True C.$$ CC.sinkList + print res + + {- + Following is the output of the above program on a local Minio server. + + Right [ObjectInfo {oiObject = "ADVANCED.png", oiModTime = 2017-02-10 05:33:24.816 UTC, oiETag = "\"a69f3af6bbb06fe1d42ac910ec30482f\"", oiSize = 94026},ObjectInfo {oiObject = "obj", oiModTime = 2017-02-10 08:49:26.777 UTC, oiETag = "\"715a872a253a3596652c1490081b4b6a-1\"", oiSize = 15728640}] + -}