module Aws.SimpleDb.Commands.Attributes where

import           Aws.Core
import           Aws.SimpleDb.Core
import           Control.Applicative
import           Control.Monad
import           Data.Maybe
import           Prelude
import           Text.XML.Cursor            (($//), (&|))
import qualified Data.Text                  as T
import qualified Data.Text.Encoding         as T
import qualified Text.XML.Cursor            as Cu

data GetAttributes
    = GetAttributes {
        GetAttributes -> Text
gaItemName :: T.Text
      , GetAttributes -> Maybe Text
gaAttributeName :: Maybe T.Text
      , GetAttributes -> Bool
gaConsistentRead :: Bool
      , GetAttributes -> Text
gaDomainName :: T.Text
      }
    deriving (Int -> GetAttributes -> ShowS
[GetAttributes] -> ShowS
GetAttributes -> String
(Int -> GetAttributes -> ShowS)
-> (GetAttributes -> String)
-> ([GetAttributes] -> ShowS)
-> Show GetAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetAttributes -> ShowS
showsPrec :: Int -> GetAttributes -> ShowS
$cshow :: GetAttributes -> String
show :: GetAttributes -> String
$cshowList :: [GetAttributes] -> ShowS
showList :: [GetAttributes] -> ShowS
Show)

data GetAttributesResponse
    = GetAttributesResponse {
        GetAttributesResponse -> [Attribute Text]
garAttributes :: [Attribute T.Text]
      }
    deriving (Int -> GetAttributesResponse -> ShowS
[GetAttributesResponse] -> ShowS
GetAttributesResponse -> String
(Int -> GetAttributesResponse -> ShowS)
-> (GetAttributesResponse -> String)
-> ([GetAttributesResponse] -> ShowS)
-> Show GetAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetAttributesResponse -> ShowS
showsPrec :: Int -> GetAttributesResponse -> ShowS
$cshow :: GetAttributesResponse -> String
show :: GetAttributesResponse -> String
$cshowList :: [GetAttributesResponse] -> ShowS
showList :: [GetAttributesResponse] -> ShowS
Show)

getAttributes :: T.Text -> T.Text -> GetAttributes
getAttributes :: Text -> Text -> GetAttributes
getAttributes Text
item Text
domain = GetAttributes { gaItemName :: Text
gaItemName = Text
item, gaAttributeName :: Maybe Text
gaAttributeName = Maybe Text
forall a. Maybe a
Nothing, gaConsistentRead :: Bool
gaConsistentRead = Bool
False, gaDomainName :: Text
gaDomainName = Text
domain }

-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery GetAttributes where
    type ServiceConfiguration GetAttributes = SdbConfiguration
    signQuery :: forall queryType.
GetAttributes
-> ServiceConfiguration GetAttributes queryType
-> SignatureData
-> SignedQuery
signQuery GetAttributes{Bool
Maybe Text
Text
gaItemName :: GetAttributes -> Text
gaAttributeName :: GetAttributes -> Maybe Text
gaConsistentRead :: GetAttributes -> Bool
gaDomainName :: GetAttributes -> Text
gaItemName :: Text
gaAttributeName :: Maybe Text
gaConsistentRead :: Bool
gaDomainName :: Text
..}
        = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$
            [(ByteString
"Action", ByteString
"GetAttributes"), (ByteString
"ItemName", Text -> ByteString
T.encodeUtf8 Text
gaItemName), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
gaDomainName)] [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            Maybe (ByteString, ByteString) -> [(ByteString, ByteString)]
forall a. Maybe a -> [a]
maybeToList ((ByteString
"AttributeName",) (ByteString -> (ByteString, ByteString))
-> (Text -> ByteString) -> Text -> (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> ByteString
T.encodeUtf8 (Text -> (ByteString, ByteString))
-> Maybe Text -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
gaAttributeName) [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Bool -> [()]
forall (f :: * -> *). Alternative f => Bool -> f ()
guard Bool
gaConsistentRead [()] -> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a b. [a] -> [b] -> [b]
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [(ByteString
"ConsistentRead", ByteString
awsTrue)])

instance ResponseConsumer r GetAttributesResponse where
    type ResponseMetadata GetAttributesResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata GetAttributesResponse)
-> HTTPResponseConsumer GetAttributesResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata GetAttributesResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer GetAttributesResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer Cursor -> Response SdbMetadata GetAttributesResponse
forall {m :: * -> *}.
MonadThrow m =>
Cursor -> m GetAttributesResponse
parse
        where parse :: Cursor -> m GetAttributesResponse
parse Cursor
cursor = do
                () -> Text -> Cursor -> m ()
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType () Text
"GetAttributesResponse" Cursor
cursor
                [Attribute Text]
attributes <- [m (Attribute Text)] -> m [Attribute Text]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [a]
sequence ([m (Attribute Text)] -> m [Attribute Text])
-> [m (Attribute Text)] -> m [Attribute Text]
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m (Attribute Text)]) -> [m (Attribute Text)]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"Attribute" Axis
-> (Cursor -> m (Attribute Text)) -> Cursor -> [m (Attribute Text)]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> m (Attribute Text)
forall (m :: * -> *). MonadThrow m => Cursor -> m (Attribute Text)
readAttribute
                GetAttributesResponse -> m GetAttributesResponse
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (GetAttributesResponse -> m GetAttributesResponse)
-> GetAttributesResponse -> m GetAttributesResponse
forall a b. (a -> b) -> a -> b
$ [Attribute Text] -> GetAttributesResponse
GetAttributesResponse [Attribute Text]
attributes

