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