summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendanHay <>2018-05-16 14:30:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-05-16 14:30:00 (GMT)
commitd522fe029b7c7bbc6acab8ff27d41c380d13506f (patch)
tree29bb30154743de41fe00e86871d1b57d93440391
parentdb664137fce7eb42124926358014d9e3cb64b42b (diff)
version 1.6.01.6.0
-rw-r--r--amazonka-core.cabal9
-rw-r--r--src/Network/AWS/Compat/Locale.hs2
-rw-r--r--src/Network/AWS/Compat/Time.hs2
-rw-r--r--src/Network/AWS/Data/Base64.hs2
-rw-r--r--src/Network/AWS/Data/Body.hs18
-rw-r--r--src/Network/AWS/Data/ByteString.hs2
-rw-r--r--src/Network/AWS/Data/Crypto.hs2
-rw-r--r--src/Network/AWS/Data/Headers.hs2
-rw-r--r--src/Network/AWS/Data/JSON.hs2
-rw-r--r--src/Network/AWS/Data/List1.hs3
-rw-r--r--src/Network/AWS/Data/Log.hs10
-rw-r--r--src/Network/AWS/Data/Map.hs5
-rw-r--r--src/Network/AWS/Data/Numeric.hs3
-rw-r--r--src/Network/AWS/Data/Path.hs12
-rw-r--r--src/Network/AWS/Data/Query.hs31
-rw-r--r--src/Network/AWS/Data/Sensitive.hs6
-rw-r--r--src/Network/AWS/Data/Text.hs3
-rw-r--r--src/Network/AWS/Data/Time.hs86
-rw-r--r--src/Network/AWS/Data/XML.hs27
-rw-r--r--src/Network/AWS/Endpoint.hs2
-rw-r--r--src/Network/AWS/Error.hs9
-rw-r--r--src/Network/AWS/Lens.hs2
-rw-r--r--src/Network/AWS/Pager.hs3
-rw-r--r--src/Network/AWS/Prelude.hs75
-rw-r--r--src/Network/AWS/Request.hs2
-rw-r--r--src/Network/AWS/Response.hs76
-rw-r--r--src/Network/AWS/Sign/V2.hs3
-rw-r--r--src/Network/AWS/Sign/V4.hs3
-rw-r--r--src/Network/AWS/Sign/V4/Base.hs4
-rw-r--r--src/Network/AWS/Sign/V4/Chunked.hs6
-rw-r--r--src/Network/AWS/Types.hs22
-rw-r--r--src/Network/AWS/Waiter.hs3
-rw-r--r--test/Main.hs2
-rw-r--r--test/Test/AWS/Arbitrary.hs2
-rw-r--r--test/Test/AWS/Data/Base64.hs2
-rw-r--r--test/Test/AWS/Data/List.hs2
-rw-r--r--test/Test/AWS/Data/Maybe.hs2
-rw-r--r--test/Test/AWS/Data/Numeric.hs2
-rw-r--r--test/Test/AWS/Data/Path.hs2
-rw-r--r--test/Test/AWS/Data/Query.hs2
-rw-r--r--test/Test/AWS/Data/Time.hs2
-rw-r--r--test/Test/AWS/Error.hs2
-rw-r--r--test/Test/AWS/Sign/V4.hs2
-rw-r--r--test/Test/AWS/Sign/V4/Chunked.hs2
-rw-r--r--test/Test/AWS/Util.hs2
45 files changed, 255 insertions, 208 deletions
diff --git a/amazonka-core.cabal b/amazonka-core.cabal
index 1d669c0..3a533e1 100644
--- a/amazonka-core.cabal
+++ b/amazonka-core.cabal
@@ -1,5 +1,5 @@
name: amazonka-core
-version: 1.5.0
+version: 1.6.0
synopsis: Core data types and functionality for Amazonka libraries.
homepage: https://github.com/brendanhay/amazonka
bug-reports: https://github.com/brendanhay/amazonka/issues
@@ -90,8 +90,9 @@ library
, deepseq >= 1.4
, exceptions >= 0.6
, hashable >= 1.2
- , http-conduit >= 2.2 && < 3
- , http-types >= 0.8
+ , http-client >= 0.4 && < 0.6
+ , http-conduit >= 2.1.4 && < 3
+ , http-types >= 0.8 && (<0.11 || >=0.12)
, lens >= 4.4
, memory >= 0.6
, mtl >= 2.1.3.1
@@ -103,7 +104,7 @@ library
, transformers >= 0.2
, transformers-compat >= 0.3
, unordered-containers >= 0.2.7
- , xml-conduit >= 1.2
+ , xml-conduit >= 1.7.0.1
, xml-types >= 0.3.4
if !impl(ghc>=7.9)
diff --git a/src/Network/AWS/Compat/Locale.hs b/src/Network/AWS/Compat/Locale.hs
index 8b4ac6f..20b528b 100644
--- a/src/Network/AWS/Compat/Locale.hs
+++ b/src/Network/AWS/Compat/Locale.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Network.AWS.Compat.Locale
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Compat/Time.hs b/src/Network/AWS/Compat/Time.hs
index b288f5c..de7921d 100644
--- a/src/Network/AWS/Compat/Time.hs
+++ b/src/Network/AWS/Compat/Time.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Network.AWS.Compat.Time
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/Base64.hs b/src/Network/AWS/Data/Base64.hs
index cc59b83..69557f5 100644
--- a/src/Network/AWS/Data/Base64.hs
+++ b/src/Network/AWS/Data/Base64.hs
@@ -4,7 +4,7 @@
-- |
-- Module : Network.AWS.Data.Base64
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/Body.hs b/src/Network/AWS/Data/Body.hs
index 13c6dab..addb384 100644
--- a/src/Network/AWS/Data/Body.hs
+++ b/src/Network/AWS/Data/Body.hs
@@ -12,7 +12,7 @@
-- |
-- Module : Network.AWS.Data.Body
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -48,16 +48,16 @@ default (Builder)
-- | A streaming, exception safe response body.
newtype RsBody = RsBody
- { _streamBody :: ResumableSource (ResourceT IO) ByteString
+ { _streamBody :: ConduitM () ByteString (ResourceT IO) ()
} -- newtype for show/orhpan instance purposes.
instance Show RsBody where
- show = const "RsBody { ResumableSource (ResourceT IO) ByteString }"
+ show = const "RsBody { ConduitM () ByteString (ResourceT IO) () }"
fuseStream :: RsBody
- -> Conduit ByteString (ResourceT IO) ByteString
+ -> ConduitM ByteString ByteString (ResourceT IO) ()
-> RsBody
-fuseStream b f = b { _streamBody = _streamBody b $=+ f }
+fuseStream b f = b { _streamBody = _streamBody b .| f }
-- | Specifies the transmitted size of the 'Transfer-Encoding' chunks.
--
@@ -84,7 +84,7 @@ defaultChunkSize = 128 * 1024
data ChunkedBody = ChunkedBody
{ _chunkedSize :: !ChunkSize
, _chunkedLength :: !Integer
- , _chunkedBody :: Source (ResourceT IO) ByteString
+ , _chunkedBody :: ConduitM () ByteString (ResourceT IO) ()
}
chunkedLength :: Lens' ChunkedBody Integer
@@ -106,9 +106,9 @@ instance Show ChunkedBody where
<> "}"
fuseChunks :: ChunkedBody
- -> Conduit ByteString (ResourceT IO) ByteString
+ -> ConduitM ByteString ByteString (ResourceT IO) ()
-> ChunkedBody
-fuseChunks c f = c { _chunkedBody = _chunkedBody c =$= f }
+fuseChunks c f = c { _chunkedBody = _chunkedBody c .| f }
fullChunks :: ChunkedBody -> Integer
fullChunks c = _chunkedLength c `div` fromIntegral (_chunkedSize c)
@@ -121,7 +121,7 @@ remainderBytes c =
-- | An opaque request body containing a 'SHA256' hash.
data HashedBody
- = HashedStream (Digest SHA256) !Integer (Source (ResourceT IO) ByteString)
+ = HashedStream (Digest SHA256) !Integer (ConduitM () ByteString (ResourceT IO) ())
| HashedBytes (Digest SHA256) ByteString
instance Show HashedBody where
diff --git a/src/Network/AWS/Data/ByteString.hs b/src/Network/AWS/Data/ByteString.hs
index 5238631..9683909 100644
--- a/src/Network/AWS/Data/ByteString.hs
+++ b/src/Network/AWS/Data/ByteString.hs
@@ -7,7 +7,7 @@
-- |
-- Module : Network.AWS.Data.ByteString
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/Crypto.hs b/src/Network/AWS/Data/Crypto.hs
index 037a15d..f0663a4 100644
--- a/src/Network/AWS/Data/Crypto.hs
+++ b/src/Network/AWS/Data/Crypto.hs
@@ -5,7 +5,7 @@
-- |
-- Module : Network.AWS.Data.Crypto
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/Headers.hs b/src/Network/AWS/Data/Headers.hs
index 2780e34..6db4218 100644
--- a/src/Network/AWS/Data/Headers.hs
+++ b/src/Network/AWS/Data/Headers.hs
@@ -6,7 +6,7 @@
-- |
-- Module : Network.AWS.Data.Headers
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/JSON.hs b/src/Network/AWS/Data/JSON.hs
index f1bb007..a3b11b0 100644
--- a/src/Network/AWS/Data/JSON.hs
+++ b/src/Network/AWS/Data/JSON.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Network.AWS.Data.JSON
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Data/List1.hs b/src/Network/AWS/Data/List1.hs
index 5c65943..2a18a26 100644
--- a/src/Network/AWS/Data/List1.hs
+++ b/src/Network/AWS/Data/List1.hs
@@ -7,7 +7,7 @@
-- |
-- Module : Network.AWS.Data.List1
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -15,7 +15,6 @@
--
module Network.AWS.Data.List1 where
-import Control.Applicative
import Control.DeepSeq
import Control.Monad
import Data.Aeson
diff --git a/src/Network/AWS/Data/Log.hs b/src/Network/AWS/Data/Log.hs
index e9c020e..b0a297c 100644
--- a/src/Network/AWS/Data/Log.hs
+++ b/src/Network/AWS/Data/Log.hs
@@ -2,12 +2,13 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fsimpl-tick-factor=110 #-}
-- |
-- Module : Network.AWS.Data.Log
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -120,8 +121,11 @@ instance ToLog RequestBody where
instance ToLog HttpException where
build x = "[HttpException] {\n" <> build (show x) <> "\n}"
+#if MIN_VERSION_http_client(0,5,0)
instance ToLog HttpExceptionContent where
build x = "[HttpExceptionContent] {\n" <> build (show x) <> "\n}"
+#endif
+
instance ToLog Request where
build x = buildLines
@@ -130,7 +134,11 @@ instance ToLog Request where
, " secure = " <> build (secure x)
, " method = " <> build (method x)
, " target = " <> build target
+#if MIN_VERSION_http_client(0,5,0)
, " timeout = " <> build (show (responseTimeout x))
+#else
+ , " timeout = " <> build (responseTimeout x)
+#endif
, " redirects = " <> build (redirectCount x)
, " path = " <> build (path x)
, " query = " <> build (queryString x)
diff --git a/src/Network/AWS/Data/Map.hs b/src/Network/AWS/Data/Map.hs
index a6be81a..196575b 100644
--- a/src/Network/AWS/Data/Map.hs
+++ b/src/Network/AWS/Data/Map.hs
@@ -9,7 +9,7 @@
-- |
-- Module : Network.AWS.Data.Map
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -23,7 +23,6 @@ module Network.AWS.Data.Map
, toQueryMap
) where
-import Control.Applicative
import Control.DeepSeq
import Data.Aeson
import Data.Bifunctor
@@ -31,14 +30,12 @@ import qualified Data.ByteString as BS
import qualified Data.CaseInsensitive as CI
import Data.Coerce
import Data.Data (Data, Typeable)
-import Data.Foldable hiding (toList)
import Data.Hashable
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as Map
import Data.Maybe
import Data.Semigroup
import qualified Data.Text.Encoding as Text
-import Data.Traversable
import GHC.Exts
import GHC.Generics (Generic)
import Network.AWS.Data.ByteString
diff --git a/src/Network/AWS/Data/Numeric.hs b/src/Network/AWS/Data/Numeric.hs
index 47bccf0..b98ef63 100644
--- a/src/Network/AWS/Data/Numeric.hs
+++ b/src/Network/AWS/Data/Numeric.hs
@@ -5,7 +5,7 @@
-- |
-- Module : Network.AWS.Data.Numeric
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -18,7 +18,6 @@ import Control.Monad
import Data.Aeson.Types
import Data.Data (Data, Typeable)
import Data.Hashable
-import Data.Monoid
import Data.Scientific
import GHC.Generics (Generic)
import Network.AWS.Data.ByteString
diff --git a/src/Network/AWS/Data/Path.hs b/src/Network/AWS/Data/Path.hs
index 7ee864f..7a15b6e 100644
--- a/src/Network/AWS/Data/Path.hs
+++ b/src/Network/AWS/Data/Path.hs
@@ -8,7 +8,7 @@
-- |
-- Module : Network.AWS.Data.Path
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -31,7 +31,8 @@ module Network.AWS.Data.Path
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
-import Data.Monoid
+import Data.Monoid (Monoid)
+import Data.Semigroup (Semigroup, (<>))
import Network.AWS.Data.ByteString
import Network.AWS.Data.Text
import Network.HTTP.Types.URI
@@ -65,9 +66,12 @@ deriving instance Eq (Path a)
type RawPath = Path 'NoEncoding
type EscapedPath = Path 'Percent
+instance Semigroup RawPath where
+ Raw xs <> Raw ys = Raw (xs ++ ys)
+
instance Monoid RawPath where
- mempty = Raw []
- mappend (Raw xs) (Raw ys) = Raw (xs ++ ys)
+ mempty = Raw []
+ mappend = (<>)
instance ToByteString EscapedPath where
toBS (Encoded []) = slash
diff --git a/src/Network/AWS/Data/Query.hs b/src/Network/AWS/Data/Query.hs
index 0b23edb..0179a15 100644
--- a/src/Network/AWS/Data/Query.hs
+++ b/src/Network/AWS/Data/Query.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
@@ -11,7 +12,7 @@
-- |
-- Module : Network.AWS.Data.Query
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -26,7 +27,8 @@ import qualified Data.ByteString.Lazy as LBS
import Data.Data
import Data.List (sort)
import Data.Maybe (fromMaybe)
-import Data.Monoid
+import Data.Monoid (Monoid)
+import Data.Semigroup (Semigroup, (<>))
import Data.String
import qualified Data.Text.Encoding as Text
import GHC.Exts
@@ -41,14 +43,16 @@ data QueryString
| QValue (Maybe ByteString)
deriving (Eq, Show, Data, Typeable)
+instance Semigroup QueryString where
+ a <> b = case (a, b) of
+ (QList l, QList r) -> QList (l ++ r)
+ (QList l, r) -> QList (r : l)
+ (l, QList r) -> QList (l : r)
+ (l, r) -> QList [l, r]
+
instance Monoid QueryString where
mempty = QList []
-
- mappend a b = case (a, b) of
- (QList l, QList r) -> QList (l ++ r)
- (QList l, r) -> QList (r : l)
- (l, QList r) -> QList (l : r)
- (l, r) -> QList [l, r]
+ mappend = (<>)
instance IsString QueryString where
fromString = parseQueryString . fromString
@@ -70,7 +74,16 @@ parseQueryString bs
case x of
"" -> QValue Nothing
"=" -> QValue Nothing
- _ -> QValue (Just (fromMaybe x (BS8.stripPrefix "=" x)))
+ _ -> QValue (Just (fromMaybe x (stripPrefix "=" x)))
+
+stripPrefix :: ByteString -> ByteString -> Maybe ByteString
+#if MIN_VERSION_bytestring(0,10,8)
+stripPrefix = BS8.stripPrefix
+#else
+stripPrefix bs1 bs2
+ | bs1 `BS8.isPrefixOf` bs2 = Just (BS8.drop (BS8.length bs1) bs2)
+ | otherwise = Nothing
+#endif
-- FIXME: use Builder
instance ToByteString QueryString where
diff --git a/src/Network/AWS/Data/Sensitive.hs b/src/Network/AWS/Data/Sensitive.hs
index 10f8f4e..893443e 100644
--- a/src/Network/AWS/Data/Sensitive.hs
+++ b/src/Network/AWS/Data/Sensitive.hs
@@ -5,7 +5,7 @@
-- |
-- Module : Network.AWS.Data.Sensitive
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -16,7 +16,8 @@ module Network.AWS.Data.Sensitive where
import Control.DeepSeq
import Data.Data (Data, Typeable)
import Data.Hashable
-import Data.Monoid
+import Data.Monoid (Monoid)
+import Data.Semigroup (Semigroup)
import Data.String
import GHC.Generics (Generic)
@@ -36,6 +37,7 @@ newtype Sensitive a = Sensitive { desensitise :: a }
( Eq
, Ord
, IsString
+ , Semigroup
, Monoid
, Data
, Typeable
diff --git a/src/Network/AWS/Data/Text.hs b/src/Network/AWS/Data/Text.hs
index 22097e2..768844f 100644
--- a/src/Network/AWS/Data/Text.hs
+++ b/src/Network/AWS/Data/Text.hs
@@ -6,7 +6,7 @@
-- |
-- Module : Network.AWS.Data.Text
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -28,7 +28,6 @@ module Network.AWS.Data.Text
, showText
) where
-import Control.Applicative
import Data.Attoparsec.Text (Parser)
import qualified Data.Attoparsec.Text as A
import Data.ByteString (ByteString)
diff --git a/src/Network/AWS/Data/Time.hs b/src/Network/AWS/Data/Time.hs
index 23576ed..9f41866 100644
--- a/src/Network/AWS/Data/Time.hs
+++ b/src/Network/AWS/Data/Time.hs
@@ -3,17 +3,17 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE ViewPatterns #-}
-- |
-- Module : Network.AWS.Data.Time
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -43,7 +43,6 @@ import qualified Data.Attoparsec.Text as AText
import qualified Data.ByteString.Char8 as BS
import Data.Data (Data, Typeable)
import Data.Hashable
-import Data.Monoid
import Data.Scientific
import Data.Tagged
import qualified Data.Text as Text
@@ -74,16 +73,8 @@ deriving instance Typeable 'BasicFormat
deriving instance Typeable 'AWSFormat
deriving instance Typeable 'POSIXFormat
-data Time :: Format -> * where
- Time :: UTCTime -> Time a
- deriving (Data, Typeable, Generic)
-
-deriving instance Eq (Time a)
-deriving instance Ord (Time a)
-deriving instance Read (Time a)
-deriving instance Show (Time a)
-
-instance NFData (Time a)
+newtype Time (a :: Format) = Time { fromTime :: UTCTime }
+ deriving (Show, Read, Eq, Ord, Data, Typeable, Generic, NFData)
instance Hashable (Time a) where
hashWithSalt salt (Time (UTCTime (ModifiedJulianDay d) t)) =
@@ -91,10 +82,10 @@ instance Hashable (Time a) where
`hashWithSalt` toRational t
_Time :: Iso' (Time a) UTCTime
-_Time = iso (\(Time t) -> t) Time
+_Time = iso fromTime Time
convert :: Time a -> Time b
-convert (Time t) = Time t
+convert = Time . fromTime
type RFC822 = Time 'RFC822Format
type ISO8601 = Time 'ISO8601Format
@@ -110,36 +101,41 @@ instance TimeFormat ISO8601 where format = Tagged (iso8601DateFormat (Just "%X
instance TimeFormat BasicTime where format = Tagged "%Y%m%d"
instance TimeFormat AWSTime where format = Tagged "%Y%m%dT%H%M%SZ"
-instance FromText BasicTime where parser = parseFormattedTime
-instance FromText AWSTime where parser = parseFormattedTime
-
-instance FromText RFC822 where
- parser = (convert :: ISO8601 -> RFC822) <$> parseFormattedTime
- <|> parseFormattedTime
-
-instance FromText ISO8601 where
- parser = (convert :: RFC822 -> ISO8601) <$> parseFormattedTime
- <|> parseFormattedTime
- -- Deprecated, but ensure compatibility with examples until further investigation can be done
- <|> parseFormattedTime' (Tagged $ iso8601DateFormat (Just "%X%Q%Z"))
-
-parseFormattedTime :: forall a. TimeFormat (Time a) => Parser (Time a)
-parseFormattedTime = parseFormattedTime' format
-
-parseFormattedTime' :: Tagged (Time a) String -> Parser (Time a)
-parseFormattedTime' f = do
- x <- Text.unpack <$> AText.takeText
- p (parseTime defaultTimeLocale (untag f) x) x
- where
- p :: Maybe UTCTime -> String -> Parser (Time a)
- p (Just x) _ = return (Time x)
- p Nothing s = fail $ mconcat
- [ "Failure parsing Date format "
- , untag f
- , " from value: '"
- , s
- , "'"
- ]
+instance FromText BasicTime where parser = parseUnixTimestamp <|> parseFormattedTime
+instance FromText AWSTime where parser = parseUnixTimestamp <|> parseFormattedTime
+instance FromText RFC822 where parser = parseUnixTimestamp <|> parseFormattedTime
+instance FromText ISO8601 where parser = parseUnixTimestamp <|> parseFormattedTime
+instance FromText POSIX where parser = parseUnixTimestamp <|> parseFormattedTime
+
+parseFormattedTime :: Parser (Time a)
+parseFormattedTime = do
+ s <- Text.unpack <$> AText.takeText
+
+ let parse :: Tagged b String -> Parser (Time a)
+ parse (untag -> fmt) =
+ case parseTime defaultTimeLocale fmt s of
+ Just x -> pure (Time x)
+ Nothing ->
+ fail ( "Unable to parse Time format "
+ ++ show fmt
+ ++ " from "
+ ++ show s
+ )
+
+ parse (format :: Tagged RFC822 String)
+ <|> parse (format :: Tagged ISO8601 String)
+ <|> parse (format :: Tagged BasicTime String)
+ <|> parse (format :: Tagged AWSTime String)
+ -- Deprecated ISO8601 format exhibited in the AWS-supplied examples.
+ <|> parse (Tagged $ iso8601DateFormat (Just "%X%Q%Z"))
+ -- Exhaustive Failure
+ <|> fail ("Failure parsing Time from value: " ++ show s)
+
+parseUnixTimestamp :: Parser (Time a)
+parseUnixTimestamp =
+ Time . posixSecondsToUTCTime . realToFrac
+ <$> AText.double <* AText.endOfInput
+ <|> fail "Failure parsing Unix Timestamp"
instance ToText RFC822 where toText = Text.pack . renderFormattedTime
instance ToText ISO8601 where toText = Text.pack . renderFormattedTime
diff --git a/src/Network/AWS/Data/XML.hs b/src/Network/AWS/Data/XML.hs
index 70f7b64..9181750 100644
--- a/src/Network/AWS/Data/XML.hs
+++ b/src/Network/AWS/Data/XML.hs
@@ -8,7 +8,7 @@
-- |
-- Module : Network.AWS.Data.XML
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -16,14 +16,14 @@
--
module Network.AWS.Data.XML where
-import Control.Applicative
import Control.Monad
import Data.Bifunctor
import Data.Conduit
import Data.Conduit.Lazy (lazyConsume)
import Data.Maybe
-import Data.Monoid
+import Data.Monoid (Monoid)
+import Data.Semigroup (Semigroup, (<>))
import Data.Traversable (traverse)
import Data.XML.Types (Event (..))
@@ -77,9 +77,9 @@ decodeXML lbs =
-- by the process.'
encodeXML :: ToElement a => a -> LazyByteString
encodeXML x = LBS.fromChunks . unsafePerformIO . lazyConsume
- $ Conduit.sourceList (toEvents doc)
- =$= Conduit.map rename
- =$= Stream.renderBytes def
+ $ Conduit.sourceList (toEvents doc)
+ .| Conduit.map rename
+ .| Stream.renderBytes def
where
doc = toXMLDocument $ Document
{ documentRoot = root
@@ -147,15 +147,18 @@ data XML
| XMany [(Name, Text)] [Node]
deriving (Show)
-instance Monoid XML where
- mempty = XNull
- mappend XNull XNull = XNull
- mappend a XNull = a
- mappend XNull b = b
- mappend a b =
+instance Semigroup XML where
+ XNull <> XNull = XNull
+ a <> XNull = a
+ XNull <> b = b
+ a <> b =
XMany (listXMLAttributes a <> listXMLAttributes b)
(listXMLNodes a <> listXMLNodes b)
+instance Monoid XML where
+ mempty = XNull
+ mappend = (<>)
+
listXMLNodes :: XML -> [Node]
listXMLNodes = \case
XNull -> []
diff --git a/src/Network/AWS/Endpoint.hs b/src/Network/AWS/Endpoint.hs
index 3b724c8..04fa39c 100644
--- a/src/Network/AWS/Endpoint.hs
+++ b/src/Network/AWS/Endpoint.hs
@@ -5,7 +5,7 @@
-- |
-- Module : Network.AWS.Types
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Error.hs b/src/Network/AWS/Error.hs
index dae1701..bc43d74 100644
--- a/src/Network/AWS/Error.hs
+++ b/src/Network/AWS/Error.hs
@@ -1,10 +1,11 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE CPP #-}
-- |
-- Module : Network.AWS.Error
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -63,10 +64,14 @@ httpStatus :: AsError a => Getting (First Status) a Status
httpStatus = _Error . f
where
f g = \case
+#if MIN_VERSION_http_client(0,5,0)
TransportError (HttpExceptionRequest rq (StatusCodeException rs b))
-> (\x -> TransportError (HttpExceptionRequest rq (StatusCodeException (rs { responseStatus = x }) b)))
<$> g (responseStatus rs)
-
+#else
+ TransportError (StatusCodeException s h c)
+ -> TransportError <$> (StatusCodeException <$> g s <*> pure h <*> pure c)
+#endif
TransportError e
-> pure (TransportError e)
diff --git a/src/Network/AWS/Lens.hs b/src/Network/AWS/Lens.hs
index c06310d..85e7d6f 100644
--- a/src/Network/AWS/Lens.hs
+++ b/src/Network/AWS/Lens.hs
@@ -1,6 +1,6 @@
-- |
-- Module : Network.AWS.Lens
--- Copyright : (c) 2013-2017 Brendan Hay <brendan.g.hay+amazonka@gmail.com>
+-- Copyright : (c) 2013-2018 Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Pager.hs b/src/Network/AWS/Pager.hs
index e6aec9f..8e39ed0 100644
--- a/src/Network/AWS/Pager.hs
+++ b/src/Network/AWS/Pager.hs
@@ -3,7 +3,7 @@
-- |
-- Module : Network.AWS.Pager
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -19,7 +19,6 @@ module Network.AWS.Pager
import Control.Applicative
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as Map
-import Data.List.NonEmpty (NonEmpty)
import Data.Maybe (isJust, fromMaybe)
import Data.Text (Text)
import Network.AWS.Data.Text (ToText (..))
diff --git a/src/Network/AWS/Prelude.hs b/src/Network/AWS/Prelude.hs
index e77a0f7..ad56261 100644
--- a/src/Network/AWS/Prelude.hs
+++ b/src/Network/AWS/Prelude.hs
@@ -1,6 +1,6 @@
-- |
-- Module : Network.AWS.Prelude
--- Copyright : (c) 2013-2017 Brendan Hay <brendan.g.hay+amazonka@gmail.com>
+-- Copyright : (c) 2013-2018 Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -11,43 +11,44 @@ module Network.AWS.Prelude
, module Export
) where
-import Control.Applicative as Export (Applicative, pure)
-import Control.Applicative as Export ((<$>), (<*>), (<|>))
-import Control.DeepSeq as Export (NFData)
-import Data.Data as Export (Data, Typeable)
-import Data.Foldable as Export (Foldable)
-import Data.Hashable as Export (Hashable)
-import Data.HashMap.Strict as Export (HashMap)
-import Data.List.NonEmpty as Export (NonEmpty (..))
-import Data.Maybe as Export
-import Data.Monoid as Export (First, mconcat, mempty)
-import Data.Monoid as Export ((<>))
-import GHC.Generics as Export (Generic)
-import Network.HTTP.Types.Status as Export (Status (..))
-import Network.HTTP.Types.URI as Export (urlDecode, urlEncode)
-import Numeric.Natural as Export (Natural)
+import Control.Applicative as Export (Applicative, pure)
+import Control.Applicative as Export ((<$>), (<*>), (<|>))
+import Control.DeepSeq as Export (NFData)
+import Data.Data as Export (Data, Typeable)
+import Data.Foldable as Export (Foldable)
+import Data.Hashable as Export (Hashable)
+import Data.HashMap.Strict as Export (HashMap)
+import Data.List.NonEmpty as Export (NonEmpty (..))
+import Data.Maybe as Export
+import Data.Monoid as Export (First, mconcat, mempty)
+import Data.Monoid as Export ((<>))
+import GHC.Generics as Export (Generic)
+import Network.HTTP.Types.Status as Export (Status (..))
+import Network.HTTP.Types.URI as Export (urlDecode, urlEncode)
+import Numeric.Natural as Export (Natural)
-import Network.AWS.Data.Base64 as Export
-import Network.AWS.Data.Body as Export
-import Network.AWS.Data.ByteString as Export
-import Network.AWS.Data.Crypto as Export hiding (Base (..))
-import Network.AWS.Data.Headers as Export
-import Network.AWS.Data.JSON as Export
-import Network.AWS.Data.List1 as Export
-import Network.AWS.Data.Map as Export
-import Network.AWS.Data.Numeric as Export
-import Network.AWS.Data.Path as Export
-import Network.AWS.Data.Query as Export
-import Network.AWS.Data.Sensitive as Export
-import Network.AWS.Data.Text as Export
-import Network.AWS.Data.Time as Export
-import Network.AWS.Data.XML as Export
-import Network.AWS.Endpoint as Export
-import Network.AWS.Error as Export
-import Network.AWS.Types as Export hiding (Algorithm,
- Endpoint, LogLevel (..),
- Seconds, Signer,
- serviceEndpoint)
+import Network.AWS.Data.Base64 as Export
+import Network.AWS.Data.Body as Export
+import Network.AWS.Data.ByteString as Export
+import Network.AWS.Data.Crypto as Export hiding (Base (..))
+import Network.AWS.Data.Headers as Export
+import Network.AWS.Data.JSON as Export
+import Network.AWS.Data.List1 as Export
+import Network.AWS.Data.Map as Export
+import Network.AWS.Data.Numeric as Export
+import Network.AWS.Data.Path as Export
+import Network.AWS.Data.Query as Export
+import Network.AWS.Data.Sensitive as Export
+import Network.AWS.Data.Text as Export
+import Network.AWS.Data.Time as Export (AWSTime, BasicTime, ISO8601,
+ POSIX, RFC822, Time (..), UTCTime,
+ _Time)
+import Network.AWS.Data.XML as Export
+import Network.AWS.Endpoint as Export
+import Network.AWS.Error as Export
+import Network.AWS.Types as Export hiding (Algorithm, Endpoint,
+ LogLevel (..), Seconds, Signer,
+ serviceEndpoint)
infixl 7 .!@
diff --git a/src/Network/AWS/Request.hs b/src/Network/AWS/Request.hs
index 9c57271..b3ab6aa 100644
--- a/src/Network/AWS/Request.hs
+++ b/src/Network/AWS/Request.hs
@@ -4,7 +4,7 @@
-- |
-- Module : Network.AWS.Request
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
diff --git a/src/Network/AWS/Response.hs b/src/Network/AWS/Response.hs
index fd8e099..4791de6 100644
--- a/src/Network/AWS/Response.hs
+++ b/src/Network/AWS/Response.hs
@@ -6,7 +6,7 @@
-- |
-- Module : Network.AWS.Response
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -14,26 +14,31 @@
--
module Network.AWS.Response where
-import Control.Applicative (pure)
-import Control.Monad.Catch
-import Control.Monad.IO.Class
-import Control.Monad.Trans.Resource
-import Data.Aeson
-import Data.Conduit
-import qualified Data.Conduit.Binary as Conduit
-import Data.Monoid
-import Data.Proxy
-import Data.Text (Text)
-import Network.AWS.Data.Body
-import Network.AWS.Data.ByteString
-import Network.AWS.Data.Log
-import Network.AWS.Data.XML
-import Network.AWS.Types
-import Network.HTTP.Conduit hiding (Proxy, Request, Response)
-import Network.HTTP.Types
-import Text.XML (Node)
-
-receiveNull :: MonadResource m
+import Control.Applicative (pure)
+import Control.Monad.Catch
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Resource
+
+import Data.Aeson
+import Data.Conduit
+import Data.Monoid
+import Data.Proxy
+import Data.Text (Text)
+
+import Network.AWS.Data.Body
+import Network.AWS.Data.ByteString
+import Network.AWS.Data.Log
+import Network.AWS.Data.XML
+import Network.AWS.Types
+import Network.HTTP.Conduit hiding (Proxy, Request, Response)
+import Network.HTTP.Types
+
+import Text.XML (Node)
+
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.Conduit.Binary as Conduit
+
+receiveNull :: (MonadResource m, MonadThrow m)
=> Rs a
-> Logger
-> Service
@@ -41,9 +46,9 @@ receiveNull :: MonadResource m
-> ClientResponse
-> m (Response a)
receiveNull rs _ = stream $ \_ _ x ->
- liftResourceT (x $$+- pure (Right rs))
+ liftResourceT (x `connect` pure (Right rs))
-receiveEmpty :: MonadResource m
+receiveEmpty :: (MonadResource m, MonadThrow m)
=> (Int -> ResponseHeaders -> () -> Either String (Rs a))
-> Logger
-> Service
@@ -51,9 +56,9 @@ receiveEmpty :: MonadResource m
-> ClientResponse
-> m (Response a)
receiveEmpty f _ = stream $ \s h x ->
- liftResourceT (x $$+- pure (f s h ()))
+ liftResourceT (x `connect` pure (f s h ()))
-receiveXMLWrapper :: MonadResource m
+receiveXMLWrapper :: (MonadResource m, MonadThrow m)
=> Text
-> (Int -> ResponseHeaders -> [Node] -> Either String (Rs a))
-> Logger
@@ -63,7 +68,7 @@ receiveXMLWrapper :: MonadResource m
-> m (Response a)
receiveXMLWrapper n f = receiveXML (\s h x -> x .@ n >>= f s h)
-receiveXML :: MonadResource m
+receiveXML :: (MonadResource m, MonadThrow m)
=> (Int -> ResponseHeaders -> [Node] -> Either String (Rs a))
-> Logger
-> Service
@@ -72,7 +77,7 @@ receiveXML :: MonadResource m
-> m (Response a)
receiveXML = deserialise decodeXML
-receiveJSON :: MonadResource m
+receiveJSON :: (MonadResource m, MonadThrow m)
=> (Int -> ResponseHeaders -> Object -> Either String (Rs a))
-> Logger
-> Service
@@ -81,7 +86,16 @@ receiveJSON :: MonadResource m
-> m (Response a)
receiveJSON = deserialise eitherDecode'
-receiveBody :: MonadResource m
+receiveBytes :: (MonadResource m, MonadThrow m)
+ => (Int -> ResponseHeaders -> ByteString -> Either String (Rs a))
+ -> Logger
+ -> Service
+ -> Proxy a
+ -> ClientResponse
+ -> m (Response a)
+receiveBytes = deserialise (Right . LBS.toStrict)
+
+receiveBody :: (MonadResource m, MonadThrow m)
=> (Int -> ResponseHeaders -> RsBody -> Either String (Rs a))
-> Logger
-> Service
@@ -91,7 +105,7 @@ receiveBody :: MonadResource m
receiveBody f _ = stream $ \s h x -> pure (f s h (RsBody x))
-- | Deserialise an entire response body, such as an XML or JSON payload.
-deserialise :: MonadResource m
+deserialise :: (MonadResource m, MonadThrow m)
=> (LazyByteString -> Either String b)
-> (Int -> ResponseHeaders -> b -> Either String (Rs a))
-> Logger
@@ -114,7 +128,7 @@ deserialise g f l Service{..} _ rs = do
SerializeError' _svcAbbrev s (Just b) e
-- | Stream a raw response body, such as an S3 object payload.
-stream :: MonadResource m
+stream :: (MonadResource m, MonadThrow m)
=> (Int -> ResponseHeaders -> ResponseBody -> m (Either String (Rs a)))
-> Service
-> Proxy a
@@ -133,4 +147,4 @@ stream f Service{..} _ rs = do
e
sinkLBS :: MonadResource m => ResponseBody -> m LazyByteString
-sinkLBS bdy = liftResourceT (bdy $$+- Conduit.sinkLbs)
+sinkLBS bdy = liftResourceT (bdy `connect` Conduit.sinkLbs)
diff --git a/src/Network/AWS/Sign/V2.hs b/src/Network/AWS/Sign/V2.hs
index 4e21de2..5a1b64d 100644
--- a/src/Network/AWS/Sign/V2.hs
+++ b/src/Network/AWS/Sign/V2.hs
@@ -6,7 +6,7 @@
-- |
-- Module : Network.AWS.Sign.V2
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -16,7 +16,6 @@ module Network.AWS.Sign.V2
( v2
) where
-import Control.Applicative
import qualified Data.ByteString.Char8 as BS8
import Data.Monoid
import Data.Time
diff --git a/src/Network/AWS/Sign/V4.hs b/src/Network/AWS/Sign/V4.hs
index 5a6fb1c..bf94bbc 100644
--- a/src/Network/AWS/Sign/V4.hs
+++ b/src/Network/AWS/Sign/V4.hs
@@ -11,7 +11,7 @@
-- |
-- Module : Network.AWS.Sign.V4
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -22,7 +22,6 @@ module Network.AWS.Sign.V4
, v4
) where
-import Control.Applicative
import qualified Data.CaseInsensitive as CI
import Data.Monoid
import Network.AWS.Data.Body
diff --git a/src/Network/AWS/Sign/V4/Base.hs b/src/Network/AWS/Sign/V4/Base.hs
index bff6db2..8e07144 100644
--- a/src/Network/AWS/Sign/V4/Base.hs
+++ b/src/Network/AWS/Sign/V4/Base.hs
@@ -11,7 +11,7 @@
-- |
-- Module : Network.AWS.Sign.V4.Base
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -19,8 +19,6 @@
--
module Network.AWS.Sign.V4.Base where
-import Control.Applicative
-
import Data.Bifunctor
import Data.Function (on)
import Data.List (nubBy, sortBy)
diff --git a/src/Network/AWS/Sign/V4/Chunked.hs b/src/Network/AWS/Sign/V4/Chunked.hs
index fe55684..25c4984 100644
--- a/src/Network/AWS/Sign/V4/Chunked.hs
+++ b/src/Network/AWS/Sign/V4/Chunked.hs
@@ -14,7 +14,7 @@
-- |
-- Module : Network.AWS.Sign.V4.Chunked
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -24,8 +24,6 @@ module Network.AWS.Sign.V4.Chunked
( chunked
) where
-import Control.Applicative
-
import Data.ByteString.Builder
import Data.Conduit
import Data.Maybe
@@ -62,7 +60,7 @@ chunked c rq a r ts = signRequest meta (toRequestBody body) auth
body = Chunked (c `fuseChunks` sign (metaSignature meta))
- sign :: Monad m => Signature -> Conduit ByteString m ByteString
+ sign :: Monad m => Signature -> ConduitM ByteString ByteString m ()
sign prev = do
mx <- await
let next = chunkSignature prev (fromMaybe mempty mx)
diff --git a/src/Network/AWS/Types.hs b/src/Network/AWS/Types.hs
index fd67f7b..0795364 100644
--- a/src/Network/AWS/Types.hs
+++ b/src/Network/AWS/Types.hs
@@ -8,10 +8,11 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE CPP #-}
-- |
-- Module : Network.AWS.Types
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -168,6 +169,10 @@ import Network.HTTP.Types.Status (Status)
import qualified Data.Text as Text
import qualified Network.HTTP.Conduit as Client
+#if ! MIN_VERSION_http_client(0,4,30)
+import Text.XML (def)
+#endif
+
-- | A convenience alias to avoid type ambiguity.
type ClientRequest = Client.Request
@@ -175,7 +180,7 @@ type ClientRequest = Client.Request
type ClientResponse = Client.Response ResponseBody
-- | A convenience alias encapsulating the common 'Response' body.
-type ResponseBody = ResumableSource (ResourceT IO) ByteString
+type ResponseBody = ConduitM () ByteString (ResourceT IO) ()
-- | Abbreviated service name.
newtype Abbrev = Abbrev Text
@@ -451,15 +456,24 @@ serviceRetry = lens _svcRetry (\s a -> s { _svcRetry = a })
-- | Construct a 'ClientRequest' using common parameters such as TLS and prevent
-- throwing errors when receiving erroneous status codes in respones.
clientRequest :: Endpoint -> Maybe Seconds -> ClientRequest
-clientRequest e t = Client.defaultRequest
+clientRequest e t =
+#if MIN_VERSION_http_client(0,4,30)
+ Client.defaultRequest
+#else
+ def
+#endif
{ Client.secure = _endpointSecure e
, Client.host = _endpointHost e
, Client.port = _endpointPort e
, Client.redirectCount = 0
, Client.responseTimeout =
+#if MIN_VERSION_http_client(0,5,0)
case t of
Nothing -> Client.responseTimeoutNone
Just x -> Client.responseTimeoutMicro (microseconds x)
+#else
+ microseconds <$> t
+#endif
}
-- | An unsigned request.
@@ -504,7 +518,7 @@ class AWSRequest a where
type Rs a :: *
request :: a -> Request a
- response :: MonadResource m
+ response :: (MonadResource m, MonadThrow m)
=> Logger
-> Service
-> Proxy a -- For injectivity reasons.
diff --git a/src/Network/AWS/Waiter.hs b/src/Network/AWS/Waiter.hs
index c448df0..ada43b8 100644
--- a/src/Network/AWS/Waiter.hs
+++ b/src/Network/AWS/Waiter.hs
@@ -5,7 +5,7 @@
-- |
-- Module : Network.AWS.Waiter
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : This Source Code Form is subject to the terms of
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : provisional
@@ -32,7 +32,6 @@ module Network.AWS.Waiter
, nonEmptyText
) where
-import Control.Applicative
import Control.Lens (Fold, allOf, anyOf, to, (^..),
(^?))
import Data.Maybe
diff --git a/test/Main.hs b/test/Main.hs
index 5b1dd8c..70e0936 100644
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Main
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Arbitrary.hs b/test/Test/AWS/Arbitrary.hs
index d74fa98..ffba250 100644
--- a/test/Test/AWS/Arbitrary.hs
+++ b/test/Test/AWS/Arbitrary.hs
@@ -6,7 +6,7 @@
-- |
-- Module : Test.AWS.Arbitrary
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Base64.hs b/test/Test/AWS/Data/Base64.hs
index f43184f..71f1bc0 100644
--- a/test/Test/AWS/Data/Base64.hs
+++ b/test/Test/AWS/Data/Base64.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Data.Base64
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/List.hs b/test/Test/AWS/Data/List.hs
index f9721ae..da828fc 100644
--- a/test/Test/AWS/Data/List.hs
+++ b/test/Test/AWS/Data/List.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Data.List
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Maybe.hs b/test/Test/AWS/Data/Maybe.hs
index a7a8f16..9d56d51 100644
--- a/test/Test/AWS/Data/Maybe.hs
+++ b/test/Test/AWS/Data/Maybe.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Data.Maybe
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Numeric.hs b/test/Test/AWS/Data/Numeric.hs
index d8ab1f5..9c883f9 100644
--- a/test/Test/AWS/Data/Numeric.hs
+++ b/test/Test/AWS/Data/Numeric.hs
@@ -3,7 +3,7 @@
-- |
-- Module : Test.AWS.Data.Numeric
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Path.hs b/test/Test/AWS/Data/Path.hs
index 86fc7ec..7e188bc 100644
--- a/test/Test/AWS/Data/Path.hs
+++ b/test/Test/AWS/Data/Path.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Data.Path
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Query.hs b/test/Test/AWS/Data/Query.hs
index 78f6184..d99ef05 100644
--- a/test/Test/AWS/Data/Query.hs
+++ b/test/Test/AWS/Data/Query.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Query.List
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Data/Time.hs b/test/Test/AWS/Data/Time.hs
index 022a15b..88bb395 100644
--- a/test/Test/AWS/Data/Time.hs
+++ b/test/Test/AWS/Data/Time.hs
@@ -4,7 +4,7 @@
-- |
-- Module : Test.AWS.Data.Time
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Error.hs b/test/Test/AWS/Error.hs
index c841a35..b037433 100644
--- a/test/Test/AWS/Error.hs
+++ b/test/Test/AWS/Error.hs
@@ -3,7 +3,7 @@
-- |
-- Module : Test.AWS.Error
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Sign/V4.hs b/test/Test/AWS/Sign/V4.hs
index 55e13af..ba0907c 100644
--- a/test/Test/AWS/Sign/V4.hs
+++ b/test/Test/AWS/Sign/V4.hs
@@ -3,7 +3,7 @@
-- |
-- Module : Test.AWS.Sign.V$
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Sign/V4/Chunked.hs b/test/Test/AWS/Sign/V4/Chunked.hs
index c08ce79..4bd27e4 100644
--- a/test/Test/AWS/Sign/V4/Chunked.hs
+++ b/test/Test/AWS/Sign/V4/Chunked.hs
@@ -4,7 +4,7 @@
-- |
-- Module : Test.AWS.Sign.V$
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental
diff --git a/test/Test/AWS/Util.hs b/test/Test/AWS/Util.hs
index fa48eff..8178def 100644
--- a/test/Test/AWS/Util.hs
+++ b/test/Test/AWS/Util.hs
@@ -2,7 +2,7 @@
-- |
-- Module : Test.AWS.Util
--- Copyright : (c) 2013-2017 Brendan Hay
+-- Copyright : (c) 2013-2018 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability : experimental