instance Transaction GetAttributes GetAttributesResponse

instance AsMemoryResponse GetAttributesResponse where
    type MemoryResponse GetAttributesResponse = GetAttributesResponse
    loadToMemory :: GetAttributesResponse
-> ResourceT IO (MemoryResponse GetAttributesResponse)
loadToMemory = GetAttributesResponse
-> ResourceT IO (MemoryResponse GetAttributesResponse)
GetAttributesResponse -> ResourceT IO GetAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return

data PutAttributes
    = PutAttributes {
        PutAttributes -> Text
paItemName :: T.Text
      , PutAttributes -> [Attribute SetAttribute]
paAttributes :: [Attribute SetAttribute]
      , PutAttributes -> [Attribute ExpectedAttribute]
paExpected :: [Attribute ExpectedAttribute]
      , PutAttributes -> Text
paDomainName :: T.Text
      }
    deriving (Int -> PutAttributes -> ShowS
[PutAttributes] -> ShowS
PutAttributes -> String
(Int -> PutAttributes -> ShowS)
-> (PutAttributes -> String)
-> ([PutAttributes] -> ShowS)
-> Show PutAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PutAttributes -> ShowS
showsPrec :: Int -> PutAttributes -> ShowS
$cshow :: PutAttributes -> String
show :: PutAttributes -> String
$cshowList :: [PutAttributes] -> ShowS
showList :: [PutAttributes] -> ShowS
Show)

data PutAttributesResponse
    = PutAttributesResponse
    deriving (Int -> PutAttributesResponse -> ShowS
[PutAttributesResponse] -> ShowS
PutAttributesResponse -> String
(Int -> PutAttributesResponse -> ShowS)
-> (PutAttributesResponse -> String)
-> ([PutAttributesResponse] -> ShowS)
-> Show PutAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PutAttributesResponse -> ShowS
showsPrec :: Int -> PutAttributesResponse -> ShowS
$cshow :: PutAttributesResponse -> String
show :: PutAttributesResponse -> String
$cshowList :: [PutAttributesResponse] -> ShowS
showList :: [PutAttributesResponse] -> ShowS
Show)
             
