{-# 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.CloudSearch.BuildSuggesters
(
BuildSuggesters (..),
newBuildSuggesters,
buildSuggesters_domainName,
BuildSuggestersResponse (..),
newBuildSuggestersResponse,
buildSuggestersResponse_fieldNames,
buildSuggestersResponse_httpStatus,
)
where
import Amazonka.CloudSearch.Types
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
data BuildSuggesters = BuildSuggesters'
{ BuildSuggesters -> Text
domainName :: Prelude.Text
}
deriving (BuildSuggesters -> BuildSuggesters -> Bool
(BuildSuggesters -> BuildSuggesters -> Bool)
-> (BuildSuggesters -> BuildSuggesters -> Bool)
-> Eq BuildSuggesters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuildSuggesters -> BuildSuggesters -> Bool
$c/= :: BuildSuggesters -> BuildSuggesters -> Bool
== :: BuildSuggesters -> BuildSuggesters -> Bool
$c== :: BuildSuggesters -> BuildSuggesters -> Bool
Prelude.Eq, ReadPrec [BuildSuggesters]
ReadPrec BuildSuggesters
Int -> ReadS BuildSuggesters
ReadS [BuildSuggesters]
(Int -> ReadS BuildSuggesters)
-> ReadS [BuildSuggesters]
-> ReadPrec BuildSuggesters
-> ReadPrec [BuildSuggesters]
-> Read BuildSuggesters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuildSuggesters]
$creadListPrec :: ReadPrec [BuildSuggesters]
readPrec :: ReadPrec BuildSuggesters
$creadPrec :: ReadPrec BuildSuggesters
readList :: ReadS [BuildSuggesters]
$creadList :: ReadS [BuildSuggesters]
readsPrec :: Int -> ReadS BuildSuggesters
$creadsPrec :: Int -> ReadS BuildSuggesters
Prelude.Read, Int -> BuildSuggesters -> ShowS
[BuildSuggesters] -> ShowS
BuildSuggesters -> String
(Int -> BuildSuggesters -> ShowS)
-> (BuildSuggesters -> String)
-> ([BuildSuggesters] -> ShowS)
-> Show BuildSuggesters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuildSuggesters] -> ShowS
$cshowList :: [BuildSuggesters] -> ShowS
show :: BuildSuggesters -> String
$cshow :: BuildSuggesters -> String
showsPrec :: Int -> BuildSuggesters -> ShowS
$cshowsPrec :: Int -> BuildSuggesters -> ShowS
Prelude.Show, (forall x. BuildSuggesters -> Rep BuildSuggesters x)
-> (forall x. Rep BuildSuggesters x -> BuildSuggesters)
-> Generic BuildSuggesters
forall x. Rep BuildSuggesters x -> BuildSuggesters
forall x. BuildSuggesters -> Rep BuildSuggesters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuildSuggesters x -> BuildSuggesters
$cfrom :: forall x. BuildSuggesters -> Rep BuildSuggesters x
Prelude.Generic)
newBuildSuggesters ::
Prelude.Text ->
BuildSuggesters
newBuildSuggesters :: Text -> BuildSuggesters
newBuildSuggesters Text
pDomainName_ =
BuildSuggesters' :: Text -> BuildSuggesters
BuildSuggesters' {$sel:domainName:BuildSuggesters' :: Text
domainName = Text
pDomainName_}
buildSuggesters_domainName :: Lens.Lens' BuildSuggesters Prelude.Text
buildSuggesters_domainName :: (Text -> f Text) -> BuildSuggesters -> f BuildSuggesters
buildSuggesters_domainName = (BuildSuggesters -> Text)
-> (BuildSuggesters -> Text -> BuildSuggesters)
-> Lens BuildSuggesters BuildSuggesters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildSuggesters' {Text
domainName :: Text
$sel:domainName:BuildSuggesters' :: BuildSuggesters -> Text
domainName} -> Text
domainName) (\s :: BuildSuggesters
s@BuildSuggesters' {} Text
a -> BuildSuggesters
s {$sel:domainName:BuildSuggesters' :: Text
domainName = Text
a} :: BuildSuggesters)
instance Core.AWSRequest BuildSuggesters where
type
AWSResponse BuildSuggesters =
BuildSuggestersResponse
request :: BuildSuggesters -> Request BuildSuggesters
request = Service -> BuildSuggesters -> Request BuildSuggesters
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy BuildSuggesters
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BuildSuggesters)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse BuildSuggesters))
-> Logger
-> Service
-> Proxy BuildSuggesters
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BuildSuggesters)))
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
"BuildSuggestersResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Text] -> Int -> BuildSuggestersResponse
BuildSuggestersResponse'
(Maybe [Text] -> Int -> BuildSuggestersResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> BuildSuggestersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FieldNames" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> BuildSuggestersResponse)
-> Either String Int -> Either String BuildSuggestersResponse
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 BuildSuggesters
instance Prelude.NFData BuildSuggesters
instance Core.ToHeaders BuildSuggesters where
toHeaders :: BuildSuggesters -> ResponseHeaders
toHeaders = ResponseHeaders -> BuildSuggesters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath BuildSuggesters where
toPath :: BuildSuggesters -> ByteString
toPath = ByteString -> BuildSuggesters -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BuildSuggesters where
toQuery :: BuildSuggesters -> QueryString
toQuery BuildSuggesters' {Text
domainName :: Text
$sel:domainName:BuildSuggesters' :: BuildSuggesters -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"BuildSuggesters" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2013-01-01" :: Prelude.ByteString),
ByteString
"DomainName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domainName
]
data BuildSuggestersResponse = BuildSuggestersResponse'
{ BuildSuggestersResponse -> Maybe [Text]
fieldNames :: Prelude.Maybe [Prelude.Text],
BuildSuggestersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BuildSuggestersResponse -> BuildSuggestersResponse -> Bool
(BuildSuggestersResponse -> BuildSuggestersResponse -> Bool)
-> (BuildSuggestersResponse -> BuildSuggestersResponse -> Bool)
-> Eq BuildSuggestersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuildSuggestersResponse -> BuildSuggestersResponse -> Bool
$c/= :: BuildSuggestersResponse -> BuildSuggestersResponse -> Bool
== :: BuildSuggestersResponse -> BuildSuggestersResponse -> Bool
$c== :: BuildSuggestersResponse -> BuildSuggestersResponse -> Bool
Prelude.Eq, ReadPrec [BuildSuggestersResponse]
ReadPrec BuildSuggestersResponse
Int -> ReadS BuildSuggestersResponse
ReadS [BuildSuggestersResponse]
(Int -> ReadS BuildSuggestersResponse)
-> ReadS [BuildSuggestersResponse]
-> ReadPrec BuildSuggestersResponse
-> ReadPrec [BuildSuggestersResponse]
-> Read BuildSuggestersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuildSuggestersResponse]
$creadListPrec :: ReadPrec [BuildSuggestersResponse]
readPrec :: ReadPrec BuildSuggestersResponse
$creadPrec :: ReadPrec BuildSuggestersResponse
readList :: ReadS [BuildSuggestersResponse]
$creadList :: ReadS [BuildSuggestersResponse]
readsPrec :: Int -> ReadS BuildSuggestersResponse
$creadsPrec :: Int -> ReadS BuildSuggestersResponse
Prelude.Read, Int -> BuildSuggestersResponse -> ShowS
[BuildSuggestersResponse] -> ShowS
BuildSuggestersResponse -> String
(Int -> BuildSuggestersResponse -> ShowS)
-> (BuildSuggestersResponse -> String)
-> ([BuildSuggestersResponse] -> ShowS)
-> Show BuildSuggestersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuildSuggestersResponse] -> ShowS
$cshowList :: [BuildSuggestersResponse] -> ShowS
show :: BuildSuggestersResponse -> String
$cshow :: BuildSuggestersResponse -> String
showsPrec :: Int -> BuildSuggestersResponse -> ShowS
$cshowsPrec :: Int -> BuildSuggestersResponse -> ShowS
Prelude.Show, (forall x.
BuildSuggestersResponse -> Rep BuildSuggestersResponse x)
-> (forall x.
Rep BuildSuggestersResponse x -> BuildSuggestersResponse)
-> Generic BuildSuggestersResponse
forall x. Rep BuildSuggestersResponse x -> BuildSuggestersResponse
forall x. BuildSuggestersResponse -> Rep BuildSuggestersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuildSuggestersResponse x -> BuildSuggestersResponse
$cfrom :: forall x. BuildSuggestersResponse -> Rep BuildSuggestersResponse x
Prelude.Generic)
newBuildSuggestersResponse ::
Prelude.Int ->
BuildSuggestersResponse
newBuildSuggestersResponse :: Int -> BuildSuggestersResponse
newBuildSuggestersResponse Int
pHttpStatus_ =
BuildSuggestersResponse' :: Maybe [Text] -> Int -> BuildSuggestersResponse
BuildSuggestersResponse'
{ $sel:fieldNames:BuildSuggestersResponse' :: Maybe [Text]
fieldNames =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BuildSuggestersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
buildSuggestersResponse_fieldNames :: Lens.Lens' BuildSuggestersResponse (Prelude.Maybe [Prelude.Text])
buildSuggestersResponse_fieldNames :: (Maybe [Text] -> f (Maybe [Text]))
-> BuildSuggestersResponse -> f BuildSuggestersResponse
buildSuggestersResponse_fieldNames = (BuildSuggestersResponse -> Maybe [Text])
-> (BuildSuggestersResponse
-> Maybe [Text] -> BuildSuggestersResponse)
-> Lens
BuildSuggestersResponse
BuildSuggestersResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildSuggestersResponse' {Maybe [Text]
fieldNames :: Maybe [Text]
$sel:fieldNames:BuildSuggestersResponse' :: BuildSuggestersResponse -> Maybe [Text]
fieldNames} -> Maybe [Text]
fieldNames) (\s :: BuildSuggestersResponse
s@BuildSuggestersResponse' {} Maybe [Text]
a -> BuildSuggestersResponse
s {$sel:fieldNames:BuildSuggestersResponse' :: Maybe [Text]
fieldNames = Maybe [Text]
a} :: BuildSuggestersResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> BuildSuggestersResponse -> f BuildSuggestersResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> BuildSuggestersResponse
-> f BuildSuggestersResponse
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
buildSuggestersResponse_httpStatus :: Lens.Lens' BuildSuggestersResponse Prelude.Int
buildSuggestersResponse_httpStatus :: (Int -> f Int)
-> BuildSuggestersResponse -> f BuildSuggestersResponse
buildSuggestersResponse_httpStatus = (BuildSuggestersResponse -> Int)
-> (BuildSuggestersResponse -> Int -> BuildSuggestersResponse)
-> Lens BuildSuggestersResponse BuildSuggestersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildSuggestersResponse' {Int
httpStatus :: Int
$sel:httpStatus:BuildSuggestersResponse' :: BuildSuggestersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BuildSuggestersResponse
s@BuildSuggestersResponse' {} Int
a -> BuildSuggestersResponse
s {$sel:httpStatus:BuildSuggestersResponse' :: Int
httpStatus = Int
a} :: BuildSuggestersResponse)
instance Prelude.NFData BuildSuggestersResponse