{-# 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.IoT1ClickDevices.Types.DeviceEvent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT1ClickDevices.Types.Device
import qualified Amazonka.Prelude as Prelude
data DeviceEvent = DeviceEvent'
{
DeviceEvent -> Maybe Device
device :: Prelude.Maybe Device,
DeviceEvent -> Maybe Text
stdEvent :: Prelude.Maybe Prelude.Text
}
deriving (DeviceEvent -> DeviceEvent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceEvent -> DeviceEvent -> Bool
$c/= :: DeviceEvent -> DeviceEvent -> Bool
== :: DeviceEvent -> DeviceEvent -> Bool
$c== :: DeviceEvent -> DeviceEvent -> Bool
Prelude.Eq, ReadPrec [DeviceEvent]
ReadPrec DeviceEvent
Int -> ReadS DeviceEvent
ReadS [DeviceEvent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceEvent]
$creadListPrec :: ReadPrec [DeviceEvent]
readPrec :: ReadPrec DeviceEvent
$creadPrec :: ReadPrec DeviceEvent
readList :: ReadS [DeviceEvent]
$creadList :: ReadS [DeviceEvent]
readsPrec :: Int -> ReadS DeviceEvent
$creadsPrec :: Int -> ReadS DeviceEvent
Prelude.Read, Int -> DeviceEvent -> ShowS
[DeviceEvent] -> ShowS
DeviceEvent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceEvent] -> ShowS
$cshowList :: [DeviceEvent] -> ShowS
show :: DeviceEvent -> String
$cshow :: DeviceEvent -> String
showsPrec :: Int -> DeviceEvent -> ShowS
$cshowsPrec :: Int -> DeviceEvent -> ShowS
Prelude.Show, forall x. Rep DeviceEvent x -> DeviceEvent
forall x. DeviceEvent -> Rep DeviceEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceEvent x -> DeviceEvent
$cfrom :: forall x. DeviceEvent -> Rep DeviceEvent x
Prelude.Generic)
newDeviceEvent ::
DeviceEvent
newDeviceEvent :: DeviceEvent
newDeviceEvent =
DeviceEvent'
{ $sel:device:DeviceEvent' :: Maybe Device
device = forall a. Maybe a
Prelude.Nothing,
$sel:stdEvent:DeviceEvent' :: Maybe Text
stdEvent = forall a. Maybe a
Prelude.Nothing
}
deviceEvent_device :: Lens.Lens' DeviceEvent (Prelude.Maybe Device)
deviceEvent_device :: Lens' DeviceEvent (Maybe Device)
deviceEvent_device = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceEvent' {Maybe Device
device :: Maybe Device
$sel:device:DeviceEvent' :: DeviceEvent -> Maybe Device
device} -> Maybe Device
device) (\s :: DeviceEvent
s@DeviceEvent' {} Maybe Device
a -> DeviceEvent
s {$sel:device:DeviceEvent' :: Maybe Device
device = Maybe Device
a} :: DeviceEvent)
deviceEvent_stdEvent :: Lens.Lens' DeviceEvent (Prelude.Maybe Prelude.Text)
deviceEvent_stdEvent :: Lens' DeviceEvent (Maybe Text)
deviceEvent_stdEvent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceEvent' {Maybe Text
stdEvent :: Maybe Text
$sel:stdEvent:DeviceEvent' :: DeviceEvent -> Maybe Text
stdEvent} -> Maybe Text
stdEvent) (\s :: DeviceEvent
s@DeviceEvent' {} Maybe Text
a -> DeviceEvent
s {$sel:stdEvent:DeviceEvent' :: Maybe Text
stdEvent = Maybe Text
a} :: DeviceEvent)
instance Data.FromJSON DeviceEvent where
parseJSON :: Value -> Parser DeviceEvent
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DeviceEvent"
( \Object
x ->
Maybe Device -> Maybe Text -> DeviceEvent
DeviceEvent'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"device")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"stdEvent")
)
instance Prelude.Hashable DeviceEvent where
hashWithSalt :: Int -> DeviceEvent -> Int
hashWithSalt Int
_salt DeviceEvent' {Maybe Text
Maybe Device
stdEvent :: Maybe Text
device :: Maybe Device
$sel:stdEvent:DeviceEvent' :: DeviceEvent -> Maybe Text
$sel:device:DeviceEvent' :: DeviceEvent -> Maybe Device
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Device
device
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stdEvent
instance Prelude.NFData DeviceEvent where
rnf :: DeviceEvent -> ()
rnf DeviceEvent' {Maybe Text
Maybe Device
stdEvent :: Maybe Text
device :: Maybe Device
$sel:stdEvent:DeviceEvent' :: DeviceEvent -> Maybe Text
$sel:device:DeviceEvent' :: DeviceEvent -> Maybe Device
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Device
device
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stdEvent