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