Export getService S3API as listBuckets (#18)
... for parity with other SDKs. - Also remove left-over reference of listIncompleteParts.
This commit is contained in:
parent
e60f08fb0b
commit
8efd9f2329
63
docs/API.md
63
docs/API.md
@ -46,11 +46,11 @@ def { connectHost = "host"
|
|||||||
|
|
||||||
|Bucket operations|Object Operations|
|
|Bucket operations|Object Operations|
|
||||||
|:---|:---|
|
|:---|:---|
|
||||||
|[`makeBucket`](#makeBucket)|[`getObject`](#getObject)|
|
|[`listBuckets`](#listBuckets) |[`getObject`](#getObject)|
|
||||||
|[`removeBucket`](#removeBucket)|[`putObject`](#putObject)|
|
|[`makeBucket`](#makeBucket)|[`putObject`](#putObject)|
|
||||||
|[`listObjects`](#listObjects)|[`fGetObject`](#fGetObject)|
|
|[`removeBucket`](#removeBucket)|[`fGetObject`](#fGetObject)|
|
||||||
|[`listIncompleteUploads`](#listIncompleteUploads)|[`fPutObject`](#fPutObject)|
|
|[`listObjects`](#listObjects)|[`fPutObject`](#fPutObject)|
|
||||||
|[`listIncompleteParts`](#listIncompleteParts)|[`copyObject`](#copyObject)|
|
|[`listIncompleteUploads`](#listIncompleteUploads)|[`copyObject`](#copyObject)|
|
||||||
||[`removeObject`](#removeObject)|
|
||[`removeObject`](#removeObject)|
|
||||||
|
|
||||||
## 1. ConnectInfo smart constructors
|
## 1. ConnectInfo smart constructors
|
||||||
@ -59,6 +59,25 @@ def { connectHost = "host"
|
|||||||
|
|
||||||
## 2. Bucket operations
|
## 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>
|
<a name="makeBucket"></a>
|
||||||
### makeBucket :: Bucket -> Maybe Region -> Minio ()
|
### 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
|
## 3. Object operations
|
||||||
|
|
||||||
<a name="getObject"></a>
|
<a name="getObject"></a>
|
||||||
|
|||||||
@ -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}]
|
|
||||||
-}
|
|
||||||
@ -35,7 +35,7 @@ module Network.Minio
|
|||||||
|
|
||||||
-- * Bucket Operations
|
-- * Bucket Operations
|
||||||
----------------------
|
----------------------
|
||||||
, getService
|
, listBuckets
|
||||||
, getLocation
|
, getLocation
|
||||||
, makeBucket
|
, makeBucket
|
||||||
, removeBucket
|
, removeBucket
|
||||||
@ -72,6 +72,10 @@ import Network.Minio.ListOps
|
|||||||
import Network.Minio.PutObject
|
import Network.Minio.PutObject
|
||||||
import Network.Minio.S3API
|
import Network.Minio.S3API
|
||||||
|
|
||||||
|
-- | Lists buckets.
|
||||||
|
listBuckets :: Minio [BucketInfo]
|
||||||
|
listBuckets = getService
|
||||||
|
|
||||||
-- | Fetch the object and write it to the given file safely. The
|
-- | Fetch the object and write it to the given file safely. The
|
||||||
-- object is first written to a temporary file in the same directory
|
-- object is first written to a temporary file in the same directory
|
||||||
-- and then moved to the given path.
|
-- and then moved to the given path.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user