git.iko.soy/typeable/minio-hs
on master help sign in
Add documentation for presigned operations (#68)

- Add full examples for presignedGetObjectUrl and presignedPutObjectUrl - Lower-case `*URL` API functions to `*Url` to adopt a Haskell naming convention Finishes and fixes #35, #36 and #37.

commitb7dfd0457d374ddb8a71877aeee4c10d371c6898 authorAditya Manthramurthy <donatello@users.noreply.github.com> dateMon 16 Oct 2017, 16:13 (9 years ago) parentc26af26
7 files changed+403−56
docs/API.md+218−11 examples/PresignedGetObject.hs+82 examples/PresignedPutObject.hs+59 examples/PutObject.hs+3−4 src/Network/Minio.hs+7−7 src/Network/Minio/PresignedOperations.hs+17−17 test/LiveServer.hs+17−17
docs/API.md+218−11
@@ -20,15 +20,15 @@ awsCI { connectAccesskey = "your-access-key"
2020
2121```
2222
23−|Bucket operations|Object Operations|
24−|:---|:---|
25−|[`listBuckets`](#listBuckets) |[`getObject`](#getObject)|
26−|[`makeBucket`](#makeBucket)|[`putObject`](#putObject)|
27−|[`removeBucket`](#removeBucket)|[`fGetObject`](#fGetObject)|
28−|[`listObjects`](#listObjects)|[`fPutObject`](#fPutObject)|
29−|[`listObjectsV1`](#listObjectsV1)|[`copyObject`](#copyObject)|
30−|[`listIncompleteUploads`](#listIncompleteUploads)|[`removeObject`](#removeObject)|
31−|[`bucketExists`](#bucketExists)||
23+|Bucket operations|Object Operations|Presigned Operations|
24+|:---|:---|:---|
25+|[`listBuckets`](#listBuckets) |[`getObject`](#getObject)|[`presignedGetObjectUrl`](#presignedGetObjectUrl)|
26+|[`makeBucket`](#makeBucket)|[`putObject`](#putObject)|[`presignedPutObjectUrl`](#presignedPutObjectUrl)|
27+|[`removeBucket`](#removeBucket)|[`fGetObject`](#fGetObject)|[`presignedPostPolicy`](#presignedPostPolicy)|
28+|[`listObjects`](#listObjects)|[`fPutObject`](#fPutObject)||
29+|[`listObjectsV1`](#listObjectsV1)|[`copyObject`](#copyObject)||
30+|[`listIncompleteUploads`](#listIncompleteUploads)|[`removeObject`](#removeObject)||
31+|[`bucketExists`](#bucketExists)|||
3232
3333## 1. Connecting and running operations on the storage service
3434
@@ -685,9 +685,216 @@ In the expression `bucketExists bucketName` the parameters are:
685685| `bucketName` | _Bucket_ (alias for `Text`) | Name of the bucket |
686686
687687
688−<!-- ## 4. Presigned operations -->
688+## 4. Presigned operations
689689
690−<!-- TODO -->
690+<a name="presignedGetObjectUrl"></a>
691+### presignedGetObjectUrl :: Bucket -> Object -> UrlExpiry -> Query -> RequestHeaders -> Minio ByteString
692+
693+Generate a URL with authentication signature to GET (download) an
694+object. All extra query parameters and headers passed here will be
695+signed and are required when the generated URL is used. Query
696+parameters could be used to change the response headers sent by the
697+server. Headers can be used to set Etag match conditions among others.
698+
699+For a list of possible request parameters and headers, please refer
700+to the GET object REST API AWS S3 documentation.
701+
702+__Parameters__
703+
704+In the expression `presignedGetObjectUrl bucketName objectName expiry queryParams headers`
705+the parameters are:
706+
707+|Param |Type |Description |
708+|:---|:---| :---|
709+| `bucketName` | _Bucket_ (alias for `Text`) | Name of the bucket |
710+| `objectName` | _Object_ (alias for `Text`) | Name of the object |
711+| `expiry` | _UrlExpiry_ (alias for `Int`) | Url expiry time in seconds |
712+| `queryParams` | _Query_ (from package `http-types:Network.HTTP.Types`) | Query parameters to add to the URL |
713+| `headers` | _RequestHeaders_ (from package `http-types:Network.HTTP.Types` | Request headers that would be used with the URL |
714+
715+__Return Value__
716+
717+Returns the generated URL - it will include authentication
718+information.
719+
720+|Return type |Description |
721+|:---|:---|
722+| _ByteString_ | Generated presigned URL |
723+
724+__Example__
725+
726+```haskell
727+{-# Language OverloadedStrings #-}
728+
729+import Network.Minio
730+import qualified Data.ByteString.Char8 as B
731+
732+main :: IO ()
733+main = do
734+ let
735+ bucket = "mybucket"
736+ object = "myobject"
737+
738+ res <- runMinio minioPlayCI $ do
739+ -- Set a 7 day expiry for the URL
740+ presignedGetObjectUrl bucket object (7*24*3600) [] []
741+
742+ -- Print the URL on success.
743+ putStrLn $ either
744+ (("Failed to generate URL: " ++) . show)
745+ B.unpack
746+ res
747+```
748+
749+<a name="presignedPutObjectUrl"></a>
750+### presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString
751+
752+Generate a URL with authentication signature to PUT (upload) an
753+object. Any extra headers if passed, are signed, and so they are
754+required when the URL is used to upload data. This could be used, for
755+example, to set user-metadata on the object.
756+
757+For a list of possible headers to pass, please refer to the PUT object
758+REST API AWS S3 documentation.
759+
760+__Parameters__
761+
762+In the expression `presignedPutObjectUrl bucketName objectName expiry headers`
763+the parameters are:
764+
765+|Param |Type |Description |
766+|:---|:---| :---|
767+| `bucketName` | _Bucket_ (alias for `Text`) | Name of the bucket |
768+| `objectName` | _Object_ (alias for `Text`) | Name of the object |
769+| `expiry` | _UrlExpiry_ (alias for `Int`) | Url expiry time in seconds |
770+| `headers` | _RequestHeaders_ (from package `http-types:Network.HTTP.Types` | Request headers that would be used with the URL |
771+
772+__Return Value__
773+
774+Returns the generated URL - it will include authentication
775+information.
776+
777+|Return type |Description |
778+|:---|:---|
779+| _ByteString_ | Generated presigned URL |
780+
781+__Example__
782+
783+```haskell
784+{-# Language OverloadedStrings #-}
785+
786+import Network.Minio
787+import qualified Data.ByteString.Char8 as B
788+
789+main :: IO ()
790+main = do
791+ let
792+ bucket = "mybucket"
793+ object = "myobject"
794+
795+ res <- runMinio minioPlayCI $ do
796+ -- Set a 7 day expiry for the URL
797+ presignedPutObjectUrl bucket object (7*24*3600) [] []
798+
799+ -- Print the URL on success.
800+ putStrLn $ either
801+ (("Failed to generate URL: " ++) . show)
802+ B.unpack
803+ res
804+```
805+
806+<a name="presignedPostPolicy"></a>
807+### presignedPostPolicy :: PostPolicy -> Minio (ByteString, Map.Map Text ByteString)
808+
809+Generate a presigned URL and POST policy to upload files via a POST
810+request. This is intended for browser uploads and generates form data
811+that should be submitted in the request.
812+
813+The `PostPolicy` argument is created using the `newPostPolicy` function:
814+
815+#### newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy
816+
817+In the expression `newPostPolicy expirationTime conditions` the parameters are:
818+
819+|Param | Type| Description |
820+|:---|:---|:---|
821+| `expirationTime` | _UTCTime_ (from package `time:Data.Time.UTCTime`) | The expiration time for the policy |
822+| `conditions` | _[PostPolicyConditions]_ | List of conditions to be added to the policy |
823+
824+The policy conditions are created using various helper functions -
825+please refer to the Haddocks for details.
826+
827+Since conditions are validated by `newPostPolicy` it returns an
828+`Either` value.
829+
830+__Return Value__
831+
832+`presignedPostPolicy` returns a 2-tuple - the generated URL and a map
833+containing the form-data that should be submitted with the request.
834+
835+__Example__
836+
837+```haskell
838+{-# Language OverloadedStrings #-}
839+
840+import Network.Minio
841+
842+import qualified Data.ByteString as B
843+import qualified Data.ByteString.Char8 as Char8
844+import qualified Data.Map.Strict as Map
845+import qualified Data.Text.Encoding as Enc
846+import qualified Data.Time as Time
847+
848+main :: IO ()
849+main = do
850+ now <- Time.getCurrentTime
851+ let
852+ bucket = "mybucket"
853+ object = "myobject"
854+
855+ -- set an expiration time of 10 days
856+ expireTime = Time.addUTCTime (3600 * 24 * 10) now
857+
858+ -- create a policy with expiration time and conditions - since the
859+ -- conditions are validated, newPostPolicy returns an Either value
860+ policyE = newPostPolicy expireTime
861+ [ -- set the object name condition
862+ ppCondKey "photos/my-object"
863+ -- set the bucket name condition
864+ , ppCondBucket "my-bucket"
865+ -- set the size range of object as 1B to 10MiB
866+ , ppCondContentLengthRange 1 (10*1024*1024)
867+ -- set content type as jpg image
868+ , ppCondContentType "image/jpeg"
869+ -- on success set the server response code to 200
870+ , ppCondSuccessActionStatus 200
871+ ]
872+
873+ case policyE of
874+ Left err -> putStrLn $ show err
875+ Right policy -> do
876+ res <- runMinio minioPlayCI $ do
877+ (url, formData) <- presignedPostPolicy policy
878+
879+ -- a curl command is output to demonstrate using the generated
880+ -- URL and form-data
881+ let
882+ formFn (k, v) = B.concat ["-F ", Enc.encodeUtf8 k, "=",
883+ "'", v, "'"]
884+ formOptions = B.intercalate " " $ map formFn $ Map.toList formData
885+
886+
887+ return $ B.intercalate " " $
888+ ["curl", formOptions, "-F file=@/tmp/photo.jpg", url]
889+
890+ case res of
891+ Left e -> putStrLn $ "post-policy error: " ++ (show e)
892+ Right cmd -> do
893+ putStrLn $ "Put a photo at /tmp/photo.jpg and run command:\n"
894+
895+ -- print the generated curl command
896+ Char8.putStrLn cmd
897+```
691898
692899<!-- ## 5. Bucket policy/notification operations -->
693900
examples/PresignedGetObject.hsnew file+82
@@ -0,0 +1,82 @@
1+#!/usr/bin/env stack
2+-- stack --resolver lts-9.1 runghc --package minio-hs
3+
4+--
5+-- Minio Haskell SDK, (C) 2017 Minio, Inc.
6+--
7+-- Licensed under the Apache License, Version 2.0 (the "License");
8+-- you may not use this file except in compliance with the License.
9+-- You may obtain a copy of the License at
10+--
11+-- http://www.apache.org/licenses/LICENSE-2.0
12+--
13+-- Unless required by applicable law or agreed to in writing, software
14+-- distributed under the License is distributed on an "AS IS" BASIS,
15+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+-- See the License for the specific language governing permissions and
17+-- limitations under the License.
18+--
19+
20+{-# LANGUAGE OverloadedStrings #-}
21+import Network.Minio
22+
23+import Control.Monad.IO.Class (liftIO)
24+import qualified Data.ByteString.Char8 as B
25+import Data.CaseInsensitive (original)
26+import qualified Data.Conduit.Combinators as CC
27+import qualified Data.Text.Encoding as E
28+
29+-- | The following example uses minio's play server at
30+-- https://play.minio.io:9000. The endpoint and associated
31+-- credentials are provided via the libary constant,
32+--
33+-- > minioPlayCI :: ConnectInfo
34+--
35+
36+main :: IO ()
37+main = do
38+ let
39+ bucket = "my-bucket"
40+ object = "my-object"
41+ kb15 = 15*1024
42+
43+ -- Set query parameter to modify content disposition response
44+ -- header
45+ queryParam = [("response-content-disposition",
46+ Just "attachment; filename=\"your-filename.txt\"")]
47+
48+ res <- runMinio minioPlayCI $ do
49+ liftIO $ B.putStrLn "Upload a file that we will fetch with a presigned URL..."
50+ putObject bucket object (CC.repeat "a") (Just kb15)
51+ liftIO $ putStrLn $ "Done. Object created at: my-bucket/my-object"
52+
53+ -- Extract Etag of uploaded object
54+ (ObjectInfo _ _ etag _) <- statObject bucket object
55+
56+ -- Set header to add an if-match constraint - this makes sure
57+ -- the fetching fails if the object is changed on the server
58+ let headers = [("If-Match", E.encodeUtf8 etag)]
59+
60+ -- Generate a URL with 7 days expiry time - note that the headers
61+ -- used above must be added to the request with the signed URL
62+ -- generated.
63+ url <- presignedGetObjectUrl "my-bucket" "my-object" (7*24*3600)
64+ queryParam headers
65+
66+ return (headers, etag, url)
67+
68+ case res of
69+ Left e -> putStrLn $ "presignedPutObject URL failed." ++ show e
70+ Right (headers, etag, url) -> do
71+
72+ -- We generate a curl command to demonstrate usage of the signed
73+ -- URL.
74+ let
75+ hdrOpt (k, v) = B.concat ["-H '", original k, ": ", v, "'"]
76+ curlCmd = B.intercalate " " $
77+ ["curl --fail"] ++ map hdrOpt headers ++
78+ ["-o /tmp/myfile", B.concat ["'", url, "'"]]
79+
80+ putStrLn $ "The following curl command would use the presigned " ++
81+ "URL to fetch the object and write it to \"/tmp/myfile\":"
82+ B.putStrLn curlCmd
examples/PresignedPutObject.hsnew file+59
@@ -0,0 +1,59 @@
1+#!/usr/bin/env stack
2+-- stack --resolver lts-9.1 runghc --package minio-hs
3+
4+--
5+-- Minio Haskell SDK, (C) 2017 Minio, Inc.
6+--
7+-- Licensed under the Apache License, Version 2.0 (the "License");
8+-- you may not use this file except in compliance with the License.
9+-- You may obtain a copy of the License at
10+--
11+-- http://www.apache.org/licenses/LICENSE-2.0
12+--
13+-- Unless required by applicable law or agreed to in writing, software
14+-- distributed under the License is distributed on an "AS IS" BASIS,
15+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+-- See the License for the specific language governing permissions and
17+-- limitations under the License.
18+--
19+
20+{-# LANGUAGE OverloadedStrings #-}
21+import Network.Minio
22+
23+import qualified Data.ByteString.Char8 as B
24+import Data.CaseInsensitive (original)
25+
26+-- | The following example uses minio's play server at
27+-- https://play.minio.io:9000. The endpoint and associated
28+-- credentials are provided via the libary constant,
29+--
30+-- > minioPlayCI :: ConnectInfo
31+--
32+
33+main :: IO ()
34+main = do
35+ let
36+ -- Use headers to set user-metadata - note that this header will
37+ -- need to be set when the URL is used to make an upload.
38+ headers = [("x-amz-meta-url-creator",
39+ "minio-hs-presigned-put-example")]
40+ res <- runMinio minioPlayCI $ do
41+
42+ -- generate a URL with 7 days expiry time
43+ presignedPutObjectURL "my-bucket" "my-object" (7*24*3600) headers
44+
45+ case res of
46+ Left e -> putStrLn $ "presignedPutObject URL failed." ++ show e
47+ Right url -> do
48+
49+ -- We generate a curl command to demonstrate usage of the signed
50+ -- URL.
51+ let
52+ hdrOpt (k, v) = B.concat ["-H '", original k, ": ", v, "'"]
53+ curlCmd = B.intercalate " " $
54+ ["curl "] ++ map hdrOpt headers ++
55+ ["-T /tmp/myfile", B.concat ["'", url, "'"]]
56+
57+ B.putStrLn $ "The following curl command would use the presigned " ++
58+ "URL to upload the file at \"/tmp/myfile\":"
59+ B.putStrLn curlCmd
examples/PutObject.hs+3−4
@@ -17,11 +17,10 @@
1717-- limitations under the License.
1818--
1919
20−{-# Language OverloadedStrings #-}
20+{-# LANGUAGE OverloadedStrings #-}
2121import Network.Minio
2222
2323import qualified Data.Conduit.Combinators as CC
24−import Prelude
2524
2625-- | The following example uses minio's play server at
2726-- https://play.minio.io:9000. The endpoint and associated
@@ -42,7 +41,7 @@ main = do
4241 res1 <- runMinio minioPlayCI $
4342 putObject bucket object (CC.repeat "a") (Just kb15)
4443 case res1 of
45− Left e -> putStrLn $ "putObject failed." ++ show e
44+ Left e -> putStrLn $ "putObject failed." ++ show e
4645 Right () -> putStrLn "putObject succeeded."
4746
4847
@@ -50,5 +49,5 @@ main = do
5049 res2 <- runMinio minioPlayCI $
5150 fPutObject bucket object localFile
5251 case res2 of
53− Left e -> putStrLn $ "fPutObject failed." ++ show e
52+ Left e -> putStrLn $ "fPutObject failed." ++ show e
5453 Right () -> putStrLn "fPutObject succeeded."
src/Network/Minio.hs+7−7
@@ -79,9 +79,9 @@ module Network.Minio
7979 -- * Presigned Operations
8080 -------------------------
8181 , UrlExpiry
82− , presignedPutObjectURL
83− , presignedGetObjectURL
84− , presignedHeadObjectURL
82+ , presignedPutObjectUrl
83+ , presignedGetObjectUrl
84+ , presignedHeadObjectUrl
8585
8686 , PostPolicyCondition
8787 , ppCondBucket
@@ -102,11 +102,11 @@ module Network.Minio
102102This module exports the high-level Minio API for object storage.
103103-}
104104
105−import qualified Data.Conduit as C
106−import qualified Data.Conduit.Binary as CB
105+import qualified Data.Conduit as C
106+import qualified Data.Conduit.Binary as CB
107107import qualified Data.Conduit.Combinators as CC
108−import Data.Default (def)
109−import qualified Data.Map as Map
108+import Data.Default (def)
109+import qualified Data.Map as Map
110110
111111import Lib.Prelude
112112
src/Network/Minio/PresignedOperations.hs+17−17
@@ -16,10 +16,10 @@
1616
1717module Network.Minio.PresignedOperations
1818 ( UrlExpiry
19− , makePresignedURL
20− , presignedPutObjectURL
21− , presignedGetObjectURL
22− , presignedHeadObjectURL
19+ , makePresignedUrl
20+ , presignedPutObjectUrl
21+ , presignedGetObjectUrl
22+ , presignedHeadObjectUrl
2323
2424 , PostPolicyCondition(..)
2525 , ppCondBucket
@@ -54,17 +54,17 @@ import Network.Minio.Errors
5454import Network.Minio.Sign.V4
5555
5656-- | Generate a presigned URL. This function allows for advanced usage
57−-- - for simple cases prefer the `presigned*URL` functions.
57+-- - for simple cases prefer the `presigned*Url` functions.
5858--
5959-- If region is Nothing, it is picked up from the connection
6060-- information (no check of bucket existence is performed).
6161--
6262-- All extra query parameters or headers are signed, and therefore are
6363-- required to be sent when the generated URL is actually used.
64−makePresignedURL :: UrlExpiry -> HT.Method -> Maybe Bucket -> Maybe Object
64+makePresignedUrl :: UrlExpiry -> HT.Method -> Maybe Bucket -> Maybe Object
6565 -> Maybe Region -> HT.Query -> HT.RequestHeaders
6666 -> Minio ByteString
67−makePresignedURL expiry method bucket object region extraQuery extraHeaders = do
67+makePresignedUrl expiry method bucket object region extraQuery extraHeaders = do
6868 when (expiry > 7*24*3600 || expiry < 0) $
6969 throwM $ MErrVInvalidUrlExpiry expiry
7070
@@ -98,10 +98,10 @@ makePresignedURL expiry method bucket object region extraQuery extraHeaders = do
9898--
9999-- For a list of possible headers to pass, please refer to the PUT
100100-- object REST API AWS S3 documentation.
101−presignedPutObjectURL :: Bucket -> Object -> UrlExpiry -> HT.RequestHeaders
101+presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> HT.RequestHeaders
102102 -> Minio ByteString
103−presignedPutObjectURL bucket object expirySeconds extraHeaders =
104− makePresignedURL expirySeconds HT.methodPut
103+presignedPutObjectUrl bucket object expirySeconds extraHeaders =
104+ makePresignedUrl expirySeconds HT.methodPut
105105 (Just bucket) (Just object) Nothing [] extraHeaders
106106
107107-- | Generate a URL with authentication signature to GET (download) an
@@ -113,10 +113,10 @@ presignedPutObjectURL bucket object expirySeconds extraHeaders =
113113--
114114-- For a list of possible request parameters and headers, please refer
115115-- to the GET object REST API AWS S3 documentation.
116−presignedGetObjectURL :: Bucket -> Object -> UrlExpiry -> HT.Query
116+presignedGetObjectUrl :: Bucket -> Object -> UrlExpiry -> HT.Query
117117 -> HT.RequestHeaders -> Minio ByteString
118−presignedGetObjectURL bucket object expirySeconds extraQuery extraHeaders =
119− makePresignedURL expirySeconds HT.methodGet
118+presignedGetObjectUrl bucket object expirySeconds extraQuery extraHeaders =
119+ makePresignedUrl expirySeconds HT.methodGet
120120 (Just bucket) (Just object) Nothing extraQuery extraHeaders
121121
122122-- | Generate a URL with authentication signature to make a HEAD
@@ -126,10 +126,10 @@ presignedGetObjectURL bucket object expirySeconds extraQuery extraHeaders =
126126--
127127-- For a list of possible headers to pass, please refer to the HEAD
128128-- object REST API AWS S3 documentation.
129−presignedHeadObjectURL :: Bucket -> Object -> UrlExpiry
129+presignedHeadObjectUrl :: Bucket -> Object -> UrlExpiry
130130 -> HT.RequestHeaders -> Minio ByteString
131−presignedHeadObjectURL bucket object expirySeconds extraHeaders =
132− makePresignedURL expirySeconds HT.methodHead
131+presignedHeadObjectUrl bucket object expirySeconds extraHeaders =
132+ makePresignedUrl expirySeconds HT.methodHead
133133 (Just bucket) (Just object) Nothing [] extraHeaders
134134
135135-- | Represents individual conditions in a Post Policy document.
@@ -239,7 +239,7 @@ showPostPolicy :: PostPolicy -> ByteString
239239showPostPolicy = toS . Json.encode
240240
241241-- | Generate a presigned URL and POST policy to upload files via a
242−-- browser. On success, this function returns a URL and a POST
242+-- browser. On success, this function returns a URL and POST
243243-- form-data.
244244presignedPostPolicy :: PostPolicy
245245 -> Minio (ByteString, Map.Map Text ByteString)
test/LiveServer.hs+17−17
@@ -433,7 +433,7 @@ liveServerUnitTests = testGroup "Unit tests against a live server"
433433
434434 forM_ [src, copyObj] (removeObject bucket)
435435
436− , presignedURLFunTest
436+ , presignedUrlFunTest
437437 , presignedPostPolicyFunTest
438438 ]
439439
@@ -505,8 +505,8 @@ basicTests = funTestWithBucket "Basic tests" $ \step bucket -> do
505505 step "delete object"
506506 deleteObject bucket object
507507
508−presignedURLFunTest :: TestTree
509−presignedURLFunTest = funTestWithBucket "presigned URL tests" $
508+presignedUrlFunTest :: TestTree
509+presignedUrlFunTest = funTestWithBucket "presigned Url tests" $
510510 \step bucket -> do
511511 let obj = "mydir/myput"
512512 obj2 = "mydir1/myfile1"
@@ -514,8 +514,8 @@ presignedURLFunTest = funTestWithBucket "presigned URL tests" $
514514 -- manager for http requests
515515 mgr <- liftIO $ NC.newManager NC.tlsManagerSettings
516516
517− step "PUT object presigned URL - makePresignedURL"
518− putUrl <- makePresignedURL 3600 HT.methodPut (Just bucket)
517+ step "PUT object presigned URL - makePresignedUrl"
518+ putUrl <- makePresignedUrl 3600 HT.methodPut (Just bucket)
519519 (Just obj) (Just "us-east-1") [] []
520520
521521 let size1 = 1000 :: Int64
@@ -526,8 +526,8 @@ presignedURLFunTest = funTestWithBucket "presigned URL tests" $
526526 liftIO $ (NC.responseStatus putResp == HT.status200) @?
527527 "presigned PUT failed"
528528
529− step "GET object presigned URL - makePresignedURL"
530− getUrl <- makePresignedURL 3600 HT.methodGet (Just bucket)
529+ step "GET object presigned URL - makePresignedUrl"
530+ getUrl <- makePresignedUrl 3600 HT.methodGet (Just bucket)
531531 (Just obj) (Just "us-east-1") [] []
532532
533533 getResp <- getR mgr getUrl
@@ -540,39 +540,39 @@ presignedURLFunTest = funTestWithBucket "presigned URL tests" $
540540 "presigned put and get got mismatched data"
541541
542542 step "PUT object presigned - presignedPutObjectURL"
543− putUrl2 <- presignedPutObjectURL bucket obj2 3600 []
543+ putUrl2 <- presignedPutObjectUrl bucket obj2 3600 []
544544
545545 let size2 = 1200
546546 testFile <- mkRandFile size2
547547
548548 putResp2 <- putR size2 testFile mgr putUrl2
549549 liftIO $ (NC.responseStatus putResp2 == HT.status200) @?
550− "presigned PUT failed (presignedPutObjectURL)"
550+ "presigned PUT failed (presignedPutObjectUrl)"
551551
552− step "HEAD object presigned URL - presignedHeadObjectURL"
553− headUrl <- presignedHeadObjectURL bucket obj2 3600 []
552+ step "HEAD object presigned URL - presignedHeadObjectUrl"
553+ headUrl <- presignedHeadObjectUrl bucket obj2 3600 []
554554
555555 headResp <- do req <- NC.parseRequest $ toS headUrl
556556 NC.httpLbs (req {NC.method = HT.methodHead}) mgr
557557 liftIO $ (NC.responseStatus headResp == HT.status200) @?
558− "presigned HEAD failed (presignedHeadObjectURL)"
558+ "presigned HEAD failed (presignedHeadObjectUrl)"
559559
560560 -- check that header info is accurate
561561 let h = Map.fromList $ NC.responseHeaders headResp
562562 cLen = Map.findWithDefault "0" HT.hContentLength h
563563 liftIO $ (cLen == show size2) @? "Head req returned bad content length"
564564
565− step "GET object presigned URL - presignedGetObjectURL"
566− getUrl2 <- presignedGetObjectURL bucket obj2 3600 [] []
565+ step "GET object presigned URL - presignedGetObjectUrl"
566+ getUrl2 <- presignedGetObjectUrl bucket obj2 3600 [] []
567567
568568 getResp2 <- getR mgr getUrl2
569569 liftIO $ (NC.responseStatus getResp2 == HT.status200) @?
570− "presigned GET failed (presignedGetObjectURL)"
570+ "presigned GET failed (presignedGetObjectUrl)"
571571
572572 -- read content from file to compare with response above
573573 bs2 <- CB.sourceFile testFile $$ CB.sinkLbs
574574 liftIO $ (bs2 == NC.responseBody getResp2) @?
575− "presigned put and get got mismatched data (presigned*URL)"
575+ "presigned put and get got mismatched data (presigned*Url)"
576576
577577
578578 mapM_ (removeObject bucket) [obj, obj2]
@@ -589,7 +589,7 @@ presignedURLFunTest = funTestWithBucket "presigned URL tests" $
589589 NC.httpLbs req mgr
590590
591591presignedPostPolicyFunTest :: TestTree
592−presignedPostPolicyFunTest = funTestWithBucket "presigned URL tests" $
592+presignedPostPolicyFunTest = funTestWithBucket "Presigned Post Policy tests" $
593593 \step bucket -> do
594594
595595 step "presignedPostPolicy basic test"