putAttributes :: T.Text -> [Attribute SetAttribute] -> T.Text -> PutAttributes
putAttributes :: Text -> [Attribute SetAttribute] -> Text -> PutAttributes
putAttributes Text
item [Attribute SetAttribute]
attributes Text
domain = PutAttributes { 
                                         paItemName :: Text
paItemName = Text
item
                                       , paAttributes :: [Attribute SetAttribute]
paAttributes = [Attribute SetAttribute]
attributes
                                       , paExpected :: [Attribute ExpectedAttribute]
paExpected = []
                                       , paDomainName :: Text
paDomainName = Text
domain 
                                       }
                                       
-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery PutAttributes where
    type ServiceConfiguration PutAttributes = SdbConfiguration
    signQuery :: forall queryType.
PutAttributes
-> ServiceConfiguration PutAttributes queryType
-> SignatureData
-> SignedQuery
signQuery PutAttributes{[Attribute ExpectedAttribute]
[Attribute SetAttribute]
Text
paItemName :: PutAttributes -> Text
paAttributes :: PutAttributes -> [Attribute SetAttribute]
paExpected :: PutAttributes -> [Attribute ExpectedAttribute]
paDomainName :: PutAttributes -> Text
paItemName :: Text
paAttributes :: [Attribute SetAttribute]
paExpected :: [Attribute ExpectedAttribute]
paDomainName :: Text
..}
        = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ 
            [(ByteString
"Action", ByteString
"PutAttributes"), (ByteString
"ItemName", Text -> ByteString
T.encodeUtf8 Text
paItemName), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
paDomainName)] [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Attribute SetAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute SetAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((SetAttribute -> [(ByteString, ByteString)])
-> Attribute SetAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery SetAttribute -> [(ByteString, ByteString)]
setAttributeQuery) ByteString
"Attribute" [Attribute SetAttribute]
paAttributes [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Attribute ExpectedAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute ExpectedAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((ExpectedAttribute -> [(ByteString, ByteString)])
-> Attribute ExpectedAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery ExpectedAttribute -> [(ByteString, ByteString)]
expectedAttributeQuery) ByteString
"Expected" [Attribute ExpectedAttribute]
paExpected

instance ResponseConsumer r PutAttributesResponse where
    type ResponseMetadata PutAttributesResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata PutAttributesResponse)
-> HTTPResponseConsumer PutAttributesResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata PutAttributesResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer PutAttributesResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata PutAttributesResponse)
 -> IORef SdbMetadata -> HTTPResponseConsumer PutAttributesResponse)
