{-# 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.DefineSuggester
(
DefineSuggester (..),
newDefineSuggester,
defineSuggester_domainName,
defineSuggester_suggester,
DefineSuggesterResponse (..),
newDefineSuggesterResponse,
defineSuggesterResponse_httpStatus,
defineSuggesterResponse_suggester,
)
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 DefineSuggester = DefineSuggester'
{ DefineSuggester -> Text
domainName :: Prelude.Text,
DefineSuggester -> Suggester
suggester :: Suggester
}
deriving (DefineSuggester -> DefineSuggester -> Bool
(DefineSuggester -> DefineSuggester -> Bool)
-> (DefineSuggester -> DefineSuggester -> Bool)
-> Eq DefineSuggester
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefineSuggester -> DefineSuggester -> Bool
$c/= :: DefineSuggester -> DefineSuggester -> Bool
== :: DefineSuggester -> DefineSuggester -> Bool
$c== :: DefineSuggester -> DefineSuggester -> Bool
Prelude.Eq, ReadPrec [DefineSuggester]
ReadPrec DefineSuggester
Int -> ReadS DefineSuggester
ReadS [DefineSuggester]
(Int -> ReadS DefineSuggester)
-> ReadS [DefineSuggester]
-> ReadPrec DefineSuggester
-> ReadPrec [DefineSuggester]
-> Read DefineSuggester
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefineSuggester]
$creadListPrec :: ReadPrec [DefineSuggester]
readPrec :: ReadPrec DefineSuggester
$creadPrec :: ReadPrec DefineSuggester
readList :: ReadS [DefineSuggester]
$creadList :: ReadS [DefineSuggester]
readsPrec :: Int -> ReadS DefineSuggester
$creadsPrec :: Int -> ReadS DefineSuggester
Prelude.Read, Int -> DefineSuggester -> ShowS
[DefineSuggester] -> ShowS
DefineSuggester -> String
(Int -> DefineSuggester -> ShowS)
-> (DefineSuggester -> String)
-> ([DefineSuggester] -> ShowS)
-> Show DefineSuggester
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefineSuggester] -> ShowS
$cshowList :: [DefineSuggester] -> ShowS
show :: DefineSuggester -> String
$cshow :: DefineSuggester -> String
showsPrec :: Int -> DefineSuggester -> ShowS
$cshowsPrec :: Int -> DefineSuggester -> ShowS
Prelude.Show, (forall x. DefineSuggester -> Rep DefineSuggester x)
-> (forall x. Rep DefineSuggester x -> DefineSuggester)
-> Generic DefineSuggester
forall x. Rep DefineSuggester x -> DefineSuggester
forall x. DefineSuggester -> Rep DefineSuggester x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefineSuggester x -> DefineSuggester
$cfrom :: forall x. DefineSuggester -> Rep DefineSuggester x
Prelude.Generic)
newDefineSuggester ::
Prelude.Text ->
Suggester ->
DefineSuggester
newDefineSuggester :: Text -> Suggester -> DefineSuggester
newDefineSuggester Text
pDomainName_ Suggester
pSuggester_ =
DefineSuggester' :: Text -> Suggester -> DefineSuggester
DefineSuggester'
{ $sel:domainName:DefineSuggester' :: Text
domainName = Text
pDomainName_,
$sel:suggester:DefineSuggester' :: Suggester
suggester = Suggester
pSuggester_
}
defineSuggester_domainName :: Lens.Lens' DefineSuggester Prelude.Text
defineSuggester_domainName :: (Text -> f Text) -> DefineSuggester -> f DefineSuggester
defineSuggester_domainName = (DefineSuggester -> Text)
-> (DefineSuggester -> Text -> DefineSuggester)
-> Lens DefineSuggester DefineSuggester Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineSuggester' {Text
domainName :: Text
$sel:domainName:DefineSuggester' :: DefineSuggester -> Text
domainName} -> Text
domainName) (\s :: DefineSuggester
s@DefineSuggester' {} Text
a -> DefineSuggester
s {$sel:domainName:DefineSuggester' :: Text
domainName = Text
a} :: DefineSuggester)
defineSuggester_suggester :: Lens.Lens' DefineSuggester Suggester
defineSuggester_suggester :: (Suggester -> f Suggester) -> DefineSuggester -> f DefineSuggester
defineSuggester_suggester = (DefineSuggester -> Suggester)
-> (DefineSuggester -> Suggester -> DefineSuggester)
-> Lens DefineSuggester DefineSuggester Suggester Suggester
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineSuggester' {Suggester
suggester :: Suggester
$sel:suggester:DefineSuggester' :: DefineSuggester -> Suggester
suggester} -> Suggester
suggester) (\s :: DefineSuggester
s@DefineSuggester' {} Suggester
a -> DefineSuggester
s {$sel:suggester:DefineSuggester' :: Suggester
suggester = Suggester
a} :: DefineSuggester)
instance Core.AWSRequest DefineSuggester where
type
AWSResponse DefineSuggester =
DefineSuggesterResponse
request :: DefineSuggester -> Request DefineSuggester
request = Service -> DefineSuggester -> Request DefineSuggester
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DefineSuggester
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DefineSuggester)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DefineSuggester))
-> Logger
-> Service
-> Proxy DefineSuggester
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DefineSuggester)))
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
"DefineSuggesterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> SuggesterStatus -> DefineSuggesterResponse
DefineSuggesterResponse'
(Int -> SuggesterStatus -> DefineSuggesterResponse)
-> Either String Int
-> Either String (SuggesterStatus -> DefineSuggesterResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (SuggesterStatus -> DefineSuggesterResponse)
-> Either String SuggesterStatus
-> Either String DefineSuggesterResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String SuggesterStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Suggester")
)
instance Prelude.Hashable DefineSuggester
instance Prelude.NFData DefineSuggester
instance Core.ToHeaders DefineSuggester where
toHeaders :: DefineSuggester -> ResponseHeaders
toHeaders = ResponseHeaders -> DefineSuggester -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DefineSuggester where
toPath :: DefineSuggester -> ByteString
toPath = ByteString -> DefineSuggester -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DefineSuggester where
toQuery :: DefineSuggester -> QueryString
toQuery DefineSuggester' {Text
Suggester
suggester :: Suggester
domainName :: Text
$sel:suggester:DefineSuggester' :: DefineSuggester -> Suggester
$sel:domainName:DefineSuggester' :: DefineSuggester -> 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
"DefineSuggester" :: 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,
ByteString
"Suggester" ByteString -> Suggester -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Suggester
suggester
]
data DefineSuggesterResponse = DefineSuggesterResponse'
{
DefineSuggesterResponse -> Int
httpStatus :: Prelude.Int,
DefineSuggesterResponse -> SuggesterStatus
suggester :: SuggesterStatus
}
deriving (DefineSuggesterResponse -> DefineSuggesterResponse -> Bool
(DefineSuggesterResponse -> DefineSuggesterResponse -> Bool)
-> (DefineSuggesterResponse -> DefineSuggesterResponse -> Bool)
-> Eq DefineSuggesterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefineSuggesterResponse -> DefineSuggesterResponse -> Bool
$c/= :: DefineSuggesterResponse -> DefineSuggesterResponse -> Bool
== :: DefineSuggesterResponse -> DefineSuggesterResponse -> Bool
$c== :: DefineSuggesterResponse -> DefineSuggesterResponse -> Bool
Prelude.Eq, ReadPrec [DefineSuggesterResponse]
ReadPrec DefineSuggesterResponse
Int -> ReadS DefineSuggesterResponse
ReadS [DefineSuggesterResponse]
(Int -> ReadS DefineSuggesterResponse)
-> ReadS [DefineSuggesterResponse]
-> ReadPrec DefineSuggesterResponse
-> ReadPrec [DefineSuggesterResponse]
-> Read DefineSuggesterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefineSuggesterResponse]
$creadListPrec :: ReadPrec [DefineSuggesterResponse]
readPrec :: ReadPrec DefineSuggesterResponse
$creadPrec :: ReadPrec DefineSuggesterResponse
readList :: ReadS [DefineSuggesterResponse]
$creadList :: ReadS [DefineSuggesterResponse]
readsPrec :: Int -> ReadS DefineSuggesterResponse
$creadsPrec :: Int -> ReadS DefineSuggesterResponse
Prelude.Read, Int -> DefineSuggesterResponse -> ShowS
[DefineSuggesterResponse] -> ShowS
DefineSuggesterResponse -> String
(Int -> DefineSuggesterResponse -> ShowS)
-> (DefineSuggesterResponse -> String)
-> ([DefineSuggesterResponse] -> ShowS)
-> Show DefineSuggesterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefineSuggesterResponse] -> ShowS
$cshowList :: [DefineSuggesterResponse] -> ShowS
show :: DefineSuggesterResponse -> String
$cshow :: DefineSuggesterResponse -> String
showsPrec :: Int -> DefineSuggesterResponse -> ShowS
$cshowsPrec :: Int -> DefineSuggesterResponse -> ShowS
Prelude.Show, (forall x.
DefineSuggesterResponse -> Rep DefineSuggesterResponse x)
-> (forall x.
Rep DefineSuggesterResponse x -> DefineSuggesterResponse)
-> Generic DefineSuggesterResponse
forall x. Rep DefineSuggesterResponse x -> DefineSuggesterResponse
forall x. DefineSuggesterResponse -> Rep DefineSuggesterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefineSuggesterResponse x -> DefineSuggesterResponse
$cfrom :: forall x. DefineSuggesterResponse -> Rep DefineSuggesterResponse x
Prelude.Generic)
newDefineSuggesterResponse ::
Prelude.Int ->
SuggesterStatus ->
DefineSuggesterResponse
newDefineSuggesterResponse :: Int -> SuggesterStatus -> DefineSuggesterResponse
newDefineSuggesterResponse Int
pHttpStatus_ SuggesterStatus
pSuggester_ =
DefineSuggesterResponse' :: Int -> SuggesterStatus -> DefineSuggesterResponse
DefineSuggesterResponse'
{ $sel:httpStatus:DefineSuggesterResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:suggester:DefineSuggesterResponse' :: SuggesterStatus
suggester = SuggesterStatus
pSuggester_
}
defineSuggesterResponse_httpStatus :: Lens.Lens' DefineSuggesterResponse Prelude.Int
defineSuggesterResponse_httpStatus :: (Int -> f Int)
-> DefineSuggesterResponse -> f DefineSuggesterResponse
defineSuggesterResponse_httpStatus = (DefineSuggesterResponse -> Int)
-> (DefineSuggesterResponse -> Int -> DefineSuggesterResponse)
-> Lens DefineSuggesterResponse DefineSuggesterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineSuggesterResponse' {Int
httpStatus :: Int
$sel:httpStatus:DefineSuggesterResponse' :: DefineSuggesterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DefineSuggesterResponse
s@DefineSuggesterResponse' {} Int
a -> DefineSuggesterResponse
s {$sel:httpStatus:DefineSuggesterResponse' :: Int
httpStatus = Int
a} :: DefineSuggesterResponse)
defineSuggesterResponse_suggester :: Lens.Lens' DefineSuggesterResponse SuggesterStatus
defineSuggesterResponse_suggester :: (SuggesterStatus -> f SuggesterStatus)
-> DefineSuggesterResponse -> f DefineSuggesterResponse
defineSuggesterResponse_suggester = (DefineSuggesterResponse -> SuggesterStatus)
-> (DefineSuggesterResponse
-> SuggesterStatus -> DefineSuggesterResponse)
-> Lens
DefineSuggesterResponse
DefineSuggesterResponse
SuggesterStatus
SuggesterStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineSuggesterResponse' {SuggesterStatus
suggester :: SuggesterStatus
$sel:suggester:DefineSuggesterResponse' :: DefineSuggesterResponse -> SuggesterStatus
suggester} -> SuggesterStatus
suggester) (\s :: DefineSuggesterResponse
s@DefineSuggesterResponse' {} SuggesterStatus
a -> DefineSuggesterResponse
s {$sel:suggester:DefineSuggesterResponse' :: SuggesterStatus
suggester = SuggesterStatus
a} :: DefineSuggesterResponse)
instance Prelude.NFData DefineSuggesterResponse