{-# 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.Pinpoint.Types.EventFilter where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.EventDimensions
import Amazonka.Pinpoint.Types.FilterType
import qualified Amazonka.Prelude as Prelude
data EventFilter = EventFilter'
{
EventFilter -> FilterType
filterType :: FilterType,
EventFilter -> EventDimensions
dimensions :: EventDimensions
}
deriving (EventFilter -> EventFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventFilter -> EventFilter -> Bool
$c/= :: EventFilter -> EventFilter -> Bool
== :: EventFilter -> EventFilter -> Bool
$c== :: EventFilter -> EventFilter -> Bool
Prelude.Eq, ReadPrec [EventFilter]
ReadPrec EventFilter
Int -> ReadS EventFilter
ReadS [EventFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventFilter]
$creadListPrec :: ReadPrec [EventFilter]
readPrec :: ReadPrec EventFilter
$creadPrec :: ReadPrec EventFilter
readList :: ReadS [EventFilter]
$creadList :: ReadS [EventFilter]
readsPrec :: Int -> ReadS EventFilter
$creadsPrec :: Int -> ReadS EventFilter
Prelude.Read, Int -> EventFilter -> ShowS
[EventFilter] -> ShowS
EventFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventFilter] -> ShowS
$cshowList :: [EventFilter] -> ShowS
show :: EventFilter -> String
$cshow :: EventFilter -> String
showsPrec :: Int -> EventFilter -> ShowS
$cshowsPrec :: Int -> EventFilter -> ShowS
Prelude.Show, forall x. Rep EventFilter x -> EventFilter
forall x. EventFilter -> Rep EventFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventFilter x -> EventFilter
$cfrom :: forall x. EventFilter -> Rep EventFilter x
Prelude.Generic)
newEventFilter ::
FilterType ->
EventDimensions ->
EventFilter
newEventFilter :: FilterType -> EventDimensions -> EventFilter
newEventFilter FilterType
pFilterType_ EventDimensions
pDimensions_ =
EventFilter'
{ $sel:filterType:EventFilter' :: FilterType
filterType = FilterType
pFilterType_,
$sel:dimensions:EventFilter' :: EventDimensions
dimensions = EventDimensions
pDimensions_
}
eventFilter_filterType :: Lens.Lens' EventFilter FilterType
eventFilter_filterType :: Lens' EventFilter FilterType
eventFilter_filterType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventFilter' {FilterType
filterType :: FilterType
$sel:filterType:EventFilter' :: EventFilter -> FilterType
filterType} -> FilterType
filterType) (\s :: EventFilter
s@EventFilter' {} FilterType
a -> EventFilter
s {$sel:filterType:EventFilter' :: FilterType
filterType = FilterType
a} :: EventFilter)
eventFilter_dimensions :: Lens.Lens' EventFilter EventDimensions
eventFilter_dimensions :: Lens' EventFilter EventDimensions
eventFilter_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventFilter' {EventDimensions
dimensions :: EventDimensions
$sel:dimensions:EventFilter' :: EventFilter -> EventDimensions
dimensions} -> EventDimensions
dimensions) (\s :: EventFilter
s@EventFilter' {} EventDimensions
a -> EventFilter
s {$sel:dimensions:EventFilter' :: EventDimensions
dimensions = EventDimensions
a} :: EventFilter)
instance Data.FromJSON EventFilter where
parseJSON :: Value -> Parser EventFilter
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EventFilter"
( \Object
x ->
FilterType -> EventDimensions -> EventFilter
EventFilter'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FilterType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Dimensions")
)
instance Prelude.Hashable EventFilter where
hashWithSalt :: Int -> EventFilter -> Int
hashWithSalt Int
_salt EventFilter' {FilterType
EventDimensions
dimensions :: EventDimensions
filterType :: FilterType
$sel:dimensions:EventFilter' :: EventFilter -> EventDimensions
$sel:filterType:EventFilter' :: EventFilter -> FilterType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FilterType
filterType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EventDimensions
dimensions
instance Prelude.NFData EventFilter where
rnf :: EventFilter -> ()
rnf EventFilter' {FilterType
EventDimensions
dimensions :: EventDimensions
filterType :: FilterType
$sel:dimensions:EventFilter' :: EventFilter -> EventDimensions
$sel:filterType:EventFilter' :: EventFilter -> FilterType
..} =
forall a. NFData a => a -> ()
Prelude.rnf FilterType
filterType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EventDimensions
dimensions
instance Data.ToJSON EventFilter where
toJSON :: EventFilter -> Value
toJSON EventFilter' {FilterType
EventDimensions
dimensions :: EventDimensions
filterType :: FilterType
$sel:dimensions:EventFilter' :: EventFilter -> EventDimensions
$sel:filterType:EventFilter' :: EventFilter -> FilterType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"FilterType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FilterType
filterType),
forall a. a -> Maybe a
Prelude.Just (Key
"Dimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EventDimensions
dimensions)
]
)