{-# 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.Wisdom.Types.SearchExpression where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Wisdom.Types.Filter
data SearchExpression = SearchExpression'
{
SearchExpression -> [Filter]
filters :: [Filter]
}
deriving (SearchExpression -> SearchExpression -> Bool
(SearchExpression -> SearchExpression -> Bool)
-> (SearchExpression -> SearchExpression -> Bool)
-> Eq SearchExpression
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchExpression -> SearchExpression -> Bool
$c/= :: SearchExpression -> SearchExpression -> Bool
== :: SearchExpression -> SearchExpression -> Bool
$c== :: SearchExpression -> SearchExpression -> Bool
Prelude.Eq, ReadPrec [SearchExpression]
ReadPrec SearchExpression
Int -> ReadS SearchExpression
ReadS [SearchExpression]
(Int -> ReadS SearchExpression)
-> ReadS [SearchExpression]
-> ReadPrec SearchExpression
-> ReadPrec [SearchExpression]
-> Read SearchExpression
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchExpression]
$creadListPrec :: ReadPrec [SearchExpression]
readPrec :: ReadPrec SearchExpression
$creadPrec :: ReadPrec SearchExpression
readList :: ReadS [SearchExpression]
$creadList :: ReadS [SearchExpression]
readsPrec :: Int -> ReadS SearchExpression
$creadsPrec :: Int -> ReadS SearchExpression
Prelude.Read, Int -> SearchExpression -> ShowS
[SearchExpression] -> ShowS
SearchExpression -> String
(Int -> SearchExpression -> ShowS)
-> (SearchExpression -> String)
-> ([SearchExpression] -> ShowS)
-> Show SearchExpression
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchExpression] -> ShowS
$cshowList :: [SearchExpression] -> ShowS
show :: SearchExpression -> String
$cshow :: SearchExpression -> String
showsPrec :: Int -> SearchExpression -> ShowS
$cshowsPrec :: Int -> SearchExpression -> ShowS
Prelude.Show, (forall x. SearchExpression -> Rep SearchExpression x)
-> (forall x. Rep SearchExpression x -> SearchExpression)
-> Generic SearchExpression
forall x. Rep SearchExpression x -> SearchExpression
forall x. SearchExpression -> Rep SearchExpression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchExpression x -> SearchExpression
$cfrom :: forall x. SearchExpression -> Rep SearchExpression x
Prelude.Generic)
newSearchExpression ::
SearchExpression
newSearchExpression :: SearchExpression
newSearchExpression =
SearchExpression' :: [Filter] -> SearchExpression
SearchExpression' {$sel:filters:SearchExpression' :: [Filter]
filters = [Filter]
forall a. Monoid a => a
Prelude.mempty}
searchExpression_filters :: Lens.Lens' SearchExpression [Filter]
searchExpression_filters :: ([Filter] -> f [Filter]) -> SearchExpression -> f SearchExpression
searchExpression_filters = (SearchExpression -> [Filter])
-> (SearchExpression -> [Filter] -> SearchExpression)
-> Lens SearchExpression SearchExpression [Filter] [Filter]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchExpression' {[Filter]
filters :: [Filter]
$sel:filters:SearchExpression' :: SearchExpression -> [Filter]
filters} -> [Filter]
filters) (\s :: SearchExpression
s@SearchExpression' {} [Filter]
a -> SearchExpression
s {$sel:filters:SearchExpression' :: [Filter]
filters = [Filter]
a} :: SearchExpression) (([Filter] -> f [Filter])
-> SearchExpression -> f SearchExpression)
-> (([Filter] -> f [Filter]) -> [Filter] -> f [Filter])
-> ([Filter] -> f [Filter])
-> SearchExpression
-> f SearchExpression
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Filter] -> f [Filter]) -> [Filter] -> f [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable SearchExpression
instance Prelude.NFData SearchExpression
instance Core.ToJSON SearchExpression where
toJSON :: SearchExpression -> Value
toJSON SearchExpression' {[Filter]
filters :: [Filter]
$sel:filters:SearchExpression' :: SearchExpression -> [Filter]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Filter]
filters)]
)