{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}
{-# LANGUAGE TypeFamilies       #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds   #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.SDB.GetAttributes
    (
    
      getAttributes
    , GetAttributes
    
    , gaConsistentRead
    , gaAttributeNames
    , gaDomainName
    , gaItemName
    
    , getAttributesResponse
    , GetAttributesResponse
    
    , garsAttributes
    , garsResponseStatus
    ) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SDB.Types
import Network.AWS.SDB.Types.Product
data GetAttributes = GetAttributes'
  { _gaConsistentRead :: !(Maybe Bool)
  , _gaAttributeNames :: !(Maybe [Text])
  , _gaDomainName     :: !Text
  , _gaItemName       :: !Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
getAttributes
    :: Text 
    -> Text 
    -> GetAttributes
getAttributes pDomainName_ pItemName_ =
  GetAttributes'
    { _gaConsistentRead = Nothing
    , _gaAttributeNames = Nothing
    , _gaDomainName = pDomainName_
    , _gaItemName = pItemName_
    }
gaConsistentRead :: Lens' GetAttributes (Maybe Bool)
gaConsistentRead = lens _gaConsistentRead (\ s a -> s{_gaConsistentRead = a})
gaAttributeNames :: Lens' GetAttributes [Text]
gaAttributeNames = lens _gaAttributeNames (\ s a -> s{_gaAttributeNames = a}) . _Default . _Coerce
gaDomainName :: Lens' GetAttributes Text
gaDomainName = lens _gaDomainName (\ s a -> s{_gaDomainName = a})
gaItemName :: Lens' GetAttributes Text
gaItemName = lens _gaItemName (\ s a -> s{_gaItemName = a})
instance AWSRequest GetAttributes where
        type Rs GetAttributes = GetAttributesResponse
        request = postQuery sdb
        response
          = receiveXMLWrapper "GetAttributesResult"
              (\ s h x ->
                 GetAttributesResponse' <$>
                   (may (parseXMLList "Attribute") x) <*>
                     (pure (fromEnum s)))
instance Hashable GetAttributes where
instance NFData GetAttributes where
instance ToHeaders GetAttributes where
        toHeaders = const mempty
instance ToPath GetAttributes where
        toPath = const "/"
instance ToQuery GetAttributes where
        toQuery GetAttributes'{..}
          = mconcat
              ["Action" =: ("GetAttributes" :: ByteString),
               "Version" =: ("2009-04-15" :: ByteString),
               "ConsistentRead" =: _gaConsistentRead,
               toQuery
                 (toQueryList "AttributeName" <$> _gaAttributeNames),
               "DomainName" =: _gaDomainName,
               "ItemName" =: _gaItemName]
data GetAttributesResponse = GetAttributesResponse'
  { _garsAttributes     :: !(Maybe [Attribute])
  , _garsResponseStatus :: !Int
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
getAttributesResponse
    :: Int 
    -> GetAttributesResponse
getAttributesResponse pResponseStatus_ =
  GetAttributesResponse'
    {_garsAttributes = Nothing, _garsResponseStatus = pResponseStatus_}
garsAttributes :: Lens' GetAttributesResponse [Attribute]
garsAttributes = lens _garsAttributes (\ s a -> s{_garsAttributes = a}) . _Default . _Coerce
garsResponseStatus :: Lens' GetAttributesResponse Int
garsResponseStatus = lens _garsResponseStatus (\ s a -> s{_garsResponseStatus = a})
instance NFData GetAttributesResponse where