{-# 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.MacieV2.Types.SortCriteria where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.OrderBy
import qualified Amazonka.Prelude as Prelude
data SortCriteria = SortCriteria'
{
SortCriteria -> Maybe OrderBy
orderBy :: Prelude.Maybe OrderBy,
SortCriteria -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text
}
deriving (SortCriteria -> SortCriteria -> Bool
(SortCriteria -> SortCriteria -> Bool)
-> (SortCriteria -> SortCriteria -> Bool) -> Eq SortCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SortCriteria -> SortCriteria -> Bool
$c/= :: SortCriteria -> SortCriteria -> Bool
== :: SortCriteria -> SortCriteria -> Bool
$c== :: SortCriteria -> SortCriteria -> Bool
Prelude.Eq, ReadPrec [SortCriteria]
ReadPrec SortCriteria
Int -> ReadS SortCriteria
ReadS [SortCriteria]
(Int -> ReadS SortCriteria)
-> ReadS [SortCriteria]
-> ReadPrec SortCriteria
-> ReadPrec [SortCriteria]
-> Read SortCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SortCriteria]
$creadListPrec :: ReadPrec [SortCriteria]
readPrec :: ReadPrec SortCriteria
$creadPrec :: ReadPrec SortCriteria
readList :: ReadS [SortCriteria]
$creadList :: ReadS [SortCriteria]
readsPrec :: Int -> ReadS SortCriteria
$creadsPrec :: Int -> ReadS SortCriteria
Prelude.Read, Int -> SortCriteria -> ShowS
[SortCriteria] -> ShowS
SortCriteria -> String
(Int -> SortCriteria -> ShowS)
-> (SortCriteria -> String)
-> ([SortCriteria] -> ShowS)
-> Show SortCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SortCriteria] -> ShowS
$cshowList :: [SortCriteria] -> ShowS
show :: SortCriteria -> String
$cshow :: SortCriteria -> String
showsPrec :: Int -> SortCriteria -> ShowS
$cshowsPrec :: Int -> SortCriteria -> ShowS
Prelude.Show, (forall x. SortCriteria -> Rep SortCriteria x)
-> (forall x. Rep SortCriteria x -> SortCriteria)
-> Generic SortCriteria
forall x. Rep SortCriteria x -> SortCriteria
forall x. SortCriteria -> Rep SortCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SortCriteria x -> SortCriteria
$cfrom :: forall x. SortCriteria -> Rep SortCriteria x
Prelude.Generic)
newSortCriteria ::
SortCriteria
newSortCriteria :: SortCriteria
newSortCriteria =
SortCriteria' :: Maybe OrderBy -> Maybe Text -> SortCriteria
SortCriteria'
{ $sel:orderBy:SortCriteria' :: Maybe OrderBy
orderBy = Maybe OrderBy
forall a. Maybe a
Prelude.Nothing,
$sel:attributeName:SortCriteria' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
sortCriteria_orderBy :: Lens.Lens' SortCriteria (Prelude.Maybe OrderBy)
sortCriteria_orderBy :: (Maybe OrderBy -> f (Maybe OrderBy))
-> SortCriteria -> f SortCriteria
sortCriteria_orderBy = (SortCriteria -> Maybe OrderBy)
-> (SortCriteria -> Maybe OrderBy -> SortCriteria)
-> Lens SortCriteria SortCriteria (Maybe OrderBy) (Maybe OrderBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SortCriteria' {Maybe OrderBy
orderBy :: Maybe OrderBy
$sel:orderBy:SortCriteria' :: SortCriteria -> Maybe OrderBy
orderBy} -> Maybe OrderBy
orderBy) (\s :: SortCriteria
s@SortCriteria' {} Maybe OrderBy
a -> SortCriteria
s {$sel:orderBy:SortCriteria' :: Maybe OrderBy
orderBy = Maybe OrderBy
a} :: SortCriteria)
sortCriteria_attributeName :: Lens.Lens' SortCriteria (Prelude.Maybe Prelude.Text)
sortCriteria_attributeName :: (Maybe Text -> f (Maybe Text)) -> SortCriteria -> f SortCriteria
sortCriteria_attributeName = (SortCriteria -> Maybe Text)
-> (SortCriteria -> Maybe Text -> SortCriteria)
-> Lens SortCriteria SortCriteria (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SortCriteria' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:SortCriteria' :: SortCriteria -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: SortCriteria
s@SortCriteria' {} Maybe Text
a -> SortCriteria
s {$sel:attributeName:SortCriteria' :: Maybe Text
attributeName = Maybe Text
a} :: SortCriteria)
instance Prelude.Hashable SortCriteria
instance Prelude.NFData SortCriteria
instance Core.ToJSON SortCriteria where
toJSON :: SortCriteria -> Value
toJSON SortCriteria' {Maybe Text
Maybe OrderBy
attributeName :: Maybe Text
orderBy :: Maybe OrderBy
$sel:attributeName:SortCriteria' :: SortCriteria -> Maybe Text
$sel:orderBy:SortCriteria' :: SortCriteria -> Maybe OrderBy
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"orderBy" Text -> OrderBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OrderBy -> Pair) -> Maybe OrderBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrderBy
orderBy,
(Text
"attributeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
attributeName
]
)