-> (Cursor -> Response SdbMetadata PutAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer PutAttributesResponse
forall a b. (a -> b) -> a -> b
$ PutAttributesResponse
-> Text -> Cursor -> Response SdbMetadata PutAttributesResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType PutAttributesResponse
PutAttributesResponse Text
"PutAttributesResponse"

instance Transaction PutAttributes PutAttributesResponse

instance AsMemoryResponse PutAttributesResponse where
    type MemoryResponse PutAttributesResponse = PutAttributesResponse
    loadToMemory :: PutAttributesResponse
-> ResourceT IO (MemoryResponse PutAttributesResponse)
loadToMemory = PutAttributesResponse
-> ResourceT IO (MemoryResponse PutAttributesResponse)
PutAttributesResponse -> ResourceT IO PutAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return

data DeleteAttributes
    = DeleteAttributes {
        DeleteAttributes -> Text
daItemName :: T.Text
      , DeleteAttributes -> [Attribute DeleteAttribute]
daAttributes :: [Attribute DeleteAttribute]
      , DeleteAttributes -> [Attribute ExpectedAttribute]
daExpected :: [Attribute ExpectedAttribute]
      , DeleteAttributes -> Text
daDomainName :: T.Text
      }
    deriving (Int -> DeleteAttributes -> ShowS
[DeleteAttributes] -> ShowS
DeleteAttributes -> String
(Int -> DeleteAttributes -> ShowS)
-> (DeleteAttributes -> String)
-> ([DeleteAttributes] -> ShowS)
-> Show DeleteAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteAttributes -> ShowS
showsPrec :: Int -> DeleteAttributes -> ShowS
$cshow :: DeleteAttributes -> String
show :: DeleteAttributes -> String
$cshowList :: [DeleteAttributes] -> ShowS
showList :: [DeleteAttributes] -> ShowS
Show)

data DeleteAttributesResponse
    = DeleteAttributesResponse
    deriving (Int -> DeleteAttributesResponse -> ShowS
[DeleteAttributesResponse] -> ShowS
DeleteAttributesResponse -> String
(Int -> DeleteAttributesResponse -> ShowS)
-> (DeleteAttributesResponse -> String)
-> ([DeleteAttributesResponse] -> ShowS)
-> Show DeleteAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteAttributesResponse -> ShowS
showsPrec :: Int -> DeleteAttributesResponse -> ShowS
$cshow :: DeleteAttributesResponse -> String
show :: DeleteAttributesResponse -> String
$cshowList :: [DeleteAttributesResponse] -> ShowS
showList :: [DeleteAttributesResponse] -> ShowS
Show)
             
deleteAttributes :: T.Text -> [Attribute DeleteAttribute] -> T.Text -> DeleteAttributes
deleteAttributes :: Text -> [Attribute DeleteAttribute] -> Text -> DeleteAttributes
deleteAttributes Text
item [Attribute DeleteAttribute]
attributes Text
domain = DeleteAttributes { 
                                         daItemName :: Text
daItemName = Text
item
                                       , daAttributes :: [Attribute DeleteAttribute]
daAttributes = [Attribute DeleteAttribute]
attributes
                                       , daExpected :: [Attribute ExpectedAttribute]
daExpected = []
                                       , daDomainName :: Text
daDomainName = Text
domain 
                                       }
                                       
-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery DeleteAttributes where
    type ServiceConfiguration DeleteAttributes = SdbConfiguration
    signQuery :: forall queryType.
DeleteAttributes
-> ServiceConfiguration DeleteAttributes queryType
-> SignatureData
-> SignedQuery
signQuery DeleteAttributes{[Attribute ExpectedAttribute]
[Attribute DeleteAttribute]
Text
daItemName :: DeleteAttributes -> Text
daAttributes :: DeleteAttributes -> [Attribute DeleteAttribute]
daExpected :: DeleteAttributes -> [Attribute ExpectedAttribute]
daDomainName :: DeleteAttributes -> Text
daItemName :: Text
daAttributes :: [Attribute DeleteAttribute]
daExpected :: [Attribute ExpectedAttribute]
daDomainName :: Text
..}
        = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ 
            [(ByteString
"Action", ByteString
"DeleteAttributes"), (ByteString
"ItemName", Text -> ByteString
T.encodeUtf8 Text
daItemName), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
daDomainName)] [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Attribute DeleteAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute DeleteAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((DeleteAttribute -> [(ByteString, ByteString)])
-> Attribute DeleteAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery DeleteAttribute -> [(ByteString, ByteString)]
deleteAttributeQuery) ByteString
"Attribute" [Attribute DeleteAttribute]
daAttributes [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Attribute ExpectedAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute ExpectedAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((ExpectedAttribute -> [(ByteString, ByteString)])
-> Attribute ExpectedAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery ExpectedAttribute -> [(ByteString, ByteString)]
expectedAttributeQuery) ByteString
"Expected" [Attribute ExpectedAttribute]
daExpected

instance ResponseConsumer r DeleteAttributesResponse where
    type ResponseMetadata DeleteAttributesResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata DeleteAttributesResponse)
-> HTTPResponseConsumer DeleteAttributesResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata DeleteAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer DeleteAttributesResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata DeleteAttributesResponse)
 -> IORef SdbMetadata
 -> HTTPResponseConsumer DeleteAttributesResponse)
