{-# 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.IntOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IntOptions = IntOptions'
{
IntOptions -> Maybe Text
sourceField :: Prelude.Maybe Prelude.Text,
IntOptions -> Maybe Bool
returnEnabled :: Prelude.Maybe Prelude.Bool,
IntOptions -> Maybe Bool
facetEnabled :: Prelude.Maybe Prelude.Bool,
IntOptions -> Maybe Bool
searchEnabled :: Prelude.Maybe Prelude.Bool,
IntOptions -> Maybe Bool
sortEnabled :: Prelude.Maybe Prelude.Bool,
IntOptions -> Maybe Integer
defaultValue :: Prelude.Maybe Prelude.Integer
}
deriving (IntOptions -> IntOptions -> Bool
(IntOptions -> IntOptions -> Bool)
-> (IntOptions -> IntOptions -> Bool) -> Eq IntOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntOptions -> IntOptions -> Bool
$c/= :: IntOptions -> IntOptions -> Bool
== :: IntOptions -> IntOptions -> Bool
$c== :: IntOptions -> IntOptions -> Bool
Prelude.Eq, ReadPrec [IntOptions]
ReadPrec IntOptions
Int -> ReadS IntOptions
ReadS [IntOptions]
(Int -> ReadS IntOptions)
-> ReadS [IntOptions]
-> ReadPrec IntOptions
-> ReadPrec [IntOptions]
-> Read IntOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntOptions]
$creadListPrec :: ReadPrec [IntOptions]
readPrec :: ReadPrec IntOptions
$creadPrec :: ReadPrec IntOptions
readList :: ReadS [IntOptions]
$creadList :: ReadS [IntOptions]
readsPrec :: Int -> ReadS IntOptions
$creadsPrec :: Int -> ReadS IntOptions
Prelude.Read, Int -> IntOptions -> ShowS
[IntOptions] -> ShowS
IntOptions -> String
(Int -> IntOptions -> ShowS)
-> (IntOptions -> String)
-> ([IntOptions] -> ShowS)
-> Show IntOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntOptions] -> ShowS
$cshowList :: [IntOptions] -> ShowS
show :: IntOptions -> String
$cshow :: IntOptions -> String
showsPrec :: Int -> IntOptions -> ShowS
$cshowsPrec :: Int -> IntOptions -> ShowS
Prelude.Show, (forall x. IntOptions -> Rep IntOptions x)
-> (forall x. Rep IntOptions x -> IntOptions) -> Generic IntOptions
forall x. Rep IntOptions x -> IntOptions
forall x. IntOptions -> Rep IntOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntOptions x -> IntOptions
$cfrom :: forall x. IntOptions -> Rep IntOptions x
Prelude.Generic)
newIntOptions ::
IntOptions
newIntOptions :: IntOptions
newIntOptions =
IntOptions' :: Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Integer
-> IntOptions
IntOptions'
{ $sel:sourceField:IntOptions' :: Maybe Text
sourceField = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:returnEnabled:IntOptions' :: Maybe Bool
returnEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:facetEnabled:IntOptions' :: Maybe Bool
facetEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:searchEnabled:IntOptions' :: Maybe Bool
searchEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:sortEnabled:IntOptions' :: Maybe Bool
sortEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:defaultValue:IntOptions' :: Maybe Integer
defaultValue = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
intOptions_sourceField :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Text)
intOptions_sourceField :: (Maybe Text -> f (Maybe Text)) -> IntOptions -> f IntOptions
intOptions_sourceField = (IntOptions -> Maybe Text)
-> (IntOptions -> Maybe Text -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Text
sourceField :: Maybe Text
$sel:sourceField:IntOptions' :: IntOptions -> Maybe Text
sourceField} -> Maybe Text
sourceField) (\s :: IntOptions
s@IntOptions' {} Maybe Text
a -> IntOptions
s {$sel:sourceField:IntOptions' :: Maybe Text
sourceField = Maybe Text
a} :: IntOptions)
intOptions_returnEnabled :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Bool)
intOptions_returnEnabled :: (Maybe Bool -> f (Maybe Bool)) -> IntOptions -> f IntOptions
intOptions_returnEnabled = (IntOptions -> Maybe Bool)
-> (IntOptions -> Maybe Bool -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Bool
returnEnabled :: Maybe Bool
$sel:returnEnabled:IntOptions' :: IntOptions -> Maybe Bool
returnEnabled} -> Maybe Bool
returnEnabled) (\s :: IntOptions
s@IntOptions' {} Maybe Bool
a -> IntOptions
s {$sel:returnEnabled:IntOptions' :: Maybe Bool
returnEnabled = Maybe Bool
a} :: IntOptions)
intOptions_facetEnabled :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Bool)
intOptions_facetEnabled :: (Maybe Bool -> f (Maybe Bool)) -> IntOptions -> f IntOptions
intOptions_facetEnabled = (IntOptions -> Maybe Bool)
-> (IntOptions -> Maybe Bool -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Bool
facetEnabled :: Maybe Bool
$sel:facetEnabled:IntOptions' :: IntOptions -> Maybe Bool
facetEnabled} -> Maybe Bool
facetEnabled) (\s :: IntOptions
s@IntOptions' {} Maybe Bool
a -> IntOptions
s {$sel:facetEnabled:IntOptions' :: Maybe Bool
facetEnabled = Maybe Bool
a} :: IntOptions)
intOptions_searchEnabled :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Bool)
intOptions_searchEnabled :: (Maybe Bool -> f (Maybe Bool)) -> IntOptions -> f IntOptions
intOptions_searchEnabled = (IntOptions -> Maybe Bool)
-> (IntOptions -> Maybe Bool -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Bool
searchEnabled :: Maybe Bool
$sel:searchEnabled:IntOptions' :: IntOptions -> Maybe Bool
searchEnabled} -> Maybe Bool
searchEnabled) (\s :: IntOptions
s@IntOptions' {} Maybe Bool
a -> IntOptions
s {$sel:searchEnabled:IntOptions' :: Maybe Bool
searchEnabled = Maybe Bool
a} :: IntOptions)
intOptions_sortEnabled :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Bool)
intOptions_sortEnabled :: (Maybe Bool -> f (Maybe Bool)) -> IntOptions -> f IntOptions
intOptions_sortEnabled = (IntOptions -> Maybe Bool)
-> (IntOptions -> Maybe Bool -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Bool
sortEnabled :: Maybe Bool
$sel:sortEnabled:IntOptions' :: IntOptions -> Maybe Bool
sortEnabled} -> Maybe Bool
sortEnabled) (\s :: IntOptions
s@IntOptions' {} Maybe Bool
a -> IntOptions
s {$sel:sortEnabled:IntOptions' :: Maybe Bool
sortEnabled = Maybe Bool
a} :: IntOptions)
intOptions_defaultValue :: Lens.Lens' IntOptions (Prelude.Maybe Prelude.Integer)
intOptions_defaultValue :: (Maybe Integer -> f (Maybe Integer)) -> IntOptions -> f IntOptions
intOptions_defaultValue = (IntOptions -> Maybe Integer)
-> (IntOptions -> Maybe Integer -> IntOptions)
-> Lens IntOptions IntOptions (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntOptions' {Maybe Integer
defaultValue :: Maybe Integer
$sel:defaultValue:IntOptions' :: IntOptions -> Maybe Integer
defaultValue} -> Maybe Integer
defaultValue) (\s :: IntOptions
s@IntOptions' {} Maybe Integer
a -> IntOptions
s {$sel:defaultValue:IntOptions' :: Maybe Integer
defaultValue = Maybe Integer
a} :: IntOptions)
instance Core.FromXML IntOptions where
parseXML :: [Node] -> Either String IntOptions
parseXML [Node]
x =
Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Integer
-> IntOptions
IntOptions'
(Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Integer
-> IntOptions)
-> Either String (Maybe Text)
-> Either
String
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Integer
-> IntOptions)
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 Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Integer
-> IntOptions)
-> Either String (Maybe Bool)
-> Either
String
(Maybe Bool
-> Maybe Bool -> Maybe Bool -> Maybe Integer -> IntOptions)
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 Bool
-> Maybe Bool -> Maybe Bool -> Maybe Integer -> IntOptions)
-> Either String (Maybe Bool)
-> Either
String (Maybe Bool -> Maybe Bool -> Maybe Integer -> IntOptions)
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
"FacetEnabled")
Either
String (Maybe Bool -> Maybe Bool -> Maybe Integer -> IntOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Bool -> Maybe Integer -> IntOptions)
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
"SearchEnabled")
Either String (Maybe Bool -> Maybe Integer -> IntOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Integer -> IntOptions)
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 Integer -> IntOptions)
-> Either String (Maybe Integer) -> Either String IntOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultValue")
instance Prelude.Hashable IntOptions
instance Prelude.NFData IntOptions
instance Core.ToQuery IntOptions where
toQuery :: IntOptions -> QueryString
toQuery IntOptions' {Maybe Bool
Maybe Integer
Maybe Text
defaultValue :: Maybe Integer
sortEnabled :: Maybe Bool
searchEnabled :: Maybe Bool
facetEnabled :: Maybe Bool
returnEnabled :: Maybe Bool
sourceField :: Maybe Text
$sel:defaultValue:IntOptions' :: IntOptions -> Maybe Integer
$sel:sortEnabled:IntOptions' :: IntOptions -> Maybe Bool
$sel:searchEnabled:IntOptions' :: IntOptions -> Maybe Bool
$sel:facetEnabled:IntOptions' :: IntOptions -> Maybe Bool
$sel:returnEnabled:IntOptions' :: IntOptions -> Maybe Bool
$sel:sourceField:IntOptions' :: IntOptions -> 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
"FacetEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
facetEnabled,
ByteString
"SearchEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
searchEnabled,
ByteString
"SortEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
sortEnabled,
ByteString
"DefaultValue" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
defaultValue
]