{-# 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 Amazonka.IoT1ClickDevices.Types.Device
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DeviceEvent = DeviceEvent'
{
DeviceEvent -> Maybe Text
stdEvent :: Prelude.Maybe Prelude.Text,
DeviceEvent -> Maybe Device
device :: Prelude.Maybe Device
}
deriving (DeviceEvent -> DeviceEvent -> Bool
(DeviceEvent -> DeviceEvent -> Bool)
-> (DeviceEvent -> DeviceEvent -> Bool) -> Eq DeviceEvent
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]
(Int -> ReadS DeviceEvent)
-> ReadS [DeviceEvent]
-> ReadPrec DeviceEvent
-> ReadPrec [DeviceEvent]
-> Read 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
(Int -> DeviceEvent -> ShowS)
-> (DeviceEvent -> String)
-> ([DeviceEvent] -> ShowS)
-> Show DeviceEvent
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. DeviceEvent -> Rep DeviceEvent x)
-> (forall x. Rep DeviceEvent x -> DeviceEvent)
-> Generic DeviceEvent
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' :: Maybe Text -> Maybe Device -> DeviceEvent
DeviceEvent'
{ $sel:stdEvent:DeviceEvent' :: Maybe Text
stdEvent = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:device:DeviceEvent' :: Maybe Device
device = Maybe Device
forall a. Maybe a
Prelude.Nothing
}
deviceEvent_stdEvent :: Lens.Lens' DeviceEvent (Prelude.Maybe Prelude.Text)
deviceEvent_stdEvent :: (Maybe Text -> f (Maybe Text)) -> DeviceEvent -> f DeviceEvent
deviceEvent_stdEvent = (DeviceEvent -> Maybe Text)
-> (DeviceEvent -> Maybe Text -> DeviceEvent)
-> Lens DeviceEvent DeviceEvent (Maybe Text) (Maybe Text)
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)
deviceEvent_device :: Lens.Lens' DeviceEvent (Prelude.Maybe Device)
deviceEvent_device :: (Maybe Device -> f (Maybe Device)) -> DeviceEvent -> f DeviceEvent
deviceEvent_device = (DeviceEvent -> Maybe Device)
-> (DeviceEvent -> Maybe Device -> DeviceEvent)
-> Lens DeviceEvent DeviceEvent (Maybe Device) (Maybe 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)
instance Core.FromJSON DeviceEvent where
parseJSON :: Value -> Parser DeviceEvent
parseJSON =
String
-> (Object -> Parser DeviceEvent) -> Value -> Parser DeviceEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DeviceEvent"
( \Object
x ->
Maybe Text -> Maybe Device -> DeviceEvent
DeviceEvent'
(Maybe Text -> Maybe Device -> DeviceEvent)
-> Parser (Maybe Text) -> Parser (Maybe Device -> DeviceEvent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stdEvent")
Parser (Maybe Device -> DeviceEvent)
-> Parser (Maybe Device) -> Parser DeviceEvent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Device)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"device")
)
instance Prelude.Hashable DeviceEvent
instance Prelude.NFData DeviceEvent