-> (Cursor -> Response SdbMetadata DeleteAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer DeleteAttributesResponse
forall a b. (a -> b) -> a -> b
$ DeleteAttributesResponse
-> Text -> Cursor -> Response SdbMetadata DeleteAttributesResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType DeleteAttributesResponse
DeleteAttributesResponse Text
"DeleteAttributesResponse"

instance Transaction DeleteAttributes DeleteAttributesResponse

instance AsMemoryResponse DeleteAttributesResponse where
    type MemoryResponse DeleteAttributesResponse = DeleteAttributesResponse
    loadToMemory :: DeleteAttributesResponse
-> ResourceT IO (MemoryResponse DeleteAttributesResponse)
loadToMemory = DeleteAttributesResponse
-> ResourceT IO (MemoryResponse DeleteAttributesResponse)
DeleteAttributesResponse -> ResourceT IO DeleteAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return

data BatchPutAttributes
    = BatchPutAttributes {
        BatchPutAttributes -> [Item [Attribute SetAttribute]]
bpaItems :: [Item [Attribute SetAttribute]]
      , BatchPutAttributes -> Text
bpaDomainName :: T.Text
      }
    deriving (Int -> BatchPutAttributes -> ShowS
[BatchPutAttributes] -> ShowS
BatchPutAttributes -> String
(Int -> BatchPutAttributes -> ShowS)
-> (BatchPutAttributes -> String)
-> ([BatchPutAttributes] -> ShowS)
-> Show BatchPutAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchPutAttributes -> ShowS
showsPrec :: Int -> BatchPutAttributes -> ShowS
$cshow :: BatchPutAttributes -> String
show :: BatchPutAttributes -> String
$cshowList :: [BatchPutAttributes] -> ShowS
showList :: [BatchPutAttributes] -> ShowS
Show)

data BatchPutAttributesResponse
    = BatchPutAttributesResponse
    deriving (Int -> BatchPutAttributesResponse -> ShowS
[BatchPutAttributesResponse] -> ShowS
BatchPutAttributesResponse -> String
(Int -> BatchPutAttributesResponse -> ShowS)
-> (BatchPutAttributesResponse -> String)
-> ([BatchPutAttributesResponse] -> ShowS)
-> Show BatchPutAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchPutAttributesResponse -> ShowS
showsPrec :: Int -> BatchPutAttributesResponse -> ShowS
$cshow :: BatchPutAttributesResponse -> String
show :: BatchPutAttributesResponse -> String
$cshowList :: [BatchPutAttributesResponse] -> ShowS
showList :: [BatchPutAttributesResponse] -> ShowS
Show)
             
batchPutAttributes :: [Item [Attribute SetAttribute]] -> T.Text -> BatchPutAttributes
batchPutAttributes :: [Item [Attribute SetAttribute]] -> Text -> BatchPutAttributes
batchPutAttributes [Item [Attribute SetAttribute]]
items Text
domain = BatchPutAttributes { bpaItems :: [Item [Attribute SetAttribute]]
bpaItems = [Item [Attribute SetAttribute]]
items, bpaDomainName :: Text
bpaDomainName = Text
domain }

-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery BatchPutAttributes where
    type ServiceConfiguration BatchPutAttributes = SdbConfiguration
    signQuery :: forall queryType.
BatchPutAttributes
-> ServiceConfiguration BatchPutAttributes queryType
-> SignatureData
-> SignedQuery
signQuery BatchPutAttributes{[Item [Attribute SetAttribute]]
Text
bpaItems :: BatchPutAttributes -> [Item [Attribute SetAttribute]]
bpaDomainName :: BatchPutAttributes -> Text
bpaItems :: [Item [Attribute SetAttribute]]
bpaDomainName :: Text
..}
        = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ 
            [(ByteString
"Action", ByteString
"BatchPutAttributes")
            , (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
bpaDomainName)] [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Item [Attribute SetAttribute] -> [(ByteString, ByteString)])
-> ByteString
-> [Item [Attribute SetAttribute]]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList (([Attribute SetAttribute] -> [(ByteString, ByteString)])
-> Item [Attribute SetAttribute] -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Item a -> [(ByteString, ByteString)]
itemQuery (([Attribute SetAttribute] -> [(ByteString, ByteString)])
 -> Item [Attribute SetAttribute] -> [(ByteString, ByteString)])
-> ([Attribute SetAttribute] -> [(ByteString, ByteString)])
-> Item [Attribute SetAttribute]
-> [(ByteString, ByteString)]
forall a b. (a -> b) -> a -> b
$ (Attribute SetAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute SetAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((SetAttribute -> [(ByteString, ByteString)])
-> Attribute SetAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery SetAttribute -> [(ByteString, ByteString)]
setAttributeQuery) ByteString
"Attribute") ByteString
"Item" [Item [Attribute SetAttribute]]
bpaItems

instance ResponseConsumer r BatchPutAttributesResponse where
    type ResponseMetadata BatchPutAttributesResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata BatchPutAttributesResponse)
-> HTTPResponseConsumer BatchPutAttributesResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata BatchPutAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer BatchPutAttributesResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata BatchPutAttributesResponse)
 -> IORef SdbMetadata
 -> HTTPResponseConsumer BatchPutAttributesResponse)
