aws-general 0.2.1 → 0.2.2
raw patch · 5 files changed
+98/−50 lines, 5 filesdep +deepseqPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq
API changes (from Hackage documentation)
+ Aws.General: instance Constructor C1_0AccountId
+ Aws.General: instance Constructor C1_0Arn
+ Aws.General: instance Constructor C1_0CanonicalUserId
+ Aws.General: instance Constructor C1_0GeneralVersion
+ Aws.General: instance Constructor C1_0Region
+ Aws.General: instance Constructor C1_0ServiceNamespace
+ Aws.General: instance Constructor C1_0SignatureMethod
+ Aws.General: instance Constructor C1_0SignatureVersion
+ Aws.General: instance Constructor C1_10ServiceNamespace
+ Aws.General: instance Constructor C1_11ServiceNamespace
+ Aws.General: instance Constructor C1_12ServiceNamespace
+ Aws.General: instance Constructor C1_13ServiceNamespace
+ Aws.General: instance Constructor C1_14ServiceNamespace
+ Aws.General: instance Constructor C1_15ServiceNamespace
+ Aws.General: instance Constructor C1_16ServiceNamespace
+ Aws.General: instance Constructor C1_17ServiceNamespace
+ Aws.General: instance Constructor C1_18ServiceNamespace
+ Aws.General: instance Constructor C1_19ServiceNamespace
+ Aws.General: instance Constructor C1_1Region
+ Aws.General: instance Constructor C1_1ServiceNamespace
+ Aws.General: instance Constructor C1_1SignatureMethod
+ Aws.General: instance Constructor C1_1SignatureVersion
+ Aws.General: instance Constructor C1_20ServiceNamespace
+ Aws.General: instance Constructor C1_21ServiceNamespace
+ Aws.General: instance Constructor C1_22ServiceNamespace
+ Aws.General: instance Constructor C1_23ServiceNamespace
+ Aws.General: instance Constructor C1_24ServiceNamespace
+ Aws.General: instance Constructor C1_25ServiceNamespace
+ Aws.General: instance Constructor C1_26ServiceNamespace
+ Aws.General: instance Constructor C1_27ServiceNamespace
+ Aws.General: instance Constructor C1_28ServiceNamespace
+ Aws.General: instance Constructor C1_2Region
+ Aws.General: instance Constructor C1_2ServiceNamespace
+ Aws.General: instance Constructor C1_3Region
+ Aws.General: instance Constructor C1_3ServiceNamespace
+ Aws.General: instance Constructor C1_4Region
+ Aws.General: instance Constructor C1_4ServiceNamespace
+ Aws.General: instance Constructor C1_5Region
+ Aws.General: instance Constructor C1_5ServiceNamespace
+ Aws.General: instance Constructor C1_6Region
+ Aws.General: instance Constructor C1_6ServiceNamespace
+ Aws.General: instance Constructor C1_7Region
+ Aws.General: instance Constructor C1_7ServiceNamespace
+ Aws.General: instance Constructor C1_8Region
+ Aws.General: instance Constructor C1_8ServiceNamespace
+ Aws.General: instance Constructor C1_9ServiceNamespace
+ Aws.General: instance Datatype D1AccountId
+ Aws.General: instance Datatype D1Arn
+ Aws.General: instance Datatype D1CanonicalUserId
+ Aws.General: instance Datatype D1GeneralVersion
+ Aws.General: instance Datatype D1Region
+ Aws.General: instance Datatype D1ServiceNamespace
+ Aws.General: instance Datatype D1SignatureMethod
+ Aws.General: instance Datatype D1SignatureVersion
+ Aws.General: instance Generic AccountId
+ Aws.General: instance Generic Arn
+ Aws.General: instance Generic CanonicalUserId
+ Aws.General: instance Generic GeneralVersion
+ Aws.General: instance Generic Region
+ Aws.General: instance Generic ServiceNamespace
+ Aws.General: instance Generic SignatureMethod
+ Aws.General: instance Generic SignatureVersion
+ Aws.General: instance NFData AccountId
+ Aws.General: instance NFData Arn
+ Aws.General: instance NFData CanonicalUserId
+ Aws.General: instance NFData GeneralVersion
+ Aws.General: instance NFData Region
+ Aws.General: instance NFData ServiceNamespace
+ Aws.General: instance NFData SignatureMethod
+ Aws.General: instance NFData SignatureVersion
+ Aws.General: instance Selector S1_0_0Arn
+ Aws.General: instance Selector S1_0_1Arn
+ Aws.General: instance Selector S1_0_2Arn
+ Aws.General: instance Selector S1_0_3Arn
+ Aws.SignatureV4: instance Constructor C1_0CanonicalHeaders
+ Aws.SignatureV4: instance Constructor C1_0CanonicalRequest
+ Aws.SignatureV4: instance Constructor C1_0CanonicalUri
+ Aws.SignatureV4: instance Constructor C1_0CredentialScope
+ Aws.SignatureV4: instance Constructor C1_0HashedCanonicalRequest
+ Aws.SignatureV4: instance Constructor C1_0Signature
+ Aws.SignatureV4: instance Constructor C1_0SignatureV4Credentials
+ Aws.SignatureV4: instance Constructor C1_0SignedHeaders
+ Aws.SignatureV4: instance Constructor C1_0SigningKey
+ Aws.SignatureV4: instance Constructor C1_0StringToSign
+ Aws.SignatureV4: instance Datatype D1CanonicalHeaders
+ Aws.SignatureV4: instance Datatype D1CanonicalRequest
+ Aws.SignatureV4: instance Datatype D1CanonicalUri
+ Aws.SignatureV4: instance Datatype D1CredentialScope
+ Aws.SignatureV4: instance Datatype D1HashedCanonicalRequest
+ Aws.SignatureV4: instance Datatype D1Signature
+ Aws.SignatureV4: instance Datatype D1SignatureV4Credentials
+ Aws.SignatureV4: instance Datatype D1SignedHeaders
+ Aws.SignatureV4: instance Datatype D1SigningKey
+ Aws.SignatureV4: instance Datatype D1StringToSign
+ Aws.SignatureV4: instance Generic CanonicalHeaders
+ Aws.SignatureV4: instance Generic CanonicalRequest
+ Aws.SignatureV4: instance Generic CanonicalUri
+ Aws.SignatureV4: instance Generic CredentialScope
+ Aws.SignatureV4: instance Generic HashedCanonicalRequest
+ Aws.SignatureV4: instance Generic Signature
+ Aws.SignatureV4: instance Generic SignatureV4Credentials
+ Aws.SignatureV4: instance Generic SignedHeaders
+ Aws.SignatureV4: instance Generic SigningKey
+ Aws.SignatureV4: instance Generic StringToSign
+ Aws.SignatureV4: instance NFData CanonicalHeaders
+ Aws.SignatureV4: instance NFData CanonicalRequest
+ Aws.SignatureV4: instance NFData CanonicalUri
+ Aws.SignatureV4: instance NFData CredentialScope
+ Aws.SignatureV4: instance NFData HashedCanonicalRequest
+ Aws.SignatureV4: instance NFData Signature
+ Aws.SignatureV4: instance NFData SignedHeaders
+ Aws.SignatureV4: instance NFData SigningKey
+ Aws.SignatureV4: instance NFData StringToSign
+ Aws.SignatureV4: instance Selector S1_0_0CredentialScope
+ Aws.SignatureV4: instance Selector S1_0_0SignatureV4Credentials
+ Aws.SignatureV4: instance Selector S1_0_1CredentialScope
+ Aws.SignatureV4: instance Selector S1_0_1SignatureV4Credentials
+ Aws.SignatureV4: instance Selector S1_0_2CredentialScope
+ Aws.SignatureV4: instance Selector S1_0_2SignatureV4Credentials
+ Aws.SignatureV4: instance Selector S1_0_3SignatureV4Credentials
Files
- CHANGELOG.md +5/−0
- aws-general.cabal +4/−3
- constraints +27/−27
- src/Aws/General.hs +30/−10
- src/Aws/SignatureV4.hs +32/−10
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.2+=====++* Provide `NFData` instance for all suitable types.+ 0.2.1 =====
aws-general.cabal view
@@ -3,7 +3,7 @@ -- ------------------------------------------------------ -- Name: aws-general-Version: 0.2.1+Version: 0.2.2 Synopsis: Bindings for Amazon Web Services (AWS) General Reference description: Bindings for Amazon Web Services (AWS) General Reference including AWS Signature V4.@@ -18,7 +18,7 @@ License-file: LICENSE Author: Lars Kuhtz <lars@alephcloud.com> Maintainer: Lars Kuhtz <lars@alephcloud.com>-Copyright: Copyright (c) 2014 AlephCloud, Inc.+Copyright: Copyright (c) 2014-2015 AlephCloud, Inc. Category: Network, Web, AWS, Cloud, Distributed Computing Build-type: Simple @@ -38,7 +38,7 @@ source-repository this type: git location: https://github.com/alephcloud/hs-aws-general.git- tag: 0.2.1+ tag: 0.2.2 flag normalize-signature-v4-date Description:@@ -72,6 +72,7 @@ bytestring >= 0.10.0.2, case-insensitive >= 1.2, cryptohash >= 0.11,+ deepseq >= 1.3, hashable >= 1.2, http-types >= 0.8, parsers >= 0.11,
constraints view
@@ -1,40 +1,40 @@-constraints: QuickCheck ==2.7.6,+constraints: QuickCheck ==2.8, aeson ==0.8.0.2,- array ==0.5.0.0,- attoparsec ==0.12.1.2,- base ==4.7.0.1,+ array ==0.5.1.0,+ attoparsec ==0.12.1.5,+ base ==4.8.0.0, base16-bytestring ==0.1.1.6,- blaze-builder ==0.3.3.4,+ blaze-builder ==0.4.0.1, byteable ==0.1.1,- bytestring ==0.10.4.0,- case-insensitive ==1.2.0.3,+ bytestring ==0.10.6.0,+ case-insensitive ==1.2.0.4, charset ==0.3.7,- containers ==0.5.5.1,+ containers ==0.5.6.2, cryptohash ==0.11.6,- deepseq ==1.3.0.2,- dlist ==0.7.1,- ghc-prim ==0.3.1.0,- hashable ==1.2.3.1,- http-types ==0.8.5,- integer-gmp ==0.5.1.0,+ deepseq ==1.4.1.1,+ dlist ==0.7.1.1,+ ghc-prim ==0.4.0.0,+ hashable ==1.2.3.2,+ http-types ==0.8.6,+ integer-gmp ==1.0.0.0, mtl ==2.2.1, nats ==1,- old-locale ==1.0.0.6,- old-time ==1.1.0.2,- parsec ==3.1.7,+ old-locale ==1.0.0.7,+ old-time ==1.1.0.3,+ parsec ==3.1.9, parsers ==0.12.1.1,- pretty ==1.1.1.1,- primitive ==0.5.3.0,- quickcheck-instances ==0.3.10,+ pretty ==1.1.2.0,+ primitive ==0.5.4.0,+ quickcheck-instances ==0.3.11, random ==1.1, rts ==1.0,- scientific ==0.3.3.5,- semigroups ==0.16.0.1,- syb ==0.4.2,- template-haskell ==2.9.0.0,- text ==1.2.0.3,+ scientific ==0.3.3.8,+ semigroups ==0.16.2.2,+ syb ==0.4.4,+ template-haskell ==2.10.0.0,+ text ==1.2.0.4, tf-random ==0.5, time ==1.5.0.1,- transformers ==0.4.1.0,+ transformers ==0.4.2.0, unordered-containers ==0.2.5.1,- vector ==0.10.11.0+ vector ==0.10.12.3
src/Aws/General.hs view
@@ -1,7 +1,8 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-} -- | -- Module: Aws.General@@ -61,6 +62,7 @@ ) where import Control.Applicative+import Control.DeepSeq import Control.Monad import Data.Aeson (ToJSON(..), FromJSON(..), withText)@@ -72,6 +74,8 @@ import qualified Data.Text as T import Data.Typeable +import GHC.Generics+ import qualified Test.QuickCheck as Q import Test.QuickCheck.Instances () @@ -97,8 +101,10 @@ data GeneralVersion = GeneralVersion_1_0- deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)+ deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable, Generic) +instance NFData GeneralVersion+ generalVersionToText :: (IsString a) => GeneralVersion -> a generalVersionToText GeneralVersion_1_0 = "1.0" @@ -119,8 +125,10 @@ data SignatureVersion = SignatureVersion2 | SignatureVersion4- deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)+ deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable, Generic) +instance NFData SignatureVersion+ signatureVersionToText :: IsString a => SignatureVersion -> a signatureVersionToText SignatureVersion2 = "2" signatureVersionToText SignatureVersion4 = "4"@@ -144,8 +152,10 @@ data SignatureMethod = SignatureMethodSha1 | SignatureMethodSha256- deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)+ deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable, Generic) +instance NFData SignatureMethod+ signatureMethodToText :: IsString a => SignatureMethod -> a signatureMethodToText SignatureMethodSha1 = "HmacSHA1" signatureMethodToText SignatureMethodSha256 = "HmacSHA256"@@ -187,8 +197,10 @@ -- ^ To override the region settings with a custom service endpoint, e.g. -- for testing purpose - deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData Region+ regionToText :: (Monoid a, IsString a) => Region -> a regionToText ApNortheast1 = "ap-northeast-1" regionToText ApSoutheast1 = "ap-southeast-1"@@ -282,8 +294,10 @@ -- This is actually a 12 digit number. -- newtype AccountId = AccountId T.Text- deriving (Show, Read, Eq, Ord, IsString, Typeable)+ deriving (Show, Read, Eq, Ord, IsString, Typeable, Generic) +instance NFData AccountId+ accountIdToText :: (IsString a) => AccountId -> a accountIdToText (AccountId t) = fromString $ T.unpack t @@ -309,8 +323,10 @@ -- This is actually a long hexadecimal number -- newtype CanonicalUserId = CanonicalUserId T.Text- deriving (Show, Read, Eq, Ord, IsString, Typeable)+ deriving (Show, Read, Eq, Ord, IsString, Typeable, Generic) +instance NFData CanonicalUserId+ canonicalUserIdToText :: (IsString a) => CanonicalUserId -> a canonicalUserIdToText (CanonicalUserId t) = fromString $ T.unpack t @@ -367,8 +383,10 @@ | ServiceNamespaceSwf | ServiceNamespaceHost -- ^ For testing purposes (see <http://docs.aws.amazon.com/general/1.0/gr/signature-v4-test-suite.html>)- deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable)+ deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable, Generic) +instance NFData ServiceNamespace+ serviceNamespaceToText :: IsString a => ServiceNamespace -> a serviceNamespaceToText ServiceNamespaceAwsPortal = "aws-portal" serviceNamespaceToText ServiceNamespaceAutoscaling = "autoscaling"@@ -462,7 +480,9 @@ -- ^ expected to be non-empty. Elements are separated by only @:@. -- @/@ is not treated specially. }- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic)++instance NFData Arn arnToText :: (IsString a, Monoid a) => Arn -> a arnToText arn = "arn:aws"
src/Aws/SignatureV4.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-} @@ -100,6 +101,7 @@ import Control.Applicative import Control.Arrow hiding (left)+import Control.DeepSeq import Control.Monad.IO.Class import Crypto.Hash@@ -121,6 +123,8 @@ import Data.Time.Clock (UTCTime, getCurrentTime, utctDay) import Data.Typeable +import GHC.Generics+ import qualified Test.QuickCheck as Q import Test.QuickCheck.Instances () @@ -185,7 +189,7 @@ -- ^ used internally for caching the singing key , sigV4SecurityToken :: Maybe B.ByteString }- deriving (Typeable)+ deriving (Typeable, Generic) newCredentials :: (Functor m, MonadIO m)@@ -204,8 +208,10 @@ type UriQuery = HTTP.QueryText newtype CanonicalUri = CanonicalUri B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData CanonicalUri+ -- | Compute canonical URI -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html>@@ -256,8 +262,10 @@ -- Canonical Headers newtype CanonicalHeaders = CanonicalHeaders B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData CanonicalHeaders+ -- | Compute canonical HTTP headers -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html>@@ -366,8 +374,10 @@ -- Signed Headers newtype SignedHeaders = SignedHeaders B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData SignedHeaders+ -- | Compute signed headers -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html>@@ -383,8 +393,10 @@ -- Canonical Request newtype CanonicalRequest = CanonicalRequest B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData CanonicalRequest+ -- | Create Canonical Request for AWS Signature Version 4 -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html>@@ -417,8 +429,10 @@ -- The hash is stored hex encoded -- newtype HashedCanonicalRequest = HashedCanonicalRequest B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData HashedCanonicalRequest+ hashedCanonicalRequest :: CanonicalRequest -> HashedCanonicalRequest hashedCanonicalRequest (CanonicalRequest r) = HashedCanonicalRequest $ signingHash16 r@@ -431,8 +445,10 @@ , credentialScopeRegion :: !Region , credentialScopeService :: !ServiceNamespace }- deriving (Show, Read, Typeable)+ deriving (Show, Read, Typeable, Generic) +instance NFData CredentialScope+ instance Eq CredentialScope where CredentialScope a0 b0 c0 == CredentialScope a1 b1 c1 = utctDay a0 == utctDay a1@@ -487,8 +503,10 @@ -- String to Sign newtype StringToSign = StringToSign B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData StringToSign+ -- | Create the String to Sign for AWS Signature Version 4 -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-string-to-sign.html>@@ -517,8 +535,10 @@ -- to the same service and the region till 00:00:00 UTC time. -- newtype SigningKey = SigningKey B.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic) +instance NFData SigningKey+ -- | Derive the signing key -- -- <http://docs.aws.amazon.com/general/1.0/gr/sigv4-calculate-signature.html>@@ -543,7 +563,9 @@ -- Request Signature newtype Signature = Signature B8.ByteString- deriving (Show, Read, Eq, Ord, Typeable)+ deriving (Show, Read, Eq, Ord, Typeable, Generic)++instance NFData Signature -- | Compute an AWS Signature Version 4 --