{-# 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.Inspector.Types.EventSubscription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector.Types.InspectorEvent
import qualified Amazonka.Prelude as Prelude
data EventSubscription = EventSubscription'
{
EventSubscription -> InspectorEvent
event :: InspectorEvent,
EventSubscription -> POSIX
subscribedAt :: Data.POSIX
}
deriving (EventSubscription -> EventSubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventSubscription -> EventSubscription -> Bool
$c/= :: EventSubscription -> EventSubscription -> Bool
== :: EventSubscription -> EventSubscription -> Bool
$c== :: EventSubscription -> EventSubscription -> Bool
Prelude.Eq, ReadPrec [EventSubscription]
ReadPrec EventSubscription
Int -> ReadS EventSubscription
ReadS [EventSubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventSubscription]
$creadListPrec :: ReadPrec [EventSubscription]
readPrec :: ReadPrec EventSubscription
$creadPrec :: ReadPrec EventSubscription
readList :: ReadS [EventSubscription]
$creadList :: ReadS [EventSubscription]
readsPrec :: Int -> ReadS EventSubscription
$creadsPrec :: Int -> ReadS EventSubscription
Prelude.Read, Int -> EventSubscription -> ShowS
[EventSubscription] -> ShowS
EventSubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventSubscription] -> ShowS
$cshowList :: [EventSubscription] -> ShowS
show :: EventSubscription -> String
$cshow :: EventSubscription -> String
showsPrec :: Int -> EventSubscription -> ShowS
$cshowsPrec :: Int -> EventSubscription -> ShowS
Prelude.Show, forall x. Rep EventSubscription x -> EventSubscription
forall x. EventSubscription -> Rep EventSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventSubscription x -> EventSubscription
$cfrom :: forall x. EventSubscription -> Rep EventSubscription x
Prelude.Generic)
newEventSubscription ::
InspectorEvent ->
Prelude.UTCTime ->
EventSubscription
newEventSubscription :: InspectorEvent -> UTCTime -> EventSubscription
newEventSubscription InspectorEvent
pEvent_ UTCTime
pSubscribedAt_ =
EventSubscription'
{ $sel:event:EventSubscription' :: InspectorEvent
event = InspectorEvent
pEvent_,
$sel:subscribedAt:EventSubscription' :: POSIX
subscribedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSubscribedAt_
}
eventSubscription_event :: Lens.Lens' EventSubscription InspectorEvent
eventSubscription_event :: Lens' EventSubscription InspectorEvent
eventSubscription_event = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSubscription' {InspectorEvent
event :: InspectorEvent
$sel:event:EventSubscription' :: EventSubscription -> InspectorEvent
event} -> InspectorEvent
event) (\s :: EventSubscription
s@EventSubscription' {} InspectorEvent
a -> EventSubscription
s {$sel:event:EventSubscription' :: InspectorEvent
event = InspectorEvent
a} :: EventSubscription)
eventSubscription_subscribedAt :: Lens.Lens' EventSubscription Prelude.UTCTime
eventSubscription_subscribedAt :: Lens' EventSubscription UTCTime
eventSubscription_subscribedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSubscription' {POSIX
subscribedAt :: POSIX
$sel:subscribedAt:EventSubscription' :: EventSubscription -> POSIX
subscribedAt} -> POSIX
subscribedAt) (\s :: EventSubscription
s@EventSubscription' {} POSIX
a -> EventSubscription
s {$sel:subscribedAt:EventSubscription' :: POSIX
subscribedAt = POSIX
a} :: EventSubscription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Data.FromJSON EventSubscription where
parseJSON :: Value -> Parser EventSubscription
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EventSubscription"
( \Object
x ->
InspectorEvent -> POSIX -> EventSubscription
EventSubscription'
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
"event")
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
"subscribedAt")
)
instance Prelude.Hashable EventSubscription where
hashWithSalt :: Int -> EventSubscription -> Int
hashWithSalt Int
_salt EventSubscription' {POSIX
InspectorEvent
subscribedAt :: POSIX
event :: InspectorEvent
$sel:subscribedAt:EventSubscription' :: EventSubscription -> POSIX
$sel:event:EventSubscription' :: EventSubscription -> InspectorEvent
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InspectorEvent
event
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
subscribedAt
instance Prelude.NFData EventSubscription where
rnf :: EventSubscription -> ()
rnf EventSubscription' {POSIX
InspectorEvent
subscribedAt :: POSIX
event :: InspectorEvent
$sel:subscribedAt:EventSubscription' :: EventSubscription -> POSIX
$sel:event:EventSubscription' :: EventSubscription -> InspectorEvent
..} =
forall a. NFData a => a -> ()
Prelude.rnf InspectorEvent
event
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
subscribedAt