aws 0.11.2 → 0.11.3
raw patch · 6 files changed
+87/−7 lines, 6 filesdep ~basedep ~conduitdep ~conduit-extranew-component:exe:MultipartTransferPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, conduit, conduit-extra, filepath, http-conduit, tagged, text
API changes (from Hackage documentation)
+ Aws.Core: instance Ord Method
+ Aws.S3.Commands.Multipart: multipartUploadWithInitiator :: Configuration -> S3Configuration NormalQuery -> (Bucket -> Text -> InitiateMultipartUpload) -> Manager -> Text -> Text -> Conduit () (ResourceT IO) ByteString -> Integer -> ResourceT IO ()
Files
- Aws/Core.hs +1/−1
- Aws/DynamoDb/Core.hs +2/−2
- Aws/S3/Commands/Multipart.hs +18/−0
- Examples/MultipartTransfer.hs +37/−0
- README.org +7/−0
- aws.cabal +22/−4
Aws/Core.hs view
@@ -396,7 +396,7 @@ | Post -- ^ POST method. Sends a service- and request-specific request body. | Put -- ^ PUT method. | Delete -- ^ DELETE method.- deriving (Show, Eq)+ deriving (Show, Eq, Ord) -- | HTTP method associated with a request method. httpMethod :: Method -> HTTP.Method
Aws/DynamoDb/Core.hs view
@@ -828,7 +828,7 @@ instance FromJSON AmazonError where parseJSON (Object v) = AmazonError <$> v .: "__type"- <*> v .:? "message"+ <*> (Just <$> (v .: "message" <|> v .: "Message") <|> pure Nothing) parseJSON _ = error $ "aws: unexpected AmazonError message" @@ -1138,7 +1138,7 @@ ------------------------------------------------------------------------------- -- | Will an attribute be considered empty by DynamoDb? ----- A 'PutItem' (or similar) with empty attributes will be rejection+-- A 'PutItem' (or similar) with empty attributes will be rejected -- with a 'ValidationException'. nullAttr :: Attribute -> Bool nullAttr (Attribute _ val) =
Aws/S3/Commands/Multipart.hs view
@@ -416,3 +416,21 @@ $= putConduit cfg s3cfg mgr bucket object uploadId $$ CL.consume liftIO $ sendEtag cfg s3cfg mgr bucket object uploadId etags++multipartUploadWithInitiator ::+ Configuration+ -> S3Configuration NormalQuery+ -> (Bucket -> T.Text -> InitiateMultipartUpload)+ -> HTTP.Manager+ -> T.Text+ -> T.Text+ -> Conduit () (ResourceT IO) B8.ByteString+ -> Integer+ -> ResourceT IO ()+multipartUploadWithInitiator cfg s3cfg initiator mgr bucket object src chunkSize = do+ uploadId <- liftIO $ imurUploadId <$> memoryAws cfg s3cfg mgr (initiator bucket object)+ etags <- src+ $= chunkedConduit chunkSize+ $= putConduit cfg s3cfg mgr bucket object uploadId+ $$ CL.consume+ liftIO $ sendEtag cfg s3cfg mgr bucket object uploadId etags
+ Examples/MultipartTransfer.hs view
@@ -0,0 +1,37 @@+{-# LANGUAGE OverloadedStrings #-}++{- This example demonstrates an ability to stream in constant space content from a remote resource into an S3 object accessible publicly -}+++import qualified Aws+import Aws.Aws (Configuration (..))+import qualified Aws.S3 as S3+import Control.Applicative ((<$>))+import Data.Conduit (unwrapResumable)+import qualified Data.Text as T+import Network.HTTP.Conduit (http, parseUrl, responseBody,+ withManager)+import System.Environment (getArgs)++main :: IO ()+main = do+ maybeCreds <- Aws.loadCredentialsFromEnv+ case maybeCreds of+ Nothing -> do+ putStrLn "Please set the environment variables AWS_ACCESS_KEY_ID and AWS_ACCESS_KEY_SECRET"+ Just creds -> do+ args <- getArgs+ cfg <- Aws.dbgConfiguration+ let s3cfg = Aws.defServiceConfig :: S3.S3Configuration Aws.NormalQuery++ case args of+ [sourceUrl,destBucket,destObj] -> do+ request <- parseUrl sourceUrl+ withManager $ \mgr -> do+ resumableSource <- responseBody <$> http request mgr+ (source, _) <- unwrapResumable resumableSource+ let initiator b o = (S3.postInitiateMultipartUpload b o){S3.imuAcl = Just S3.AclPublicRead}+ S3.multipartUploadWithInitiator cfg{credentials = creds} s3cfg initiator mgr (T.pack destBucket) (T.pack destObj) source (10*1024*1024)+ _ -> do+ putStrLn "Usage: MultipartTransfer sourceUrl destinationBucket destinationObjectname"+
README.org view
@@ -90,6 +90,13 @@ ** 0.11 series +- 0.11.3+ - Support for blaze-builder 0.4+ - Support for utf8-string 1.0+ - New function: multipartUploadWithInitiator+ - Fix issue in DynamoDB error parsing+ - Ord instance for Aws.Core.Method+ - 0.11.2 - Support for time 1.5 (we previously forgot to relax the upper bound in Cabal)
aws.cabal view
@@ -1,5 +1,5 @@ Name: aws-Version: 0.11.2+Version: 0.11.3 Synopsis: Amazon Web Services (AWS) for Haskell Description: Bindings for Amazon Web Services (AWS), with the aim of supporting all AWS services. To see a high level overview of the library, see the README at <https://github.com/aristidb/aws/blob/master/README.org>. Homepage: http://github.com/aristidb/aws@@ -20,7 +20,7 @@ Source-repository this type: git location: https://github.com/aristidb/aws.git- tag: 0.11.2+ tag: 0.11.3 Source-repository head type: git@@ -115,7 +115,7 @@ base16-bytestring == 0.1.*, base16-bytestring == 0.1.*, base64-bytestring == 1.0.*,- blaze-builder >= 0.2.1.4 && < 0.4,+ blaze-builder >= 0.2.1.4 && < 0.5, byteable == 0.1.*, bytestring >= 0.9 && < 0.11, case-insensitive >= 0.2 && < 1.3,@@ -142,7 +142,7 @@ time >= 1.1.4 && < 1.6, transformers >= 0.2.2 && < 0.5, unordered-containers >= 0.2,- utf8-string == 0.3.*,+ utf8-string >= 0.3 && < 1.1, vector >= 0.10, xml-conduit >= 1.2 && <1.3 @@ -186,6 +186,24 @@ Executable MultipartUpload Main-is: MultipartUpload.hs+ Hs-source-dirs: Examples++ if !flag(Examples)+ Buildable: False+ else+ Buildable: True+ Build-depends:+ base == 4.*,+ aws,+ http-conduit,+ conduit,+ conduit-extra,+ text++ Default-Language: Haskell2010++Executable MultipartTransfer+ Main-is: MultipartTransfer.hs Hs-source-dirs: Examples if !flag(Examples)