{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudSearch.Types.TextOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TextOptions = TextOptions'
{ TextOptions -> Maybe Text
sourceField :: Prelude.Maybe Prelude.Text,
TextOptions -> Maybe Bool
returnEnabled :: Prelude.Maybe Prelude.Bool,
TextOptions -> Maybe Text
analysisScheme :: Prelude.Maybe Prelude.Text,
TextOptions -> Maybe Bool
highlightEnabled :: Prelude.Maybe Prelude.Bool,
TextOptions -> Maybe Bool
sortEnabled :: Prelude.Maybe Prelude.Bool,
TextOptions -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text
}
deriving (TextOptions -> TextOptions -> Bool
(TextOptions -> TextOptions -> Bool)
-> (TextOptions -> TextOptions -> Bool) -> Eq TextOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextOptions -> TextOptions -> Bool
$c/= :: TextOptions -> TextOptions -> Bool
== :: TextOptions -> TextOptions -> Bool
$c== :: TextOptions -> TextOptions -> Bool
Prelude.Eq, ReadPrec [TextOptions]
ReadPrec TextOptions
Int -> ReadS TextOptions
ReadS [TextOptions]
(Int -> ReadS TextOptions)
-> ReadS [TextOptions]
-> ReadPrec TextOptions
-> ReadPrec [TextOptions]
-> Read TextOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextOptions]
$creadListPrec :: ReadPrec [TextOptions]
readPrec :: ReadPrec TextOptions
$creadPrec :: ReadPrec TextOptions
readList :: ReadS [TextOptions]
$creadList :: ReadS [TextOptions]
readsPrec :: Int -> ReadS TextOptions
$creadsPrec :: Int -> ReadS TextOptions
Prelude.Read, Int -> TextOptions -> ShowS
[TextOptions] -> ShowS
TextOptions -> String
(Int -> TextOptions -> ShowS)
-> (TextOptions -> String)
-> ([TextOptions] -> ShowS)
-> Show TextOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextOptions] -> ShowS
$cshowList :: [TextOptions] -> ShowS
show :: TextOptions -> String
$cshow :: TextOptions -> String
showsPrec :: Int -> TextOptions -> ShowS
$cshowsPrec :: Int -> TextOptions -> ShowS
Prelude.Show, (forall x. TextOptions -> Rep TextOptions x)
-> (forall x. Rep TextOptions x -> TextOptions)
-> Generic TextOptions
forall x. Rep TextOptions x -> TextOptions
forall x. TextOptions -> Rep TextOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextOptions x -> TextOptions
$cfrom :: forall x. TextOptions -> Rep TextOptions x
Prelude.Generic)
newTextOptions ::
TextOptions
newTextOptions :: TextOptions
newTextOptions =
TextOptions' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> TextOptions
TextOptions'
{ $sel:sourceField:TextOptions' :: Maybe Text
sourceField = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:returnEnabled:TextOptions' :: Maybe Bool
returnEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:analysisScheme:TextOptions' :: Maybe Text
analysisScheme = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:highlightEnabled:TextOptions' :: Maybe Bool
highlightEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:sortEnabled:TextOptions' :: Maybe Bool
sortEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:defaultValue:TextOptions' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
textOptions_sourceField :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Text)
textOptions_sourceField :: (Maybe Text -> f (Maybe Text)) -> TextOptions -> f TextOptions
textOptions_sourceField = (TextOptions -> Maybe Text)
-> (TextOptions -> Maybe Text -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Text
sourceField :: Maybe Text
$sel:sourceField:TextOptions' :: TextOptions -> Maybe Text
sourceField} -> Maybe Text
sourceField) (\s :: TextOptions
s@TextOptions' {} Maybe Text
a -> TextOptions
s {$sel:sourceField:TextOptions' :: Maybe Text
sourceField = Maybe Text
a} :: TextOptions)
textOptions_returnEnabled :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Bool)
textOptions_returnEnabled :: (Maybe Bool -> f (Maybe Bool)) -> TextOptions -> f TextOptions
textOptions_returnEnabled = (TextOptions -> Maybe Bool)
-> (TextOptions -> Maybe Bool -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Bool
returnEnabled :: Maybe Bool
$sel:returnEnabled:TextOptions' :: TextOptions -> Maybe Bool
returnEnabled} -> Maybe Bool
returnEnabled) (\s :: TextOptions
s@TextOptions' {} Maybe Bool
a -> TextOptions
s {$sel:returnEnabled:TextOptions' :: Maybe Bool
returnEnabled = Maybe Bool
a} :: TextOptions)
textOptions_analysisScheme :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Text)
textOptions_analysisScheme :: (Maybe Text -> f (Maybe Text)) -> TextOptions -> f TextOptions
textOptions_analysisScheme = (TextOptions -> Maybe Text)
-> (TextOptions -> Maybe Text -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Text
analysisScheme :: Maybe Text
$sel:analysisScheme:TextOptions' :: TextOptions -> Maybe Text
analysisScheme} -> Maybe Text
analysisScheme) (\s :: TextOptions
s@TextOptions' {} Maybe Text
a -> TextOptions
s {$sel:analysisScheme:TextOptions' :: Maybe Text
analysisScheme = Maybe Text
a} :: TextOptions)
textOptions_highlightEnabled :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Bool)
textOptions_highlightEnabled :: (Maybe Bool -> f (Maybe Bool)) -> TextOptions -> f TextOptions
textOptions_highlightEnabled = (TextOptions -> Maybe Bool)
-> (TextOptions -> Maybe Bool -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Bool
highlightEnabled :: Maybe Bool
$sel:highlightEnabled:TextOptions' :: TextOptions -> Maybe Bool
highlightEnabled} -> Maybe Bool
highlightEnabled) (\s :: TextOptions
s@TextOptions' {} Maybe Bool
a -> TextOptions
s {$sel:highlightEnabled:TextOptions' :: Maybe Bool
highlightEnabled = Maybe Bool
a} :: TextOptions)
textOptions_sortEnabled :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Bool)
textOptions_sortEnabled :: (Maybe Bool -> f (Maybe Bool)) -> TextOptions -> f TextOptions
textOptions_sortEnabled = (TextOptions -> Maybe Bool)
-> (TextOptions -> Maybe Bool -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Bool
sortEnabled :: Maybe Bool
$sel:sortEnabled:TextOptions' :: TextOptions -> Maybe Bool
sortEnabled} -> Maybe Bool
sortEnabled) (\s :: TextOptions
s@TextOptions' {} Maybe Bool
a -> TextOptions
s {$sel:sortEnabled:TextOptions' :: Maybe Bool
sortEnabled = Maybe Bool
a} :: TextOptions)
textOptions_defaultValue :: Lens.Lens' TextOptions (Prelude.Maybe Prelude.Text)
textOptions_defaultValue :: (Maybe Text -> f (Maybe Text)) -> TextOptions -> f TextOptions
textOptions_defaultValue = (TextOptions -> Maybe Text)
-> (TextOptions -> Maybe Text -> TextOptions)
-> Lens TextOptions TextOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextOptions' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:TextOptions' :: TextOptions -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: TextOptions
s@TextOptions' {} Maybe Text
a -> TextOptions
s {$sel:defaultValue:TextOptions' :: Maybe Text
defaultValue = Maybe Text
a} :: TextOptions)
instance Core.FromXML TextOptions where
parseXML :: [Node] -> Either String TextOptions
parseXML [Node]
x =
Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> TextOptions
TextOptions'
(Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> TextOptions)
-> Either String (Maybe Text)
-> Either
String
(Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> TextOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SourceField")
Either
String
(Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> TextOptions)
-> Either String (Maybe Bool)
-> Either
String
(Maybe Text
-> Maybe Bool -> Maybe Bool -> Maybe Text -> TextOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReturnEnabled")
Either
String
(Maybe Text
-> Maybe Bool -> Maybe Bool -> Maybe Text -> TextOptions)
-> Either String (Maybe Text)
-> Either
String (Maybe Bool -> Maybe Bool -> Maybe Text -> TextOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AnalysisScheme")
Either
String (Maybe Bool -> Maybe Bool -> Maybe Text -> TextOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Bool -> Maybe Text -> TextOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HighlightEnabled")
Either String (Maybe Bool -> Maybe Text -> TextOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> TextOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SortEnabled")
Either String (Maybe Text -> TextOptions)
-> Either String (Maybe Text) -> Either String TextOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultValue")
instance Prelude.Hashable TextOptions
instance Prelude.NFData TextOptions
instance Core.ToQuery TextOptions where
toQuery :: TextOptions -> QueryString
toQuery TextOptions' {Maybe Bool
Maybe Text
defaultValue :: Maybe Text
sortEnabled :: Maybe Bool
highlightEnabled :: Maybe Bool
analysisScheme :: Maybe Text
returnEnabled :: Maybe Bool
sourceField :: Maybe Text
$sel:defaultValue:TextOptions' :: TextOptions -> Maybe Text
$sel:sortEnabled:TextOptions' :: TextOptions -> Maybe Bool
$sel:highlightEnabled:TextOptions' :: TextOptions -> Maybe Bool
$sel:analysisScheme:TextOptions' :: TextOptions -> Maybe Text
$sel:returnEnabled:TextOptions' :: TextOptions -> Maybe Bool
$sel:sourceField:TextOptions' :: TextOptions -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"SourceField" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceField,
ByteString
"ReturnEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
returnEnabled,
ByteString
"AnalysisScheme" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
analysisScheme,
ByteString
"HighlightEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
highlightEnabled,
ByteString
"SortEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
sortEnabled,
ByteString
"DefaultValue" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
defaultValue
]