amazonka-dynamodb 0.0.7 → 0.0.8
raw patch · 5 files changed
+130/−53 lines, 5 filesdep ~amazonka-corePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: amazonka-core
API changes (from Hackage documentation)
+ Network.AWS.DynamoDB.Waiters: tableExists :: Wait DescribeTable
+ Network.AWS.DynamoDB.Waiters: tableNotExists :: Wait DescribeTable
- Network.AWS.DynamoDB.DescribeTable: describeTableResponse :: DescribeTableResponse
+ Network.AWS.DynamoDB.DescribeTable: describeTableResponse :: TableDescription -> DescribeTableResponse
- Network.AWS.DynamoDB.DescribeTable: dtrTable :: Lens' DescribeTableResponse (Maybe TableDescription)
+ Network.AWS.DynamoDB.DescribeTable: dtrTable :: Lens' DescribeTableResponse TableDescription
- Network.AWS.DynamoDB.Types: tableDescription :: NonEmpty KeySchemaElement -> TableDescription
+ Network.AWS.DynamoDB.Types: tableDescription :: Text -> NonEmpty KeySchemaElement -> TableStatus -> UTCTime -> ProvisionedThroughputDescription -> Integer -> Integer -> TableDescription
- Network.AWS.DynamoDB.Types: tdCreationDateTime :: Lens' TableDescription (Maybe UTCTime)
+ Network.AWS.DynamoDB.Types: tdCreationDateTime :: Lens' TableDescription UTCTime
- Network.AWS.DynamoDB.Types: tdItemCount :: Lens' TableDescription (Maybe Integer)
+ Network.AWS.DynamoDB.Types: tdItemCount :: Lens' TableDescription Integer
- Network.AWS.DynamoDB.Types: tdProvisionedThroughput :: Lens' TableDescription (Maybe ProvisionedThroughputDescription)
+ Network.AWS.DynamoDB.Types: tdProvisionedThroughput :: Lens' TableDescription ProvisionedThroughputDescription
- Network.AWS.DynamoDB.Types: tdTableName :: Lens' TableDescription (Maybe Text)
+ Network.AWS.DynamoDB.Types: tdTableName :: Lens' TableDescription Text
- Network.AWS.DynamoDB.Types: tdTableSizeBytes :: Lens' TableDescription (Maybe Integer)
+ Network.AWS.DynamoDB.Types: tdTableSizeBytes :: Lens' TableDescription Integer
- Network.AWS.DynamoDB.Types: tdTableStatus :: Lens' TableDescription (Maybe TableStatus)
+ Network.AWS.DynamoDB.Types: tdTableStatus :: Lens' TableDescription TableStatus
Files
- amazonka-dynamodb.cabal +3/−2
- gen/Network/AWS/DynamoDB.hs +2/−0
- gen/Network/AWS/DynamoDB/DescribeTable.hs +8/−7
- gen/Network/AWS/DynamoDB/Types.hs +75/−44
- gen/Network/AWS/DynamoDB/Waiters.hs +42/−0
amazonka-dynamodb.cabal view
@@ -1,5 +1,5 @@ name: amazonka-dynamodb-version: 0.0.7+version: 0.0.8 synopsis: Amazon DynamoDB SDK. homepage: https://github.com/brendanhay/amazonka license: OtherLicense@@ -53,9 +53,10 @@ , Network.AWS.DynamoDB.Types , Network.AWS.DynamoDB.UpdateItem , Network.AWS.DynamoDB.UpdateTable+ , Network.AWS.DynamoDB.Waiters other-modules: build-depends:- amazonka-core == 0.0.7.*+ amazonka-core == 0.0.8.* , base >= 4.7 && < 5
gen/Network/AWS/DynamoDB.hs view
@@ -32,6 +32,7 @@ , module Network.AWS.DynamoDB.Types , module Network.AWS.DynamoDB.UpdateItem , module Network.AWS.DynamoDB.UpdateTable+ , module Network.AWS.DynamoDB.Waiters ) where import Network.AWS.DynamoDB.BatchGetItem@@ -48,3 +49,4 @@ import Network.AWS.DynamoDB.Types import Network.AWS.DynamoDB.UpdateItem import Network.AWS.DynamoDB.UpdateTable+import Network.AWS.DynamoDB.Waiters
gen/Network/AWS/DynamoDB/DescribeTable.hs view
@@ -70,21 +70,22 @@ dt1TableName = lens _dt1TableName (\s a -> s { _dt1TableName = a }) newtype DescribeTableResponse = DescribeTableResponse- { _dtrTable :: Maybe TableDescription+ { _dtrTable :: TableDescription } deriving (Eq, Show) -- | 'DescribeTableResponse' constructor. -- -- The fields accessible through corresponding lenses are: ----- * 'dtrTable' @::@ 'Maybe' 'TableDescription'+-- * 'dtrTable' @::@ 'TableDescription' ---describeTableResponse :: DescribeTableResponse-describeTableResponse = DescribeTableResponse- { _dtrTable = Nothing+describeTableResponse :: TableDescription -- ^ 'dtrTable'+ -> DescribeTableResponse+describeTableResponse p1 = DescribeTableResponse+ { _dtrTable = p1 } -dtrTable :: Lens' DescribeTableResponse (Maybe TableDescription)+dtrTable :: Lens' DescribeTableResponse TableDescription dtrTable = lens _dtrTable (\s a -> s { _dtrTable = a }) instance ToPath DescribeTable where@@ -109,4 +110,4 @@ instance FromJSON DescribeTableResponse where parseJSON = withObject "DescribeTableResponse" $ \o -> DescribeTableResponse- <$> o .:? "Table"+ <$> o .: "Table"
gen/Network/AWS/DynamoDB/Types.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} @@ -238,8 +239,6 @@ , gsiuUpdate ) where -import Data.Char (isUpper)-import Network.AWS.Error import Network.AWS.Prelude import Network.AWS.Signing import qualified GHC.Exts@@ -251,16 +250,42 @@ type Sg DynamoDB = V4 type Er DynamoDB = JSONError - service = Service- { _svcAbbrev = "DynamoDB"- , _svcPrefix = "dynamodb"- , _svcVersion = "2012-08-10"- , _svcTargetPrefix = Just "DynamoDB_20120810"- , _svcJSONVersion = Just "1.0"- }+ service = service'+ where+ service' :: Service DynamoDB+ service' = Service+ { _svcAbbrev = "DynamoDB"+ , _svcPrefix = "dynamodb"+ , _svcVersion = "2012-08-10"+ , _svcTargetPrefix = Just "DynamoDB_20120810"+ , _svcJSONVersion = Just "1.0"+ , _svcHandle = handle+ , _svcRetry = retry+ } - handle = jsonError statusSuccess+ handle :: Status+ -> Maybe (LazyByteString -> ServiceError JSONError)+ handle = jsonError statusSuccess service' + retry :: Retry DynamoDB+ retry = Exponential+ { _retryBase = 0.05+ , _retryGrowth = 2+ , _retryAttempts = 10+ , _retryCheck = check+ }++ check :: Status+ -> JSONError+ -> Bool+ check (statusCode -> s) (awsErrorCode -> e)+ | s == 400 && "ThrottlingException" == e = True -- Throttling+ | s == 400 && "ProvisionedThroughputExceededException" == e = True -- Throughput Exceeded+ | s == 500 = True -- General Server Error+ | s == 509 = True -- Limit Exceeded+ | s == 503 = True -- Service Unavailable+ | otherwise = False+ data WriteRequest = WriteRequest { _wDeleteRequest :: Maybe DeleteRequest , _wPutRequest :: Maybe PutRequest@@ -677,15 +702,15 @@ data TableDescription = TableDescription { _tdAttributeDefinitions :: List "AttributeDefinitions" AttributeDefinition- , _tdCreationDateTime :: Maybe ISO8601+ , _tdCreationDateTime :: ISO8601 , _tdGlobalSecondaryIndexes :: List "GlobalSecondaryIndexes" GlobalSecondaryIndexDescription- , _tdItemCount :: Maybe Integer+ , _tdItemCount :: Integer , _tdKeySchema :: List1 "KeySchema" KeySchemaElement , _tdLocalSecondaryIndexes :: List "LocalSecondaryIndexes" LocalSecondaryIndexDescription- , _tdProvisionedThroughput :: Maybe ProvisionedThroughputDescription- , _tdTableName :: Maybe Text- , _tdTableSizeBytes :: Maybe Integer- , _tdTableStatus :: Maybe TableStatus+ , _tdProvisionedThroughput :: ProvisionedThroughputDescription+ , _tdTableName :: Text+ , _tdTableSizeBytes :: Integer+ , _tdTableStatus :: TableStatus } deriving (Eq, Show) -- | 'TableDescription' constructor.@@ -694,35 +719,41 @@ -- -- * 'tdAttributeDefinitions' @::@ ['AttributeDefinition'] ----- * 'tdCreationDateTime' @::@ 'Maybe' 'UTCTime'+-- * 'tdCreationDateTime' @::@ 'UTCTime' -- -- * 'tdGlobalSecondaryIndexes' @::@ ['GlobalSecondaryIndexDescription'] ----- * 'tdItemCount' @::@ 'Maybe' 'Integer'+-- * 'tdItemCount' @::@ 'Integer' -- -- * 'tdKeySchema' @::@ 'NonEmpty' 'KeySchemaElement' -- -- * 'tdLocalSecondaryIndexes' @::@ ['LocalSecondaryIndexDescription'] ----- * 'tdProvisionedThroughput' @::@ 'Maybe' 'ProvisionedThroughputDescription'+-- * 'tdProvisionedThroughput' @::@ 'ProvisionedThroughputDescription' ----- * 'tdTableName' @::@ 'Maybe' 'Text'+-- * 'tdTableName' @::@ 'Text' ----- * 'tdTableSizeBytes' @::@ 'Maybe' 'Integer'+-- * 'tdTableSizeBytes' @::@ 'Integer' ----- * 'tdTableStatus' @::@ 'Maybe' 'TableStatus'+-- * 'tdTableStatus' @::@ 'TableStatus' ---tableDescription :: NonEmpty KeySchemaElement -- ^ 'tdKeySchema'+tableDescription :: Text -- ^ 'tdTableName'+ -> NonEmpty KeySchemaElement -- ^ 'tdKeySchema'+ -> TableStatus -- ^ 'tdTableStatus'+ -> UTCTime -- ^ 'tdCreationDateTime'+ -> ProvisionedThroughputDescription -- ^ 'tdProvisionedThroughput'+ -> Integer -- ^ 'tdTableSizeBytes'+ -> Integer -- ^ 'tdItemCount' -> TableDescription-tableDescription p1 = TableDescription- { _tdKeySchema = withIso _List1 (const id) p1+tableDescription p1 p2 p3 p4 p5 p6 p7 = TableDescription+ { _tdTableName = p1+ , _tdKeySchema = withIso _List1 (const id) p2+ , _tdTableStatus = p3+ , _tdCreationDateTime = withIso _Time (const id) p4+ , _tdProvisionedThroughput = p5+ , _tdTableSizeBytes = p6+ , _tdItemCount = p7 , _tdAttributeDefinitions = mempty- , _tdTableName = Nothing- , _tdTableStatus = Nothing- , _tdCreationDateTime = Nothing- , _tdProvisionedThroughput = Nothing- , _tdTableSizeBytes = Nothing- , _tdItemCount = Nothing , _tdLocalSecondaryIndexes = mempty , _tdGlobalSecondaryIndexes = mempty }@@ -743,10 +774,10 @@ . _List -- | The date and time when the table was created, in <http://www.epochconverter.com/ UNIX epoch time> format.-tdCreationDateTime :: Lens' TableDescription (Maybe UTCTime)+tdCreationDateTime :: Lens' TableDescription UTCTime tdCreationDateTime = lens _tdCreationDateTime (\s a -> s { _tdCreationDateTime = a })- . mapping _Time+ . _Time -- | The global secondary indexes, if any, on the table. Each index is scoped to a -- given hash key value. Each element is composed of:@@ -810,7 +841,7 @@ -- | The number of items in the specified table. DynamoDB updates this value -- approximately every six hours. Recent changes might not be reflected in this -- value.-tdItemCount :: Lens' TableDescription (Maybe Integer)+tdItemCount :: Lens' TableDescription Integer tdItemCount = lens _tdItemCount (\s a -> s { _tdItemCount = a }) -- | The primary key structure for the table. Each /KeySchemaElement/ consists of:@@ -872,18 +903,18 @@ -- | The provisioned throughput settings for the table, consisting of read and -- write capacity units, along with data about increases and decreases.-tdProvisionedThroughput :: Lens' TableDescription (Maybe ProvisionedThroughputDescription)+tdProvisionedThroughput :: Lens' TableDescription ProvisionedThroughputDescription tdProvisionedThroughput = lens _tdProvisionedThroughput (\s a -> s { _tdProvisionedThroughput = a }) -- | The name of the table.-tdTableName :: Lens' TableDescription (Maybe Text)+tdTableName :: Lens' TableDescription Text tdTableName = lens _tdTableName (\s a -> s { _tdTableName = a }) -- | The total size of the specified table, in bytes. DynamoDB updates this value -- approximately every six hours. Recent changes might not be reflected in this -- value.-tdTableSizeBytes :: Lens' TableDescription (Maybe Integer)+tdTableSizeBytes :: Lens' TableDescription Integer tdTableSizeBytes = lens _tdTableSizeBytes (\s a -> s { _tdTableSizeBytes = a }) -- | The current state of the table:@@ -900,21 +931,21 @@ -- /ACTIVE/ - The table is ready for use. -- ---tdTableStatus :: Lens' TableDescription (Maybe TableStatus)+tdTableStatus :: Lens' TableDescription TableStatus tdTableStatus = lens _tdTableStatus (\s a -> s { _tdTableStatus = a }) instance FromJSON TableDescription where parseJSON = withObject "TableDescription" $ \o -> TableDescription <$> o .:? "AttributeDefinitions" .!= mempty- <*> o .:? "CreationDateTime"+ <*> o .: "CreationDateTime" <*> o .:? "GlobalSecondaryIndexes" .!= mempty- <*> o .:? "ItemCount"+ <*> o .: "ItemCount" <*> o .: "KeySchema" <*> o .:? "LocalSecondaryIndexes" .!= mempty- <*> o .:? "ProvisionedThroughput"- <*> o .:? "TableName"- <*> o .:? "TableSizeBytes"- <*> o .:? "TableStatus"+ <*> o .: "ProvisionedThroughput"+ <*> o .: "TableName"+ <*> o .: "TableSizeBytes"+ <*> o .: "TableStatus" instance ToJSON TableDescription where toJSON TableDescription{..} = object
+ gen/Network/AWS/DynamoDB/Waiters.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeFamilies #-}++-- Module : Network.AWS.DynamoDB.Waiters+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- License : This Source Code Form is subject to the terms of+-- the Mozilla Public License, v. 2.0.+-- A copy of the MPL can be found in the LICENSE file or+-- you can obtain it at http://mozilla.org/MPL/2.0/.+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>+-- Stability : experimental+-- Portability : non-portable (GHC extensions)+--+-- Derived from AWS service descriptions, licensed under Apache 2.0.++module Network.AWS.DynamoDB.Waiters where++import Network.AWS.DynamoDB.DescribeTable+import Network.AWS.DynamoDB.Types+import Network.AWS.Waiters++tableExists :: Wait DescribeTable+tableExists = Wait+ { _waitName = "TableExists"+ , _waitAttempts = 25+ , _waitDelay = 20+ , _waitAcceptors =+ [ matchAll TSActive AcceptSuccess+ (dtrTable . tdTableStatus)+ , matchError "ResourceNotFoundException" AcceptRetry+ ]+ }++tableNotExists :: Wait DescribeTable+tableNotExists = Wait+ { _waitName = "TableNotExists"+ , _waitAttempts = 25+ , _waitDelay = 20+ , _waitAcceptors =+ [ matchError "ResourceNotFoundException" AcceptSuccess+ ]+ }