Export getService S3API as listBuckets (#18)

... for parity with other SDKs.

- Also remove left-over reference of listIncompleteParts.
This commit is contained in:
Krishnan Parthasarathi 2017-03-02 12:11:34 +05:30 committed by Aditya Manthramurthy
parent e60f08fb0b
commit 8efd9f2329
3 changed files with 29 additions and 77 deletions

View File

@ -46,11 +46,11 @@ def { connectHost = "host"
|Bucket operations|Object Operations|
|:---|:---|
|[`makeBucket`](#makeBucket)|[`getObject`](#getObject)|
|[`removeBucket`](#removeBucket)|[`putObject`](#putObject)|
|[`listObjects`](#listObjects)|[`fGetObject`](#fGetObject)|
|[`listIncompleteUploads`](#listIncompleteUploads)|[`fPutObject`](#fPutObject)|
|[`listIncompleteParts`](#listIncompleteParts)|[`copyObject`](#copyObject)|
|[`listBuckets`](#listBuckets) |[`getObject`](#getObject)|
|[`makeBucket`](#makeBucket)|[`putObject`](#putObject)|
|[`removeBucket`](#removeBucket)|[`fGetObject`](#fGetObject)|
|[`listObjects`](#listObjects)|[`fPutObject`](#fPutObject)|
|[`listIncompleteUploads`](#listIncompleteUploads)|[`copyObject`](#copyObject)|
||[`removeObject`](#removeObject)|
## 1. ConnectInfo smart constructors
@ -59,6 +59,25 @@ def { connectHost = "host"
## 2. Bucket operations
<a name="listBuckets"></a>
### listBuckets :: Minio [BucketInfo]
Lists buckets.
__Return Value__
|Return type |Description |
|:---|:---|
| _Minio [BucketInfo]_| List of buckets |
__BucketInfo record type__
|Field |Type |Description |
|:---|:---| :---|
| `biName` | _Bucket_ (alias of `Text`) | Name of the bucket |
| `biCreationDate` | _UTCTime_ | Creation time of the bucket |
<a name="makeBucket"></a>
### makeBucket :: Bucket -> Maybe Region -> Minio ()
@ -219,40 +238,6 @@ main = do
```
__Return Value__
|Return type |Description |
|:---|:---|
| _C.Producer Minio ObjectPartInfo_ | A Conduit Producer of `ObjectPartInfo` values corresponding to each completed part in the ongoing upload |
__ObjectPartInfo record type__
|Field |Type |Description |
|:---|:---| :---|
|`opiNumber` | _PartNumber_ (alias for `Int16`) | Serial part number of the part|
|`opiETag` | _ETag_ (alias for `Text`) | The ETag entity of the part |
|`opiSize` | _Int64_ |Size of the part in the bytes |
|`opiModTime` | _UTCTime_ | Last modified time |
__Example__
```haskell
import Data.Conduit ($$)
import Conduit.Combinators (sinkList)
main :: IO ()
main = do
let
bucket = "test"
-- Lists the parts in an incompletely uploaded object identified by
-- bucket, object and upload ID.
res <- runResourceT $ runMinio minioPlayCI $ do
listIncompleteParts bucket "mpartObject" "xxxxx11111" $$ sinkList
print res
```
## 3. Object operations
<a name="getObject"></a>

View File

@ -1,37 +0,0 @@
#!/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}]
-}

View File

@ -35,7 +35,7 @@ module Network.Minio
-- * Bucket Operations
----------------------
, getService
, listBuckets
, getLocation
, makeBucket
, removeBucket
@ -72,6 +72,10 @@ import Network.Minio.ListOps
import Network.Minio.PutObject
import Network.Minio.S3API
-- | Lists buckets.
listBuckets :: Minio [BucketInfo]
listBuckets = getService
-- | Fetch the object and write it to the given file safely. The
-- object is first written to a temporary file in the same directory
-- and then moved to the given path.