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