{-# 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.IoTFleetWise.Types.Attribute where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTFleetWise.Types.NodeDataType
import qualified Amazonka.Prelude as Prelude
data Attribute = Attribute'
{
Attribute -> Maybe [Text]
allowedValues :: Prelude.Maybe [Prelude.Text],
Attribute -> Maybe Text
assignedValue :: Prelude.Maybe Prelude.Text,
Attribute -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
Attribute -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Attribute -> Maybe Double
max :: Prelude.Maybe Prelude.Double,
Attribute -> Maybe Double
min :: Prelude.Maybe Prelude.Double,
Attribute -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
Attribute -> Text
fullyQualifiedName :: Prelude.Text,
Attribute -> NodeDataType
dataType :: NodeDataType
}
deriving (Attribute -> Attribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c== :: Attribute -> Attribute -> Bool
Prelude.Eq, ReadPrec [Attribute]
ReadPrec Attribute
Int -> ReadS Attribute
ReadS [Attribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Attribute]
$creadListPrec :: ReadPrec [Attribute]
readPrec :: ReadPrec Attribute
$creadPrec :: ReadPrec Attribute
readList :: ReadS [Attribute]
$creadList :: ReadS [Attribute]
readsPrec :: Int -> ReadS Attribute
$creadsPrec :: Int -> ReadS Attribute
Prelude.Read, Int -> Attribute -> ShowS
[Attribute] -> ShowS
Attribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attribute] -> ShowS
$cshowList :: [Attribute] -> ShowS
show :: Attribute -> String
$cshow :: Attribute -> String
showsPrec :: Int -> Attribute -> ShowS
$cshowsPrec :: Int -> Attribute -> ShowS
Prelude.Show, forall x. Rep Attribute x -> Attribute
forall x. Attribute -> Rep Attribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Attribute x -> Attribute
$cfrom :: forall x. Attribute -> Rep Attribute x
Prelude.Generic)
newAttribute ::
Prelude.Text ->
NodeDataType ->
Attribute
newAttribute :: Text -> NodeDataType -> Attribute
newAttribute Text
pFullyQualifiedName_ NodeDataType
pDataType_ =
Attribute'
{ $sel:allowedValues:Attribute' :: Maybe [Text]
allowedValues = forall a. Maybe a
Prelude.Nothing,
$sel:assignedValue:Attribute' :: Maybe Text
assignedValue = forall a. Maybe a
Prelude.Nothing,
$sel:defaultValue:Attribute' :: Maybe Text
defaultValue = forall a. Maybe a
Prelude.Nothing,
$sel:description:Attribute' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:max:Attribute' :: Maybe Double
max = forall a. Maybe a
Prelude.Nothing,
$sel:min:Attribute' :: Maybe Double
min = forall a. Maybe a
Prelude.Nothing,
$sel:unit:Attribute' :: Maybe Text
unit = forall a. Maybe a
Prelude.Nothing,
$sel:fullyQualifiedName:Attribute' :: Text
fullyQualifiedName = Text
pFullyQualifiedName_,
$sel:dataType:Attribute' :: NodeDataType
dataType = NodeDataType
pDataType_
}
attribute_allowedValues :: Lens.Lens' Attribute (Prelude.Maybe [Prelude.Text])
attribute_allowedValues :: Lens' Attribute (Maybe [Text])
attribute_allowedValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe [Text]
allowedValues :: Maybe [Text]
$sel:allowedValues:Attribute' :: Attribute -> Maybe [Text]
allowedValues} -> Maybe [Text]
allowedValues) (\s :: Attribute
s@Attribute' {} Maybe [Text]
a -> Attribute
s {$sel:allowedValues:Attribute' :: Maybe [Text]
allowedValues = Maybe [Text]
a} :: Attribute) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attribute_assignedValue :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_assignedValue :: Lens' Attribute (Maybe Text)
attribute_assignedValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
assignedValue :: Maybe Text
$sel:assignedValue:Attribute' :: Attribute -> Maybe Text
assignedValue} -> Maybe Text
assignedValue) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:assignedValue:Attribute' :: Maybe Text
assignedValue = Maybe Text
a} :: Attribute)
attribute_defaultValue :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_defaultValue :: Lens' Attribute (Maybe Text)
attribute_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:Attribute' :: Attribute -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:defaultValue:Attribute' :: Maybe Text
defaultValue = Maybe Text
a} :: Attribute)
attribute_description :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_description :: Lens' Attribute (Maybe Text)
attribute_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
description :: Maybe Text
$sel:description:Attribute' :: Attribute -> Maybe Text
description} -> Maybe Text
description) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:description:Attribute' :: Maybe Text
description = Maybe Text
a} :: Attribute)
attribute_max :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_max :: Lens' Attribute (Maybe Double)
attribute_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
max :: Maybe Double
$sel:max:Attribute' :: Attribute -> Maybe Double
max} -> Maybe Double
max) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:max:Attribute' :: Maybe Double
max = Maybe Double
a} :: Attribute)
attribute_min :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_min :: Lens' Attribute (Maybe Double)
attribute_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
min :: Maybe Double
$sel:min:Attribute' :: Attribute -> Maybe Double
min} -> Maybe Double
min) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:min:Attribute' :: Maybe Double
min = Maybe Double
a} :: Attribute)
attribute_unit :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_unit :: Lens' Attribute (Maybe Text)
attribute_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
unit :: Maybe Text
$sel:unit:Attribute' :: Attribute -> Maybe Text
unit} -> Maybe Text
unit) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:unit:Attribute' :: Maybe Text
unit = Maybe Text
a} :: Attribute)
attribute_fullyQualifiedName :: Lens.Lens' Attribute Prelude.Text
attribute_fullyQualifiedName :: Lens' Attribute Text
attribute_fullyQualifiedName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Text
fullyQualifiedName :: Text
$sel:fullyQualifiedName:Attribute' :: Attribute -> Text
fullyQualifiedName} -> Text
fullyQualifiedName) (\s :: Attribute
s@Attribute' {} Text
a -> Attribute
s {$sel:fullyQualifiedName:Attribute' :: Text
fullyQualifiedName = Text
a} :: Attribute)
attribute_dataType :: Lens.Lens' Attribute NodeDataType
attribute_dataType :: Lens' Attribute NodeDataType
attribute_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {NodeDataType
dataType :: NodeDataType
$sel:dataType:Attribute' :: Attribute -> NodeDataType
dataType} -> NodeDataType
dataType) (\s :: Attribute
s@Attribute' {} NodeDataType
a -> Attribute
s {$sel:dataType:Attribute' :: NodeDataType
dataType = NodeDataType
a} :: Attribute)
instance Data.FromJSON Attribute where
parseJSON :: Value -> Parser Attribute
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Attribute"
( \Object
x ->
Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> Text
-> NodeDataType
-> Attribute
Attribute'
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
"allowedValues" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"assignedValue")
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
"defaultValue")
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
"description")
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
"max")
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
"min")
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
"fullyQualifiedName")
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 Attribute where
hashWithSalt :: Int -> Attribute -> Int
hashWithSalt Int
_salt Attribute' {Maybe Double
Maybe [Text]
Maybe Text
Text
NodeDataType
dataType :: NodeDataType
fullyQualifiedName :: Text
unit :: Maybe Text
min :: Maybe Double
max :: Maybe Double
description :: Maybe Text
defaultValue :: Maybe Text
assignedValue :: Maybe Text
allowedValues :: Maybe [Text]
$sel:dataType:Attribute' :: Attribute -> NodeDataType
$sel:fullyQualifiedName:Attribute' :: Attribute -> Text
$sel:unit:Attribute' :: Attribute -> Maybe Text
$sel:min:Attribute' :: Attribute -> Maybe Double
$sel:max:Attribute' :: Attribute -> Maybe Double
$sel:description:Attribute' :: Attribute -> Maybe Text
$sel:defaultValue:Attribute' :: Attribute -> Maybe Text
$sel:assignedValue:Attribute' :: Attribute -> Maybe Text
$sel:allowedValues:Attribute' :: Attribute -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
allowedValues
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
assignedValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
max
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
min
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fullyQualifiedName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NodeDataType
dataType
instance Prelude.NFData Attribute where
rnf :: Attribute -> ()
rnf Attribute' {Maybe Double
Maybe [Text]
Maybe Text
Text
NodeDataType
dataType :: NodeDataType
fullyQualifiedName :: Text
unit :: Maybe Text
min :: Maybe Double
max :: Maybe Double
description :: Maybe Text
defaultValue :: Maybe Text
assignedValue :: Maybe Text
allowedValues :: Maybe [Text]
$sel:dataType:Attribute' :: Attribute -> NodeDataType
$sel:fullyQualifiedName:Attribute' :: Attribute -> Text
$sel:unit:Attribute' :: Attribute -> Maybe Text
$sel:min:Attribute' :: Attribute -> Maybe Double
$sel:max:Attribute' :: Attribute -> Maybe Double
$sel:description:Attribute' :: Attribute -> Maybe Text
$sel:defaultValue:Attribute' :: Attribute -> Maybe Text
$sel:assignedValue:Attribute' :: Attribute -> Maybe Text
$sel:allowedValues:Attribute' :: Attribute -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
allowedValues
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
assignedValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
max
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
min
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
fullyQualifiedName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NodeDataType
dataType
instance Data.ToJSON Attribute where
toJSON :: Attribute -> Value
toJSON Attribute' {Maybe Double
Maybe [Text]
Maybe Text
Text
NodeDataType
dataType :: NodeDataType
fullyQualifiedName :: Text
unit :: Maybe Text
min :: Maybe Double
max :: Maybe Double
description :: Maybe Text
defaultValue :: Maybe Text
assignedValue :: Maybe Text
allowedValues :: Maybe [Text]
$sel:dataType:Attribute' :: Attribute -> NodeDataType
$sel:fullyQualifiedName:Attribute' :: Attribute -> Text
$sel:unit:Attribute' :: Attribute -> Maybe Text
$sel:min:Attribute' :: Attribute -> Maybe Double
$sel:max:Attribute' :: Attribute -> Maybe Double
$sel:description:Attribute' :: Attribute -> Maybe Text
$sel:defaultValue:Attribute' :: Attribute -> Maybe Text
$sel:assignedValue:Attribute' :: Attribute -> Maybe Text
$sel:allowedValues:Attribute' :: Attribute -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"allowedValues" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
allowedValues,
(Key
"assignedValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
assignedValue,
(Key
"defaultValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultValue,
(Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"max" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
max,
(Key
"min" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
min,
(Key
"unit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
unit,
forall a. a -> Maybe a
Prelude.Just
(Key
"fullyQualifiedName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fullyQualifiedName),
forall a. a -> Maybe a
Prelude.Just (Key
"dataType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NodeDataType
dataType)
]
)