{-# 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.AssetProperty where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.PropertyDataType
import Amazonka.IoTSiteWise.Types.PropertyNotification
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AssetProperty = AssetProperty'
{
AssetProperty -> Maybe Text
dataTypeSpec :: Prelude.Maybe Prelude.Text,
AssetProperty -> Maybe PropertyNotification
notification :: Prelude.Maybe PropertyNotification,
AssetProperty -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
AssetProperty -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
AssetProperty -> Text
id :: Prelude.Text,
AssetProperty -> Text
name :: Prelude.Text,
AssetProperty -> PropertyDataType
dataType :: PropertyDataType
}
deriving (AssetProperty -> AssetProperty -> Bool
(AssetProperty -> AssetProperty -> Bool)
-> (AssetProperty -> AssetProperty -> Bool) -> Eq AssetProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetProperty -> AssetProperty -> Bool
$c/= :: AssetProperty -> AssetProperty -> Bool
== :: AssetProperty -> AssetProperty -> Bool
$c== :: AssetProperty -> AssetProperty -> Bool
Prelude.Eq, ReadPrec [AssetProperty]
ReadPrec AssetProperty
Int -> ReadS AssetProperty
ReadS [AssetProperty]
(Int -> ReadS AssetProperty)
-> ReadS [AssetProperty]
-> ReadPrec AssetProperty
-> ReadPrec [AssetProperty]
-> Read AssetProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetProperty]
$creadListPrec :: ReadPrec [AssetProperty]
readPrec :: ReadPrec AssetProperty
$creadPrec :: ReadPrec AssetProperty
readList :: ReadS [AssetProperty]
$creadList :: ReadS [AssetProperty]
readsPrec :: Int -> ReadS AssetProperty
$creadsPrec :: Int -> ReadS AssetProperty
Prelude.Read, Int -> AssetProperty -> ShowS
[AssetProperty] -> ShowS
AssetProperty -> String
(Int -> AssetProperty -> ShowS)
-> (AssetProperty -> String)
-> ([AssetProperty] -> ShowS)
-> Show AssetProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetProperty] -> ShowS
$cshowList :: [AssetProperty] -> ShowS
show :: AssetProperty -> String
$cshow :: AssetProperty -> String
showsPrec :: Int -> AssetProperty -> ShowS
$cshowsPrec :: Int -> AssetProperty -> ShowS
Prelude.Show, (forall x. AssetProperty -> Rep AssetProperty x)
-> (forall x. Rep AssetProperty x -> AssetProperty)
-> Generic AssetProperty
forall x. Rep AssetProperty x -> AssetProperty
forall x. AssetProperty -> Rep AssetProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetProperty x -> AssetProperty
$cfrom :: forall x. AssetProperty -> Rep AssetProperty x
Prelude.Generic)
newAssetProperty ::
Prelude.Text ->
Prelude.Text ->
PropertyDataType ->
AssetProperty
newAssetProperty :: Text -> Text -> PropertyDataType -> AssetProperty
newAssetProperty Text
pId_ Text
pName_ PropertyDataType
pDataType_ =
AssetProperty' :: Maybe Text
-> Maybe PropertyNotification
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty
AssetProperty'
{ $sel:dataTypeSpec:AssetProperty' :: Maybe Text
dataTypeSpec = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:notification:AssetProperty' :: Maybe PropertyNotification
notification = Maybe PropertyNotification
forall a. Maybe a
Prelude.Nothing,
$sel:alias:AssetProperty' :: Maybe Text
alias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:unit:AssetProperty' :: Maybe Text
unit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:AssetProperty' :: Text
id = Text
pId_,
$sel:name:AssetProperty' :: Text
name = Text
pName_,
$sel:dataType:AssetProperty' :: PropertyDataType
dataType = PropertyDataType
pDataType_
}
assetProperty_dataTypeSpec :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_dataTypeSpec :: (Maybe Text -> f (Maybe Text)) -> AssetProperty -> f AssetProperty
assetProperty_dataTypeSpec = (AssetProperty -> Maybe Text)
-> (AssetProperty -> Maybe Text -> AssetProperty)
-> Lens AssetProperty AssetProperty (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
dataTypeSpec :: Maybe Text
$sel:dataTypeSpec:AssetProperty' :: AssetProperty -> Maybe Text
dataTypeSpec} -> Maybe Text
dataTypeSpec) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:dataTypeSpec:AssetProperty' :: Maybe Text
dataTypeSpec = Maybe Text
a} :: AssetProperty)
assetProperty_notification :: Lens.Lens' AssetProperty (Prelude.Maybe PropertyNotification)
assetProperty_notification :: (Maybe PropertyNotification -> f (Maybe PropertyNotification))
-> AssetProperty -> f AssetProperty
assetProperty_notification = (AssetProperty -> Maybe PropertyNotification)
-> (AssetProperty -> Maybe PropertyNotification -> AssetProperty)
-> Lens
AssetProperty
AssetProperty
(Maybe PropertyNotification)
(Maybe PropertyNotification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe PropertyNotification
notification :: Maybe PropertyNotification
$sel:notification:AssetProperty' :: AssetProperty -> Maybe PropertyNotification
notification} -> Maybe PropertyNotification
notification) (\s :: AssetProperty
s@AssetProperty' {} Maybe PropertyNotification
a -> AssetProperty
s {$sel:notification:AssetProperty' :: Maybe PropertyNotification
notification = Maybe PropertyNotification
a} :: AssetProperty)
assetProperty_alias :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_alias :: (Maybe Text -> f (Maybe Text)) -> AssetProperty -> f AssetProperty
assetProperty_alias = (AssetProperty -> Maybe Text)
-> (AssetProperty -> Maybe Text -> AssetProperty)
-> Lens AssetProperty AssetProperty (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
alias :: Maybe Text
$sel:alias:AssetProperty' :: AssetProperty -> Maybe Text
alias} -> Maybe Text
alias) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:alias:AssetProperty' :: Maybe Text
alias = Maybe Text
a} :: AssetProperty)
assetProperty_unit :: Lens.Lens' AssetProperty (Prelude.Maybe Prelude.Text)
assetProperty_unit :: (Maybe Text -> f (Maybe Text)) -> AssetProperty -> f AssetProperty
assetProperty_unit = (AssetProperty -> Maybe Text)
-> (AssetProperty -> Maybe Text -> AssetProperty)
-> Lens AssetProperty AssetProperty (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Maybe Text
unit :: Maybe Text
$sel:unit:AssetProperty' :: AssetProperty -> Maybe Text
unit} -> Maybe Text
unit) (\s :: AssetProperty
s@AssetProperty' {} Maybe Text
a -> AssetProperty
s {$sel:unit:AssetProperty' :: Maybe Text
unit = Maybe Text
a} :: AssetProperty)
assetProperty_id :: Lens.Lens' AssetProperty Prelude.Text
assetProperty_id :: (Text -> f Text) -> AssetProperty -> f AssetProperty
assetProperty_id = (AssetProperty -> Text)
-> (AssetProperty -> Text -> AssetProperty)
-> Lens AssetProperty AssetProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Text
id :: Text
$sel:id:AssetProperty' :: AssetProperty -> Text
id} -> Text
id) (\s :: AssetProperty
s@AssetProperty' {} Text
a -> AssetProperty
s {$sel:id:AssetProperty' :: Text
id = Text
a} :: AssetProperty)
assetProperty_name :: Lens.Lens' AssetProperty Prelude.Text
assetProperty_name :: (Text -> f Text) -> AssetProperty -> f AssetProperty
assetProperty_name = (AssetProperty -> Text)
-> (AssetProperty -> Text -> AssetProperty)
-> Lens AssetProperty AssetProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {Text
name :: Text
$sel:name:AssetProperty' :: AssetProperty -> Text
name} -> Text
name) (\s :: AssetProperty
s@AssetProperty' {} Text
a -> AssetProperty
s {$sel:name:AssetProperty' :: Text
name = Text
a} :: AssetProperty)
assetProperty_dataType :: Lens.Lens' AssetProperty PropertyDataType
assetProperty_dataType :: (PropertyDataType -> f PropertyDataType)
-> AssetProperty -> f AssetProperty
assetProperty_dataType = (AssetProperty -> PropertyDataType)
-> (AssetProperty -> PropertyDataType -> AssetProperty)
-> Lens
AssetProperty AssetProperty PropertyDataType PropertyDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetProperty' {PropertyDataType
dataType :: PropertyDataType
$sel:dataType:AssetProperty' :: AssetProperty -> PropertyDataType
dataType} -> PropertyDataType
dataType) (\s :: AssetProperty
s@AssetProperty' {} PropertyDataType
a -> AssetProperty
s {$sel:dataType:AssetProperty' :: PropertyDataType
dataType = PropertyDataType
a} :: AssetProperty)
instance Core.FromJSON AssetProperty where
parseJSON :: Value -> Parser AssetProperty
parseJSON =
String
-> (Object -> Parser AssetProperty)
-> Value
-> Parser AssetProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AssetProperty"
( \Object
x ->
Maybe Text
-> Maybe PropertyNotification
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty
AssetProperty'
(Maybe Text
-> Maybe PropertyNotification
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty)
-> Parser (Maybe Text)
-> Parser
(Maybe PropertyNotification
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataTypeSpec")
Parser
(Maybe PropertyNotification
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> AssetProperty)
-> Parser (Maybe PropertyNotification)
-> Parser
(Maybe Text
-> Maybe Text -> Text -> Text -> PropertyDataType -> AssetProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PropertyNotification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"notification")
Parser
(Maybe Text
-> Maybe Text -> Text -> Text -> PropertyDataType -> AssetProperty)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Text -> Text -> PropertyDataType -> AssetProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"alias")
Parser
(Maybe Text -> Text -> Text -> PropertyDataType -> AssetProperty)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> PropertyDataType -> AssetProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unit")
Parser (Text -> Text -> PropertyDataType -> AssetProperty)
-> Parser Text
-> Parser (Text -> PropertyDataType -> AssetProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"id")
Parser (Text -> PropertyDataType -> AssetProperty)
-> Parser Text -> Parser (PropertyDataType -> AssetProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
Parser (PropertyDataType -> AssetProperty)
-> Parser PropertyDataType -> Parser AssetProperty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PropertyDataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dataType")
)
instance Prelude.Hashable AssetProperty
instance Prelude.NFData AssetProperty