{-# 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.GreengrassV2.Types.CoreDevice where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.CoreDeviceStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CoreDevice = CoreDevice'
{
CoreDevice -> Maybe CoreDeviceStatus
status :: Prelude.Maybe CoreDeviceStatus,
CoreDevice -> Maybe Text
coreDeviceThingName :: Prelude.Maybe Prelude.Text,
CoreDevice -> Maybe POSIX
lastStatusUpdateTimestamp :: Prelude.Maybe Core.POSIX
}
deriving (CoreDevice -> CoreDevice -> Bool
(CoreDevice -> CoreDevice -> Bool)
-> (CoreDevice -> CoreDevice -> Bool) -> Eq CoreDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoreDevice -> CoreDevice -> Bool
$c/= :: CoreDevice -> CoreDevice -> Bool
== :: CoreDevice -> CoreDevice -> Bool
$c== :: CoreDevice -> CoreDevice -> Bool
Prelude.Eq, ReadPrec [CoreDevice]
ReadPrec CoreDevice
Int -> ReadS CoreDevice
ReadS [CoreDevice]
(Int -> ReadS CoreDevice)
-> ReadS [CoreDevice]
-> ReadPrec CoreDevice
-> ReadPrec [CoreDevice]
-> Read CoreDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CoreDevice]
$creadListPrec :: ReadPrec [CoreDevice]
readPrec :: ReadPrec CoreDevice
$creadPrec :: ReadPrec CoreDevice
readList :: ReadS [CoreDevice]
$creadList :: ReadS [CoreDevice]
readsPrec :: Int -> ReadS CoreDevice
$creadsPrec :: Int -> ReadS CoreDevice
Prelude.Read, Int -> CoreDevice -> ShowS
[CoreDevice] -> ShowS
CoreDevice -> String
(Int -> CoreDevice -> ShowS)
-> (CoreDevice -> String)
-> ([CoreDevice] -> ShowS)
-> Show CoreDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoreDevice] -> ShowS
$cshowList :: [CoreDevice] -> ShowS
show :: CoreDevice -> String
$cshow :: CoreDevice -> String
showsPrec :: Int -> CoreDevice -> ShowS
$cshowsPrec :: Int -> CoreDevice -> ShowS
Prelude.Show, (forall x. CoreDevice -> Rep CoreDevice x)
-> (forall x. Rep CoreDevice x -> CoreDevice) -> Generic CoreDevice
forall x. Rep CoreDevice x -> CoreDevice
forall x. CoreDevice -> Rep CoreDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoreDevice x -> CoreDevice
$cfrom :: forall x. CoreDevice -> Rep CoreDevice x
Prelude.Generic)
newCoreDevice ::
CoreDevice
newCoreDevice :: CoreDevice
newCoreDevice =
CoreDevice' :: Maybe CoreDeviceStatus -> Maybe Text -> Maybe POSIX -> CoreDevice
CoreDevice'
{ $sel:status:CoreDevice' :: Maybe CoreDeviceStatus
status = Maybe CoreDeviceStatus
forall a. Maybe a
Prelude.Nothing,
$sel:coreDeviceThingName:CoreDevice' :: Maybe Text
coreDeviceThingName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastStatusUpdateTimestamp:CoreDevice' :: Maybe POSIX
lastStatusUpdateTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
coreDevice_status :: Lens.Lens' CoreDevice (Prelude.Maybe CoreDeviceStatus)
coreDevice_status :: (Maybe CoreDeviceStatus -> f (Maybe CoreDeviceStatus))
-> CoreDevice -> f CoreDevice
coreDevice_status = (CoreDevice -> Maybe CoreDeviceStatus)
-> (CoreDevice -> Maybe CoreDeviceStatus -> CoreDevice)
-> Lens
CoreDevice
CoreDevice
(Maybe CoreDeviceStatus)
(Maybe CoreDeviceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoreDevice' {Maybe CoreDeviceStatus
status :: Maybe CoreDeviceStatus
$sel:status:CoreDevice' :: CoreDevice -> Maybe CoreDeviceStatus
status} -> Maybe CoreDeviceStatus
status) (\s :: CoreDevice
s@CoreDevice' {} Maybe CoreDeviceStatus
a -> CoreDevice
s {$sel:status:CoreDevice' :: Maybe CoreDeviceStatus
status = Maybe CoreDeviceStatus
a} :: CoreDevice)
coreDevice_coreDeviceThingName :: Lens.Lens' CoreDevice (Prelude.Maybe Prelude.Text)
coreDevice_coreDeviceThingName :: (Maybe Text -> f (Maybe Text)) -> CoreDevice -> f CoreDevice
coreDevice_coreDeviceThingName = (CoreDevice -> Maybe Text)
-> (CoreDevice -> Maybe Text -> CoreDevice)
-> Lens CoreDevice CoreDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoreDevice' {Maybe Text
coreDeviceThingName :: Maybe Text
$sel:coreDeviceThingName:CoreDevice' :: CoreDevice -> Maybe Text
coreDeviceThingName} -> Maybe Text
coreDeviceThingName) (\s :: CoreDevice
s@CoreDevice' {} Maybe Text
a -> CoreDevice
s {$sel:coreDeviceThingName:CoreDevice' :: Maybe Text
coreDeviceThingName = Maybe Text
a} :: CoreDevice)
coreDevice_lastStatusUpdateTimestamp :: Lens.Lens' CoreDevice (Prelude.Maybe Prelude.UTCTime)
coreDevice_lastStatusUpdateTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> CoreDevice -> f CoreDevice
coreDevice_lastStatusUpdateTimestamp = (CoreDevice -> Maybe POSIX)
-> (CoreDevice -> Maybe POSIX -> CoreDevice)
-> Lens CoreDevice CoreDevice (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoreDevice' {Maybe POSIX
lastStatusUpdateTimestamp :: Maybe POSIX
$sel:lastStatusUpdateTimestamp:CoreDevice' :: CoreDevice -> Maybe POSIX
lastStatusUpdateTimestamp} -> Maybe POSIX
lastStatusUpdateTimestamp) (\s :: CoreDevice
s@CoreDevice' {} Maybe POSIX
a -> CoreDevice
s {$sel:lastStatusUpdateTimestamp:CoreDevice' :: Maybe POSIX
lastStatusUpdateTimestamp = Maybe POSIX
a} :: CoreDevice) ((Maybe POSIX -> f (Maybe POSIX)) -> CoreDevice -> f CoreDevice)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CoreDevice
-> f CoreDevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON CoreDevice where
parseJSON :: Value -> Parser CoreDevice
parseJSON =
String
-> (Object -> Parser CoreDevice) -> Value -> Parser CoreDevice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CoreDevice"
( \Object
x ->
Maybe CoreDeviceStatus -> Maybe Text -> Maybe POSIX -> CoreDevice
CoreDevice'
(Maybe CoreDeviceStatus -> Maybe Text -> Maybe POSIX -> CoreDevice)
-> Parser (Maybe CoreDeviceStatus)
-> Parser (Maybe Text -> Maybe POSIX -> CoreDevice)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CoreDeviceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser (Maybe Text -> Maybe POSIX -> CoreDevice)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> CoreDevice)
forall (f :: * -> *) a b. Applicative f => 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
"coreDeviceThingName")
Parser (Maybe POSIX -> CoreDevice)
-> Parser (Maybe POSIX) -> Parser CoreDevice
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastStatusUpdateTimestamp")
)
instance Prelude.Hashable CoreDevice
instance Prelude.NFData CoreDevice