-> (Cursor -> Response SdbMetadata BatchPutAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer BatchPutAttributesResponse
forall a b. (a -> b) -> a -> b
$ BatchPutAttributesResponse
-> Text
-> Cursor
-> Response SdbMetadata BatchPutAttributesResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType BatchPutAttributesResponse
BatchPutAttributesResponse Text
"BatchPutAttributesResponse"

instance Transaction BatchPutAttributes BatchPutAttributesResponse

instance AsMemoryResponse BatchPutAttributesResponse where
    type MemoryResponse BatchPutAttributesResponse = BatchPutAttributesResponse
    loadToMemory :: BatchPutAttributesResponse
-> ResourceT IO (MemoryResponse BatchPutAttributesResponse)
loadToMemory = BatchPutAttributesResponse
-> ResourceT IO (MemoryResponse BatchPutAttributesResponse)
BatchPutAttributesResponse
-> ResourceT IO BatchPutAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return

data BatchDeleteAttributes
    = BatchDeleteAttributes {
        BatchDeleteAttributes -> [Item [Attribute DeleteAttribute]]
bdaItems :: [Item [Attribute DeleteAttribute]]
      , BatchDeleteAttributes -> Text
bdaDomainName :: T.Text
      }
    deriving (Int -> BatchDeleteAttributes -> ShowS
[BatchDeleteAttributes] -> ShowS
BatchDeleteAttributes -> String
(Int -> BatchDeleteAttributes -> ShowS)
-> (BatchDeleteAttributes -> String)
-> ([BatchDeleteAttributes] -> ShowS)
-> Show BatchDeleteAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchDeleteAttributes -> ShowS
showsPrec :: Int -> BatchDeleteAttributes -> ShowS
$cshow :: BatchDeleteAttributes -> String
show :: BatchDeleteAttributes -> String
$cshowList :: [BatchDeleteAttributes] -> ShowS
showList :: [BatchDeleteAttributes] -> ShowS
Show)

data BatchDeleteAttributesResponse
    = BatchDeleteAttributesResponse
    deriving (Int -> BatchDeleteAttributesResponse -> ShowS
[BatchDeleteAttributesResponse] -> ShowS
BatchDeleteAttributesResponse -> String
(Int -> BatchDeleteAttributesResponse -> ShowS)
-> (BatchDeleteAttributesResponse -> String)
-> ([BatchDeleteAttributesResponse] -> ShowS)
-> Show BatchDeleteAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchDeleteAttributesResponse -> ShowS
showsPrec :: Int -> BatchDeleteAttributesResponse -> ShowS
$cshow :: BatchDeleteAttributesResponse -> String
show :: BatchDeleteAttributesResponse -> String
$cshowList :: [BatchDeleteAttributesResponse] -> ShowS
showList :: [BatchDeleteAttributesResponse] -> ShowS
Show)
             
batchDeleteAttributes :: [Item [Attribute DeleteAttribute]] -> T.Text -> BatchDeleteAttributes
batchDeleteAttributes :: [Item [Attribute DeleteAttribute]] -> Text -> BatchDeleteAttributes
batchDeleteAttributes [Item [Attribute DeleteAttribute]]
items Text
domain = BatchDeleteAttributes { bdaItems :: [Item [Attribute DeleteAttribute]]
bdaItems = [Item [Attribute DeleteAttribute]]
items, bdaDomainName :: Text
bdaDomainName = Text
domain }

-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery BatchDeleteAttributes where
    type ServiceConfiguration BatchDeleteAttributes = SdbConfiguration
    signQuery :: forall queryType.
BatchDeleteAttributes
-> ServiceConfiguration BatchDeleteAttributes queryType
-> SignatureData
-> SignedQuery
signQuery BatchDeleteAttributes{[Item [Attribute DeleteAttribute]]
Text
bdaItems :: BatchDeleteAttributes -> [Item [Attribute DeleteAttribute]]
bdaDomainName :: BatchDeleteAttributes -> Text
bdaItems :: [Item [Attribute DeleteAttribute]]
bdaDomainName :: Text
..}
        = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ 
            [(ByteString
"Action", ByteString
"BatchDeleteAttributes")
            , (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
bdaDomainName)] [(ByteString, ByteString)]
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [a] -> [a] -> [a]
++
            (Item [Attribute DeleteAttribute] -> [(ByteString, ByteString)])
-> ByteString
-> [Item [Attribute DeleteAttribute]]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList (([Attribute DeleteAttribute] -> [(ByteString, ByteString)])
-> Item [Attribute DeleteAttribute] -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Item a -> [(ByteString, ByteString)]
itemQuery (([Attribute DeleteAttribute] -> [(ByteString, ByteString)])
 -> Item [Attribute DeleteAttribute] -> [(ByteString, ByteString)])
-> ([Attribute DeleteAttribute] -> [(ByteString, ByteString)])
-> Item [Attribute DeleteAttribute]
-> [(ByteString, ByteString)]
forall a b. (a -> b) -> a -> b
$ (Attribute DeleteAttribute -> [(ByteString, ByteString)])
-> ByteString
-> [Attribute DeleteAttribute]
-> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> ByteString -> [a] -> [(ByteString, ByteString)]
queryList ((DeleteAttribute -> [(ByteString, ByteString)])
-> Attribute DeleteAttribute -> [(ByteString, ByteString)]
forall a.
(a -> [(ByteString, ByteString)])
-> Attribute a -> [(ByteString, ByteString)]
attributeQuery DeleteAttribute -> [(ByteString, ByteString)]
deleteAttributeQuery) ByteString
"Attribute") ByteString
"Item" [Item [Attribute DeleteAttribute]]
bdaItems

instance ResponseConsumer r BatchDeleteAttributesResponse where
    type ResponseMetadata BatchDeleteAttributesResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata BatchDeleteAttributesResponse)
