{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.PropertyDataType
import Amazonka.IoTSiteWise.Types.PropertyNotification
import Amazonka.IoTSiteWise.Types.PropertyType
import qualified Amazonka.Prelude as Prelude
data Property = Property'
{
Property -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
Property -> Maybe PropertyNotification
notification :: Prelude.Maybe PropertyNotification,
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
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]
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
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. 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'
{ $sel:alias:Property' :: Maybe Text
alias = forall a. Maybe a
Prelude.Nothing,
$sel:notification:Property' :: Maybe PropertyNotification
notification = forall a. Maybe a
Prelude.Nothing,
$sel:type':Property' :: Maybe PropertyType
type' = forall a. Maybe a
Prelude.Nothing,
$sel:unit:Property' :: Maybe Text
unit = 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_alias :: Lens.Lens' Property (Prelude.Maybe Prelude.Text)
property_alias :: Lens' Property (Maybe Text)
property_alias = 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_notification :: Lens.Lens' Property (Prelude.Maybe PropertyNotification)
property_notification :: Lens' Property (Maybe PropertyNotification)
property_notification = 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_type :: Lens.Lens' Property (Prelude.Maybe PropertyType)
property_type :: Lens' Property (Maybe PropertyType)
property_type = 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 :: Lens' Property (Maybe Text)
property_unit = 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 :: Lens' Property Text
property_id = 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 :: Lens' Property Text
property_name = 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 :: Lens' Property PropertyDataType
property_dataType = 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 Data.FromJSON Property where
parseJSON :: Value -> Parser Property
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Property"
( \Object
x ->
Maybe Text
-> Maybe PropertyNotification
-> Maybe PropertyType
-> Maybe Text
-> Text
-> Text
-> PropertyDataType
-> Property
Property'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"alias")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"notification")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"unit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dataType")
)
instance Prelude.Hashable Property where
hashWithSalt :: Int -> Property -> Int
hashWithSalt Int
_salt Property' {Maybe Text
Maybe PropertyNotification
Maybe PropertyType
Text
PropertyDataType
dataType :: PropertyDataType
name :: Text
id :: Text
unit :: Maybe Text
type' :: Maybe PropertyType
notification :: Maybe PropertyNotification
alias :: Maybe Text
$sel:dataType:Property' :: Property -> PropertyDataType
$sel:name:Property' :: Property -> Text
$sel:id:Property' :: Property -> Text
$sel:unit:Property' :: Property -> Maybe Text
$sel:type':Property' :: Property -> Maybe PropertyType
$sel:notification:Property' :: Property -> Maybe PropertyNotification
$sel:alias:Property' :: Property -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
alias
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PropertyNotification
notification
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PropertyType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PropertyDataType
dataType
instance Prelude.NFData Property where
rnf :: Property -> ()
rnf Property' {Maybe Text
Maybe PropertyNotification
Maybe PropertyType
Text
PropertyDataType
dataType :: PropertyDataType
name :: Text
id :: Text
unit :: Maybe Text
type' :: Maybe PropertyType
notification :: Maybe PropertyNotification
alias :: Maybe Text
$sel:dataType:Property' :: Property -> PropertyDataType
$sel:name:Property' :: Property -> Text
$sel:id:Property' :: Property -> Text
$sel:unit:Property' :: Property -> Maybe Text
$sel:type':Property' :: Property -> Maybe PropertyType
$sel:notification:Property' :: Property -> Maybe PropertyNotification
$sel:alias:Property' :: Property -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
alias
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PropertyNotification
notification
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PropertyType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PropertyDataType
dataType