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