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