{-# 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.IoT.Types.ThingConnectivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ThingConnectivity = ThingConnectivity'
{
ThingConnectivity -> Maybe Text
disconnectReason :: Prelude.Maybe Prelude.Text,
ThingConnectivity -> Maybe Bool
connected :: Prelude.Maybe Prelude.Bool,
ThingConnectivity -> Maybe Integer
timestamp :: Prelude.Maybe Prelude.Integer
}
deriving (ThingConnectivity -> ThingConnectivity -> Bool
(ThingConnectivity -> ThingConnectivity -> Bool)
-> (ThingConnectivity -> ThingConnectivity -> Bool)
-> Eq ThingConnectivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingConnectivity -> ThingConnectivity -> Bool
$c/= :: ThingConnectivity -> ThingConnectivity -> Bool
== :: ThingConnectivity -> ThingConnectivity -> Bool
$c== :: ThingConnectivity -> ThingConnectivity -> Bool
Prelude.Eq, ReadPrec [ThingConnectivity]
ReadPrec ThingConnectivity
Int -> ReadS ThingConnectivity
ReadS [ThingConnectivity]
(Int -> ReadS ThingConnectivity)
-> ReadS [ThingConnectivity]
-> ReadPrec ThingConnectivity
-> ReadPrec [ThingConnectivity]
-> Read ThingConnectivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingConnectivity]
$creadListPrec :: ReadPrec [ThingConnectivity]
readPrec :: ReadPrec ThingConnectivity
$creadPrec :: ReadPrec ThingConnectivity
readList :: ReadS [ThingConnectivity]
$creadList :: ReadS [ThingConnectivity]
readsPrec :: Int -> ReadS ThingConnectivity
$creadsPrec :: Int -> ReadS ThingConnectivity
Prelude.Read, Int -> ThingConnectivity -> ShowS
[ThingConnectivity] -> ShowS
ThingConnectivity -> String
(Int -> ThingConnectivity -> ShowS)
-> (ThingConnectivity -> String)
-> ([ThingConnectivity] -> ShowS)
-> Show ThingConnectivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingConnectivity] -> ShowS
$cshowList :: [ThingConnectivity] -> ShowS
show :: ThingConnectivity -> String
$cshow :: ThingConnectivity -> String
showsPrec :: Int -> ThingConnectivity -> ShowS
$cshowsPrec :: Int -> ThingConnectivity -> ShowS
Prelude.Show, (forall x. ThingConnectivity -> Rep ThingConnectivity x)
-> (forall x. Rep ThingConnectivity x -> ThingConnectivity)
-> Generic ThingConnectivity
forall x. Rep ThingConnectivity x -> ThingConnectivity
forall x. ThingConnectivity -> Rep ThingConnectivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingConnectivity x -> ThingConnectivity
$cfrom :: forall x. ThingConnectivity -> Rep ThingConnectivity x
Prelude.Generic)
newThingConnectivity ::
ThingConnectivity
newThingConnectivity :: ThingConnectivity
newThingConnectivity =
ThingConnectivity' :: Maybe Text -> Maybe Bool -> Maybe Integer -> ThingConnectivity
ThingConnectivity'
{ $sel:disconnectReason:ThingConnectivity' :: Maybe Text
disconnectReason =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connected:ThingConnectivity' :: Maybe Bool
connected = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:ThingConnectivity' :: Maybe Integer
timestamp = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
thingConnectivity_disconnectReason :: Lens.Lens' ThingConnectivity (Prelude.Maybe Prelude.Text)
thingConnectivity_disconnectReason :: (Maybe Text -> f (Maybe Text))
-> ThingConnectivity -> f ThingConnectivity
thingConnectivity_disconnectReason = (ThingConnectivity -> Maybe Text)
-> (ThingConnectivity -> Maybe Text -> ThingConnectivity)
-> Lens
ThingConnectivity ThingConnectivity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingConnectivity' {Maybe Text
disconnectReason :: Maybe Text
$sel:disconnectReason:ThingConnectivity' :: ThingConnectivity -> Maybe Text
disconnectReason} -> Maybe Text
disconnectReason) (\s :: ThingConnectivity
s@ThingConnectivity' {} Maybe Text
a -> ThingConnectivity
s {$sel:disconnectReason:ThingConnectivity' :: Maybe Text
disconnectReason = Maybe Text
a} :: ThingConnectivity)
thingConnectivity_connected :: Lens.Lens' ThingConnectivity (Prelude.Maybe Prelude.Bool)
thingConnectivity_connected :: (Maybe Bool -> f (Maybe Bool))
-> ThingConnectivity -> f ThingConnectivity
thingConnectivity_connected = (ThingConnectivity -> Maybe Bool)
-> (ThingConnectivity -> Maybe Bool -> ThingConnectivity)
-> Lens
ThingConnectivity ThingConnectivity (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingConnectivity' {Maybe Bool
connected :: Maybe Bool
$sel:connected:ThingConnectivity' :: ThingConnectivity -> Maybe Bool
connected} -> Maybe Bool
connected) (\s :: ThingConnectivity
s@ThingConnectivity' {} Maybe Bool
a -> ThingConnectivity
s {$sel:connected:ThingConnectivity' :: Maybe Bool
connected = Maybe Bool
a} :: ThingConnectivity)
thingConnectivity_timestamp :: Lens.Lens' ThingConnectivity (Prelude.Maybe Prelude.Integer)
thingConnectivity_timestamp :: (Maybe Integer -> f (Maybe Integer))
-> ThingConnectivity -> f ThingConnectivity
thingConnectivity_timestamp = (ThingConnectivity -> Maybe Integer)
-> (ThingConnectivity -> Maybe Integer -> ThingConnectivity)
-> Lens
ThingConnectivity ThingConnectivity (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingConnectivity' {Maybe Integer
timestamp :: Maybe Integer
$sel:timestamp:ThingConnectivity' :: ThingConnectivity -> Maybe Integer
timestamp} -> Maybe Integer
timestamp) (\s :: ThingConnectivity
s@ThingConnectivity' {} Maybe Integer
a -> ThingConnectivity
s {$sel:timestamp:ThingConnectivity' :: Maybe Integer
timestamp = Maybe Integer
a} :: ThingConnectivity)
instance Core.FromJSON ThingConnectivity where
parseJSON :: Value -> Parser ThingConnectivity
parseJSON =
String
-> (Object -> Parser ThingConnectivity)
-> Value
-> Parser ThingConnectivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ThingConnectivity"
( \Object
x ->
Maybe Text -> Maybe Bool -> Maybe Integer -> ThingConnectivity
ThingConnectivity'
(Maybe Text -> Maybe Bool -> Maybe Integer -> ThingConnectivity)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Integer -> ThingConnectivity)
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
"disconnectReason")
Parser (Maybe Bool -> Maybe Integer -> ThingConnectivity)
-> Parser (Maybe Bool)
-> Parser (Maybe Integer -> ThingConnectivity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"connected")
Parser (Maybe Integer -> ThingConnectivity)
-> Parser (Maybe Integer) -> Parser ThingConnectivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timestamp")
)
instance Prelude.Hashable ThingConnectivity
instance Prelude.NFData ThingConnectivity