{-# 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.IoTSecureTunneling.Types.ConnectionState where
import qualified Amazonka.Core as Core
import Amazonka.IoTSecureTunneling.Types.ConnectionStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ConnectionState = ConnectionState'
{
ConnectionState -> Maybe ConnectionStatus
status :: Prelude.Maybe ConnectionStatus,
ConnectionState -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX
}
deriving (ConnectionState -> ConnectionState -> Bool
(ConnectionState -> ConnectionState -> Bool)
-> (ConnectionState -> ConnectionState -> Bool)
-> Eq ConnectionState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionState -> ConnectionState -> Bool
$c/= :: ConnectionState -> ConnectionState -> Bool
== :: ConnectionState -> ConnectionState -> Bool
$c== :: ConnectionState -> ConnectionState -> Bool
Prelude.Eq, ReadPrec [ConnectionState]
ReadPrec ConnectionState
Int -> ReadS ConnectionState
ReadS [ConnectionState]
(Int -> ReadS ConnectionState)
-> ReadS [ConnectionState]
-> ReadPrec ConnectionState
-> ReadPrec [ConnectionState]
-> Read ConnectionState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionState]
$creadListPrec :: ReadPrec [ConnectionState]
readPrec :: ReadPrec ConnectionState
$creadPrec :: ReadPrec ConnectionState
readList :: ReadS [ConnectionState]
$creadList :: ReadS [ConnectionState]
readsPrec :: Int -> ReadS ConnectionState
$creadsPrec :: Int -> ReadS ConnectionState
Prelude.Read, Int -> ConnectionState -> ShowS
[ConnectionState] -> ShowS
ConnectionState -> String
(Int -> ConnectionState -> ShowS)
-> (ConnectionState -> String)
-> ([ConnectionState] -> ShowS)
-> Show ConnectionState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionState] -> ShowS
$cshowList :: [ConnectionState] -> ShowS
show :: ConnectionState -> String
$cshow :: ConnectionState -> String
showsPrec :: Int -> ConnectionState -> ShowS
$cshowsPrec :: Int -> ConnectionState -> ShowS
Prelude.Show, (forall x. ConnectionState -> Rep ConnectionState x)
-> (forall x. Rep ConnectionState x -> ConnectionState)
-> Generic ConnectionState
forall x. Rep ConnectionState x -> ConnectionState
forall x. ConnectionState -> Rep ConnectionState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionState x -> ConnectionState
$cfrom :: forall x. ConnectionState -> Rep ConnectionState x
Prelude.Generic)
newConnectionState ::
ConnectionState
newConnectionState :: ConnectionState
newConnectionState =
ConnectionState' :: Maybe ConnectionStatus -> Maybe POSIX -> ConnectionState
ConnectionState'
{ $sel:status:ConnectionState' :: Maybe ConnectionStatus
status = Maybe ConnectionStatus
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdatedAt:ConnectionState' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
connectionState_status :: Lens.Lens' ConnectionState (Prelude.Maybe ConnectionStatus)
connectionState_status :: (Maybe ConnectionStatus -> f (Maybe ConnectionStatus))
-> ConnectionState -> f ConnectionState
connectionState_status = (ConnectionState -> Maybe ConnectionStatus)
-> (ConnectionState -> Maybe ConnectionStatus -> ConnectionState)
-> Lens
ConnectionState
ConnectionState
(Maybe ConnectionStatus)
(Maybe ConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionState' {Maybe ConnectionStatus
status :: Maybe ConnectionStatus
$sel:status:ConnectionState' :: ConnectionState -> Maybe ConnectionStatus
status} -> Maybe ConnectionStatus
status) (\s :: ConnectionState
s@ConnectionState' {} Maybe ConnectionStatus
a -> ConnectionState
s {$sel:status:ConnectionState' :: Maybe ConnectionStatus
status = Maybe ConnectionStatus
a} :: ConnectionState)
connectionState_lastUpdatedAt :: Lens.Lens' ConnectionState (Prelude.Maybe Prelude.UTCTime)
connectionState_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ConnectionState -> f ConnectionState
connectionState_lastUpdatedAt = (ConnectionState -> Maybe POSIX)
-> (ConnectionState -> Maybe POSIX -> ConnectionState)
-> Lens ConnectionState ConnectionState (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionState' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:ConnectionState' :: ConnectionState -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: ConnectionState
s@ConnectionState' {} Maybe POSIX
a -> ConnectionState
s {$sel:lastUpdatedAt:ConnectionState' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: ConnectionState) ((Maybe POSIX -> f (Maybe POSIX))
-> ConnectionState -> f ConnectionState)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ConnectionState
-> f ConnectionState
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 ConnectionState where
parseJSON :: Value -> Parser ConnectionState
parseJSON =
String
-> (Object -> Parser ConnectionState)
-> Value
-> Parser ConnectionState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConnectionState"
( \Object
x ->
Maybe ConnectionStatus -> Maybe POSIX -> ConnectionState
ConnectionState'
(Maybe ConnectionStatus -> Maybe POSIX -> ConnectionState)
-> Parser (Maybe ConnectionStatus)
-> Parser (Maybe POSIX -> ConnectionState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser (Maybe POSIX -> ConnectionState)
-> Parser (Maybe POSIX) -> Parser ConnectionState
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
"lastUpdatedAt")
)
instance Prelude.Hashable ConnectionState
instance Prelude.NFData ConnectionState