aws 0.24.2 → 0.24.3
raw patch · 7 files changed
+83/−3 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Aws.S3.Commands.GetBucketVersioning: GetBucketVersioning :: Bucket -> GetBucketVersioning
+ Aws.S3.Commands.GetBucketVersioning: GetBucketVersioningResponse :: Maybe VersioningState -> GetBucketVersioningResponse
+ Aws.S3.Commands.GetBucketVersioning: VersioningEnabled :: VersioningState
+ Aws.S3.Commands.GetBucketVersioning: VersioningSuspended :: VersioningState
+ Aws.S3.Commands.GetBucketVersioning: [gbvBucket] :: GetBucketVersioning -> Bucket
+ Aws.S3.Commands.GetBucketVersioning: [gbvVersioning] :: GetBucketVersioningResponse -> Maybe VersioningState
+ Aws.S3.Commands.GetBucketVersioning: data GetBucketVersioning
+ Aws.S3.Commands.GetBucketVersioning: data GetBucketVersioningResponse
+ Aws.S3.Commands.GetBucketVersioning: data VersioningState
+ Aws.S3.Commands.GetBucketVersioning: getBucketVersioning :: Bucket -> GetBucketVersioning
+ Aws.S3.Commands.GetBucketVersioning: instance Aws.Core.AsMemoryResponse Aws.S3.Commands.GetBucketVersioning.GetBucketVersioningResponse
+ Aws.S3.Commands.GetBucketVersioning: instance Aws.Core.ResponseConsumer r Aws.S3.Commands.GetBucketVersioning.GetBucketVersioningResponse
+ Aws.S3.Commands.GetBucketVersioning: instance Aws.Core.SignQuery Aws.S3.Commands.GetBucketVersioning.GetBucketVersioning
+ Aws.S3.Commands.GetBucketVersioning: instance Aws.Core.Transaction Aws.S3.Commands.GetBucketVersioning.GetBucketVersioning Aws.S3.Commands.GetBucketVersioning.GetBucketVersioningResponse
+ Aws.S3.Commands.GetBucketVersioning: instance GHC.Show.Show Aws.S3.Commands.GetBucketVersioning.GetBucketVersioning
+ Aws.S3.Commands.GetBucketVersioning: instance GHC.Show.Show Aws.S3.Commands.GetBucketVersioning.GetBucketVersioningResponse
+ Aws.S3.Core: [s3UserAgent] :: S3Configuration qt -> Maybe Text
- Aws.S3.Core: S3Configuration :: Protocol -> ByteString -> Maybe ByteString -> RequestStyle -> Int -> Maybe ServerSideEncryption -> Bool -> NominalDiffTime -> S3SignVersion -> S3Configuration qt
+ Aws.S3.Core: S3Configuration :: Protocol -> ByteString -> Maybe ByteString -> RequestStyle -> Int -> Maybe ServerSideEncryption -> Bool -> NominalDiffTime -> S3SignVersion -> Maybe Text -> S3Configuration qt
Files
- Aws/S3/Commands.hs +2/−0
- Aws/S3/Commands/GetBucketVersioning.hs +65/−0
- Aws/S3/Core.hs +9/−2
- CHANGELOG.md +3/−0
- aws.cabal +2/−1
- tests/DynamoDb/Utils.hs +1/−0
- tests/Sqs/Main.hs +1/−0
Aws/S3/Commands.hs view
@@ -8,6 +8,7 @@ , module Aws.S3.Commands.GetBucket , module Aws.S3.Commands.GetBucketLocation , module Aws.S3.Commands.GetBucketObjectVersions+, module Aws.S3.Commands.GetBucketVersioning , module Aws.S3.Commands.GetObject , module Aws.S3.Commands.GetService , module Aws.S3.Commands.HeadObject@@ -26,6 +27,7 @@ import Aws.S3.Commands.GetBucket import Aws.S3.Commands.GetBucketLocation import Aws.S3.Commands.GetBucketObjectVersions+import Aws.S3.Commands.GetBucketVersioning import Aws.S3.Commands.GetObject import Aws.S3.Commands.GetService import Aws.S3.Commands.HeadObject
+ Aws/S3/Commands/GetBucketVersioning.hs view
@@ -0,0 +1,65 @@+module Aws.S3.Commands.GetBucketVersioning +( + module Aws.S3.Commands.GetBucketVersioning+, VersioningState(..)+) where++import Aws.Core+import Aws.S3.Commands.PutBucketVersioning (VersioningState(..))+import Aws.S3.Core+import Control.Monad.Trans.Resource (throwM)+import Network.HTTP.Types (toQuery)+import qualified Data.Text.Encoding as T+import Text.XML.Cursor (($.//))+import qualified Data.ByteString.Lazy.Char8 as B8++-- | Gets the versioning state of an existing bucket.+data GetBucketVersioning+ = GetBucketVersioning+ { gbvBucket :: Bucket+ }+ deriving (Show)++getBucketVersioning :: Bucket -> GetBucketVersioning+getBucketVersioning = GetBucketVersioning++data GetBucketVersioningResponse+ = GetBucketVersioningResponse+ { gbvVersioning :: Maybe VersioningState }+ -- ^ Nothing when the bucket is not versioned+ deriving (Show)++-- | ServiceConfiguration: 'S3Configuration'+instance SignQuery GetBucketVersioning where+ type ServiceConfiguration GetBucketVersioning = S3Configuration++ signQuery GetBucketVersioning{..} = s3SignQuery $ S3Query+ { s3QMethod = Get+ , s3QBucket = Just $ T.encodeUtf8 gbvBucket+ , s3QSubresources = toQuery [("versioning" :: B8.ByteString, Nothing :: Maybe B8.ByteString)]+ , s3QQuery = []+ , s3QContentType = Nothing+ , s3QContentMd5 = Nothing+ , s3QObject = Nothing+ , s3QAmzHeaders = []+ , s3QOtherHeaders = []+ , s3QRequestBody = Nothing+ }++instance ResponseConsumer r GetBucketVersioningResponse where+ type ResponseMetadata GetBucketVersioningResponse = S3Metadata++ responseConsumer _ _ = s3XmlResponseConsumer parse+ where parse cursor = do+ v <- case cursor $.// elContent "Status" of+ [] -> return Nothing+ ("Enabled":[]) -> return (Just VersioningEnabled)+ ("Suspended":[]) -> return (Just VersioningSuspended)+ _ -> throwM $ XmlException "Invalid Status"+ return GetBucketVersioningResponse { gbvVersioning = v }++instance Transaction GetBucketVersioning GetBucketVersioningResponse++instance AsMemoryResponse GetBucketVersioningResponse where+ type MemoryResponse GetBucketVersioningResponse = GetBucketVersioningResponse+ loadToMemory = return
Aws/S3/Core.hs view
@@ -77,6 +77,7 @@ , s3UseUri :: Bool , s3DefaultExpiry :: NominalDiffTime , s3SignVersion :: S3SignVersion+ , s3UserAgent :: Maybe T.Text } deriving (Show) @@ -125,6 +126,7 @@ , s3UseUri = uri , s3DefaultExpiry = 15*60 , s3SignVersion = S3SignV2+ , s3UserAgent = Nothing } s3v4 :: Protocol -> B.ByteString -> Bool -> S3SignPayloadMode -> S3Configuration qt@@ -139,6 +141,7 @@ , s3UseUri = uri , s3DefaultExpiry = 15*60 , s3SignVersion = S3SignV4 payload+ , s3UserAgent = Nothing } @@ -228,7 +231,7 @@ , sqContentType = s3QContentType , sqContentMd5 = s3QContentMd5 , sqAmzHeaders = amzHeaders- , sqOtherHeaders = s3QOtherHeaders+ , sqOtherHeaders = useragent ++ s3QOtherHeaders , sqBody = s3QRequestBody , sqStringToSign = stringToSign }@@ -297,6 +300,8 @@ , ("AWSAccessKeyId", accessKeyID signatureCredentials) , ("SignatureMethod", "HmacSHA256") , ("Signature", sig)] ++ iamTok+ + useragent = maybeToList $ (HTTP.hUserAgent,) . T.encodeUtf8 <$> s3UserAgent s3SignQuery sq@S3Query{..} sc@S3Configuration{ s3SignVersion = S3SignV4 signpayload, .. } sd@SignatureData{..} | isAnonymousCredentials signatureCredentials = s3SignQuery sq (sc { s3SignVersion = S3SignV2 }) sd@@ -312,7 +317,7 @@ , sqContentType = s3QContentType , sqContentMd5 = s3QContentMd5 , sqAmzHeaders = Map.toList amzHeaders- , sqOtherHeaders = s3QOtherHeaders+ , sqOtherHeaders = useragent ++ s3QOtherHeaders , sqBody = s3QRequestBody , sqStringToSign = stringToSign }@@ -384,6 +389,8 @@ (False, t) -> t (True, AbsoluteTimestamp time) -> AbsoluteExpires $ s3DefaultExpiry `addUTCTime` time (True, AbsoluteExpires time) -> AbsoluteExpires time+ + useragent = maybeToList $ (HTTP.hUserAgent,) . T.encodeUtf8 <$> s3UserAgent -- | Custom UriEncode function -- see <http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html>
CHANGELOG.md view
@@ -5,6 +5,9 @@ most users. I recommend using smart constructors and {} matching syntax whenever possible when interacting with aws types. +- 0.24.3+ - [breaking change] Added s3UserAgent constructor to S3Configuration+ - S3: Add GetBucketVersioning command - 0.24.2 - Support bytestring 0.12 - Support building with aeson 2.2, adding dependency on
aws.cabal view
@@ -1,5 +1,5 @@ Name: aws-Version: 0.24.2+Version: 0.24.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.md>. Homepage: http://github.com/aristidb/aws@@ -90,6 +90,7 @@ Aws.S3.Commands.GetBucket Aws.S3.Commands.GetBucketLocation Aws.S3.Commands.GetBucketObjectVersions+ Aws.S3.Commands.GetBucketVersioning Aws.S3.Commands.GetObject Aws.S3.Commands.GetService Aws.S3.Commands.HeadObject
tests/DynamoDb/Utils.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE TypeOperators #-} -- | -- Module: DynamoDb.Utils
tests/Sqs/Main.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE TypeOperators #-} -- | -- Module: Main