{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSecureTunneling.Types.ConnectionStatus
import qualified Amazonka.Prelude as Prelude
data ConnectionState = ConnectionState'
{
ConnectionState -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Data.POSIX,
ConnectionState -> Maybe ConnectionStatus
status :: Prelude.Maybe ConnectionStatus
}
deriving (ConnectionState -> ConnectionState -> Bool
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]
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
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. 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'
{ $sel:lastUpdatedAt:ConnectionState' :: Maybe POSIX
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
$sel:status:ConnectionState' :: Maybe ConnectionStatus
status = forall a. Maybe a
Prelude.Nothing
}
connectionState_lastUpdatedAt :: Lens.Lens' ConnectionState (Prelude.Maybe Prelude.UTCTime)
connectionState_lastUpdatedAt :: Lens' ConnectionState (Maybe UTCTime)
connectionState_lastUpdatedAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
connectionState_status :: Lens.Lens' ConnectionState (Prelude.Maybe ConnectionStatus)
connectionState_status :: Lens' ConnectionState (Maybe ConnectionStatus)
connectionState_status = 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)
instance Data.FromJSON ConnectionState where
parseJSON :: Value -> Parser ConnectionState
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ConnectionState"
( \Object
x ->
Maybe POSIX -> Maybe ConnectionStatus -> ConnectionState
ConnectionState'
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
"lastUpdatedAt")
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
"status")
)
instance Prelude.Hashable ConnectionState where
hashWithSalt :: Int -> ConnectionState -> Int
hashWithSalt Int
_salt ConnectionState' {Maybe POSIX
Maybe ConnectionStatus
status :: Maybe ConnectionStatus
lastUpdatedAt :: Maybe POSIX
$sel:status:ConnectionState' :: ConnectionState -> Maybe ConnectionStatus
$sel:lastUpdatedAt:ConnectionState' :: ConnectionState -> Maybe POSIX
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionStatus
status
instance Prelude.NFData ConnectionState where
rnf :: ConnectionState -> ()
rnf ConnectionState' {Maybe POSIX
Maybe ConnectionStatus
status :: Maybe ConnectionStatus
lastUpdatedAt :: Maybe POSIX
$sel:status:ConnectionState' :: ConnectionState -> Maybe ConnectionStatus
$sel:lastUpdatedAt:ConnectionState' :: ConnectionState -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionStatus
status