{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SDB.GetAttributes
(
GetAttributes (..),
newGetAttributes,
getAttributes_consistentRead,
getAttributes_attributeNames,
getAttributes_domainName,
getAttributes_itemName,
GetAttributesResponse (..),
newGetAttributesResponse,
getAttributesResponse_attributes,
getAttributesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SDB.Types
data GetAttributes = GetAttributes'
{
GetAttributes -> Maybe Bool
consistentRead :: Prelude.Maybe Prelude.Bool,
GetAttributes -> Maybe [Text]
attributeNames :: Prelude.Maybe [Prelude.Text],
GetAttributes -> Text
domainName :: Prelude.Text,
GetAttributes -> Text
itemName :: Prelude.Text
}
deriving (GetAttributes -> GetAttributes -> Bool
(GetAttributes -> GetAttributes -> Bool)
-> (GetAttributes -> GetAttributes -> Bool) -> Eq GetAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttributes -> GetAttributes -> Bool
$c/= :: GetAttributes -> GetAttributes -> Bool
== :: GetAttributes -> GetAttributes -> Bool
$c== :: GetAttributes -> GetAttributes -> Bool
Prelude.Eq, ReadPrec [GetAttributes]
ReadPrec GetAttributes
Int -> ReadS GetAttributes
ReadS [GetAttributes]
(Int -> ReadS GetAttributes)
-> ReadS [GetAttributes]
-> ReadPrec GetAttributes
-> ReadPrec [GetAttributes]
-> Read GetAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttributes]
$creadListPrec :: ReadPrec [GetAttributes]
readPrec :: ReadPrec GetAttributes
$creadPrec :: ReadPrec GetAttributes
readList :: ReadS [GetAttributes]
$creadList :: ReadS [GetAttributes]
readsPrec :: Int -> ReadS GetAttributes
$creadsPrec :: Int -> ReadS GetAttributes
Prelude.Read, 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
showList :: [GetAttributes] -> ShowS
$cshowList :: [GetAttributes] -> ShowS
show :: GetAttributes -> String
$cshow :: GetAttributes -> String
showsPrec :: Int -> GetAttributes -> ShowS
$cshowsPrec :: Int -> GetAttributes -> ShowS
Prelude.Show, (forall x. GetAttributes -> Rep GetAttributes x)
-> (forall x. Rep GetAttributes x -> GetAttributes)
-> Generic GetAttributes
forall x. Rep GetAttributes x -> GetAttributes
forall x. GetAttributes -> Rep GetAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttributes x -> GetAttributes
$cfrom :: forall x. GetAttributes -> Rep GetAttributes x
Prelude.Generic)
newGetAttributes ::
Prelude.Text ->
Prelude.Text ->
GetAttributes
newGetAttributes :: Text -> Text -> GetAttributes
newGetAttributes Text
pDomainName_ Text
pItemName_ =
GetAttributes' :: Maybe Bool -> Maybe [Text] -> Text -> Text -> GetAttributes
GetAttributes'
{ $sel:consistentRead:GetAttributes' :: Maybe Bool
consistentRead = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:attributeNames:GetAttributes' :: Maybe [Text]
attributeNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:domainName:GetAttributes' :: Text
domainName = Text
pDomainName_,
$sel:itemName:GetAttributes' :: Text
itemName = Text
pItemName_
}
getAttributes_consistentRead :: Lens.Lens' GetAttributes (Prelude.Maybe Prelude.Bool)
getAttributes_consistentRead :: (Maybe Bool -> f (Maybe Bool)) -> GetAttributes -> f GetAttributes
getAttributes_consistentRead = (GetAttributes -> Maybe Bool)
-> (GetAttributes -> Maybe Bool -> GetAttributes)
-> Lens GetAttributes GetAttributes (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributes' {Maybe Bool
consistentRead :: Maybe Bool
$sel:consistentRead:GetAttributes' :: GetAttributes -> Maybe Bool
consistentRead} -> Maybe Bool
consistentRead) (\s :: GetAttributes
s@GetAttributes' {} Maybe Bool
a -> GetAttributes
s {$sel:consistentRead:GetAttributes' :: Maybe Bool
consistentRead = Maybe Bool
a} :: GetAttributes)
getAttributes_attributeNames :: Lens.Lens' GetAttributes (Prelude.Maybe [Prelude.Text])
getAttributes_attributeNames :: (Maybe [Text] -> f (Maybe [Text]))
-> GetAttributes -> f GetAttributes
getAttributes_attributeNames = (GetAttributes -> Maybe [Text])
-> (GetAttributes -> Maybe [Text] -> GetAttributes)
-> Lens GetAttributes GetAttributes (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributes' {Maybe [Text]
attributeNames :: Maybe [Text]
$sel:attributeNames:GetAttributes' :: GetAttributes -> Maybe [Text]
attributeNames} -> Maybe [Text]
attributeNames) (\s :: GetAttributes
s@GetAttributes' {} Maybe [Text]
a -> GetAttributes
s {$sel:attributeNames:GetAttributes' :: Maybe [Text]
attributeNames = Maybe [Text]
a} :: GetAttributes) ((Maybe [Text] -> f (Maybe [Text]))
-> GetAttributes -> f GetAttributes)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetAttributes
-> f GetAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getAttributes_domainName :: Lens.Lens' GetAttributes Prelude.Text
getAttributes_domainName :: (Text -> f Text) -> GetAttributes -> f GetAttributes
getAttributes_domainName = (GetAttributes -> Text)
-> (GetAttributes -> Text -> GetAttributes)
-> Lens GetAttributes GetAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributes' {Text
domainName :: Text
$sel:domainName:GetAttributes' :: GetAttributes -> Text
domainName} -> Text
domainName) (\s :: GetAttributes
s@GetAttributes' {} Text
a -> GetAttributes
s {$sel:domainName:GetAttributes' :: Text
domainName = Text
a} :: GetAttributes)
getAttributes_itemName :: Lens.Lens' GetAttributes Prelude.Text
getAttributes_itemName :: (Text -> f Text) -> GetAttributes -> f GetAttributes
getAttributes_itemName = (GetAttributes -> Text)
-> (GetAttributes -> Text -> GetAttributes)
-> Lens GetAttributes GetAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributes' {Text
itemName :: Text
$sel:itemName:GetAttributes' :: GetAttributes -> Text
itemName} -> Text
itemName) (\s :: GetAttributes
s@GetAttributes' {} Text
a -> GetAttributes
s {$sel:itemName:GetAttributes' :: Text
itemName = Text
a} :: GetAttributes)
instance Core.AWSRequest GetAttributes where
type
AWSResponse GetAttributes =
GetAttributesResponse
request :: GetAttributes -> Request GetAttributes
request = Service -> GetAttributes -> Request GetAttributes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttributes)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetAttributes))
-> Logger
-> Service
-> Proxy GetAttributes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetAttributesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Attribute] -> Int -> GetAttributesResponse
GetAttributesResponse'
(Maybe [Attribute] -> Int -> GetAttributesResponse)
-> Either String (Maybe [Attribute])
-> Either String (Int -> GetAttributesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (([Node] -> Either String [Attribute])
-> [Node] -> Either String (Maybe [Attribute])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Attribute]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Attribute") [Node]
x)
Either String (Int -> GetAttributesResponse)
-> Either String Int -> Either String GetAttributesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetAttributes
instance Prelude.NFData GetAttributes
instance Core.ToHeaders GetAttributes where
toHeaders :: GetAttributes -> ResponseHeaders
toHeaders = ResponseHeaders -> GetAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetAttributes where
toPath :: GetAttributes -> ByteString
toPath = ByteString -> GetAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetAttributes where
toQuery :: GetAttributes -> QueryString
toQuery GetAttributes' {Maybe Bool
Maybe [Text]
Text
itemName :: Text
domainName :: Text
attributeNames :: Maybe [Text]
consistentRead :: Maybe Bool
$sel:itemName:GetAttributes' :: GetAttributes -> Text
$sel:domainName:GetAttributes' :: GetAttributes -> Text
$sel:attributeNames:GetAttributes' :: GetAttributes -> Maybe [Text]
$sel:consistentRead:GetAttributes' :: GetAttributes -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetAttributes" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2009-04-15" :: Prelude.ByteString),
ByteString
"ConsistentRead" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
consistentRead,
Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"AttributeName"
([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
attributeNames
),
ByteString
"DomainName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domainName,
ByteString
"ItemName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
itemName
]
data GetAttributesResponse = GetAttributesResponse'
{
GetAttributesResponse -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
GetAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAttributesResponse -> GetAttributesResponse -> Bool
(GetAttributesResponse -> GetAttributesResponse -> Bool)
-> (GetAttributesResponse -> GetAttributesResponse -> Bool)
-> Eq GetAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttributesResponse -> GetAttributesResponse -> Bool
$c/= :: GetAttributesResponse -> GetAttributesResponse -> Bool
== :: GetAttributesResponse -> GetAttributesResponse -> Bool
$c== :: GetAttributesResponse -> GetAttributesResponse -> Bool
Prelude.Eq, ReadPrec [GetAttributesResponse]
ReadPrec GetAttributesResponse
Int -> ReadS GetAttributesResponse
ReadS [GetAttributesResponse]
(Int -> ReadS GetAttributesResponse)
-> ReadS [GetAttributesResponse]
-> ReadPrec GetAttributesResponse
-> ReadPrec [GetAttributesResponse]
-> Read GetAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttributesResponse]
$creadListPrec :: ReadPrec [GetAttributesResponse]
readPrec :: ReadPrec GetAttributesResponse
$creadPrec :: ReadPrec GetAttributesResponse
readList :: ReadS [GetAttributesResponse]
$creadList :: ReadS [GetAttributesResponse]
readsPrec :: Int -> ReadS GetAttributesResponse
$creadsPrec :: Int -> ReadS GetAttributesResponse
Prelude.Read, 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
showList :: [GetAttributesResponse] -> ShowS
$cshowList :: [GetAttributesResponse] -> ShowS
show :: GetAttributesResponse -> String
$cshow :: GetAttributesResponse -> String
showsPrec :: Int -> GetAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetAttributesResponse -> ShowS
Prelude.Show, (forall x. GetAttributesResponse -> Rep GetAttributesResponse x)
-> (forall x. Rep GetAttributesResponse x -> GetAttributesResponse)
-> Generic GetAttributesResponse
forall x. Rep GetAttributesResponse x -> GetAttributesResponse
forall x. GetAttributesResponse -> Rep GetAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttributesResponse x -> GetAttributesResponse
$cfrom :: forall x. GetAttributesResponse -> Rep GetAttributesResponse x
Prelude.Generic)
newGetAttributesResponse ::
Prelude.Int ->
GetAttributesResponse
newGetAttributesResponse :: Int -> GetAttributesResponse
newGetAttributesResponse Int
pHttpStatus_ =
GetAttributesResponse' :: Maybe [Attribute] -> Int -> GetAttributesResponse
GetAttributesResponse'
{ $sel:attributes:GetAttributesResponse' :: Maybe [Attribute]
attributes =
Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAttributesResponse_attributes :: Lens.Lens' GetAttributesResponse (Prelude.Maybe [Attribute])
getAttributesResponse_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> GetAttributesResponse -> f GetAttributesResponse
getAttributesResponse_attributes = (GetAttributesResponse -> Maybe [Attribute])
-> (GetAttributesResponse
-> Maybe [Attribute] -> GetAttributesResponse)
-> Lens
GetAttributesResponse
GetAttributesResponse
(Maybe [Attribute])
(Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributesResponse' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:GetAttributesResponse' :: GetAttributesResponse -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: GetAttributesResponse
s@GetAttributesResponse' {} Maybe [Attribute]
a -> GetAttributesResponse
s {$sel:attributes:GetAttributesResponse' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: GetAttributesResponse) ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> GetAttributesResponse -> f GetAttributesResponse)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
-> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> GetAttributesResponse
-> f GetAttributesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
(Maybe [Attribute])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getAttributesResponse_httpStatus :: Lens.Lens' GetAttributesResponse Prelude.Int
getAttributesResponse_httpStatus :: (Int -> f Int) -> GetAttributesResponse -> f GetAttributesResponse
getAttributesResponse_httpStatus = (GetAttributesResponse -> Int)
-> (GetAttributesResponse -> Int -> GetAttributesResponse)
-> Lens GetAttributesResponse GetAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAttributesResponse' :: GetAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAttributesResponse
s@GetAttributesResponse' {} Int
a -> GetAttributesResponse
s {$sel:httpStatus:GetAttributesResponse' :: Int
httpStatus = Int
a} :: GetAttributesResponse)
instance Prelude.NFData GetAttributesResponse