Add listObjects, listIncompleteUploads and listIncompleteParts examples
This commit is contained in:
parent
2bffed8833
commit
fc3824e772
37
examples/listIncompleteParts.hs
Executable file
37
examples/listIncompleteParts.hs
Executable file
@ -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}]
|
||||||
|
-}
|
||||||
34
examples/listIncompleteUploads.hs
Executable file
34
examples/listIncompleteUploads.hs
Executable file
@ -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}]
|
||||||
|
-}
|
||||||
34
examples/listObjects.hs
Executable file
34
examples/listObjects.hs
Executable file
@ -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}]
|
||||||
|
-}
|
||||||
Loading…
Reference in New Issue
Block a user