-> HTTPResponseConsumer BatchDeleteAttributesResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata BatchDeleteAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer BatchDeleteAttributesResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata BatchDeleteAttributesResponse)
 -> IORef SdbMetadata
 -> HTTPResponseConsumer BatchDeleteAttributesResponse)
-> (Cursor -> Response SdbMetadata BatchDeleteAttributesResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer BatchDeleteAttributesResponse
forall a b. (a -> b) -> a -> b
$ BatchDeleteAttributesResponse
-> Text
-> Cursor
-> Response SdbMetadata BatchDeleteAttributesResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType BatchDeleteAttributesResponse
BatchDeleteAttributesResponse Text
"BatchDeleteAttributesResponse"

instance Transaction BatchDeleteAttributes BatchDeleteAttributesResponse

instance AsMemoryResponse BatchDeleteAttributesResponse where
    type MemoryResponse BatchDeleteAttributesResponse = BatchDeleteAttributesResponse
    loadToMemory :: BatchDeleteAttributesResponse
-> ResourceT IO (MemoryResponse BatchDeleteAttributesResponse)
loadToMemory = BatchDeleteAttributesResponse
-> ResourceT IO (MemoryResponse BatchDeleteAttributesResponse)
BatchDeleteAttributesResponse
-> ResourceT IO BatchDeleteAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return