{-# 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.AssetCompositeModel where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.AssetProperty
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AssetCompositeModel = AssetCompositeModel'
{
AssetCompositeModel -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
AssetCompositeModel -> Text
name :: Prelude.Text,
AssetCompositeModel -> Text
type' :: Prelude.Text,
AssetCompositeModel -> [AssetProperty]
properties :: [AssetProperty]
}
deriving (AssetCompositeModel -> AssetCompositeModel -> Bool
(AssetCompositeModel -> AssetCompositeModel -> Bool)
-> (AssetCompositeModel -> AssetCompositeModel -> Bool)
-> Eq AssetCompositeModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetCompositeModel -> AssetCompositeModel -> Bool
$c/= :: AssetCompositeModel -> AssetCompositeModel -> Bool
== :: AssetCompositeModel -> AssetCompositeModel -> Bool
$c== :: AssetCompositeModel -> AssetCompositeModel -> Bool
Prelude.Eq, ReadPrec [AssetCompositeModel]
ReadPrec AssetCompositeModel
Int -> ReadS AssetCompositeModel
ReadS [AssetCompositeModel]
(Int -> ReadS AssetCompositeModel)
-> ReadS [AssetCompositeModel]
-> ReadPrec AssetCompositeModel
-> ReadPrec [AssetCompositeModel]
-> Read AssetCompositeModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetCompositeModel]
$creadListPrec :: ReadPrec [AssetCompositeModel]
readPrec :: ReadPrec AssetCompositeModel
$creadPrec :: ReadPrec AssetCompositeModel
readList :: ReadS [AssetCompositeModel]
$creadList :: ReadS [AssetCompositeModel]
readsPrec :: Int -> ReadS AssetCompositeModel
$creadsPrec :: Int -> ReadS AssetCompositeModel
Prelude.Read, Int -> AssetCompositeModel -> ShowS
[AssetCompositeModel] -> ShowS
AssetCompositeModel -> String
(Int -> AssetCompositeModel -> ShowS)
-> (AssetCompositeModel -> String)
-> ([AssetCompositeModel] -> ShowS)
-> Show AssetCompositeModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetCompositeModel] -> ShowS
$cshowList :: [AssetCompositeModel] -> ShowS
show :: AssetCompositeModel -> String
$cshow :: AssetCompositeModel -> String
showsPrec :: Int -> AssetCompositeModel -> ShowS
$cshowsPrec :: Int -> AssetCompositeModel -> ShowS
Prelude.Show, (forall x. AssetCompositeModel -> Rep AssetCompositeModel x)
-> (forall x. Rep AssetCompositeModel x -> AssetCompositeModel)
-> Generic AssetCompositeModel
forall x. Rep AssetCompositeModel x -> AssetCompositeModel
forall x. AssetCompositeModel -> Rep AssetCompositeModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetCompositeModel x -> AssetCompositeModel
$cfrom :: forall x. AssetCompositeModel -> Rep AssetCompositeModel x
Prelude.Generic)
newAssetCompositeModel ::
Prelude.Text ->
Prelude.Text ->
AssetCompositeModel
newAssetCompositeModel :: Text -> Text -> AssetCompositeModel
newAssetCompositeModel Text
pName_ Text
pType_ =
AssetCompositeModel' :: Maybe Text
-> Text -> Text -> [AssetProperty] -> AssetCompositeModel
AssetCompositeModel'
{ $sel:description:AssetCompositeModel' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:AssetCompositeModel' :: Text
name = Text
pName_,
$sel:type':AssetCompositeModel' :: Text
type' = Text
pType_,
$sel:properties:AssetCompositeModel' :: [AssetProperty]
properties = [AssetProperty]
forall a. Monoid a => a
Prelude.mempty
}
assetCompositeModel_description :: Lens.Lens' AssetCompositeModel (Prelude.Maybe Prelude.Text)
assetCompositeModel_description :: (Maybe Text -> f (Maybe Text))
-> AssetCompositeModel -> f AssetCompositeModel
assetCompositeModel_description = (AssetCompositeModel -> Maybe Text)
-> (AssetCompositeModel -> Maybe Text -> AssetCompositeModel)
-> Lens
AssetCompositeModel AssetCompositeModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetCompositeModel' {Maybe Text
description :: Maybe Text
$sel:description:AssetCompositeModel' :: AssetCompositeModel -> Maybe Text
description} -> Maybe Text
description) (\s :: AssetCompositeModel
s@AssetCompositeModel' {} Maybe Text
a -> AssetCompositeModel
s {$sel:description:AssetCompositeModel' :: Maybe Text
description = Maybe Text
a} :: AssetCompositeModel)
assetCompositeModel_name :: Lens.Lens' AssetCompositeModel Prelude.Text
assetCompositeModel_name :: (Text -> f Text) -> AssetCompositeModel -> f AssetCompositeModel
assetCompositeModel_name = (AssetCompositeModel -> Text)
-> (AssetCompositeModel -> Text -> AssetCompositeModel)
-> Lens AssetCompositeModel AssetCompositeModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetCompositeModel' {Text
name :: Text
$sel:name:AssetCompositeModel' :: AssetCompositeModel -> Text
name} -> Text
name) (\s :: AssetCompositeModel
s@AssetCompositeModel' {} Text
a -> AssetCompositeModel
s {$sel:name:AssetCompositeModel' :: Text
name = Text
a} :: AssetCompositeModel)
assetCompositeModel_type :: Lens.Lens' AssetCompositeModel Prelude.Text
assetCompositeModel_type :: (Text -> f Text) -> AssetCompositeModel -> f AssetCompositeModel
assetCompositeModel_type = (AssetCompositeModel -> Text)
-> (AssetCompositeModel -> Text -> AssetCompositeModel)
-> Lens AssetCompositeModel AssetCompositeModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetCompositeModel' {Text
type' :: Text
$sel:type':AssetCompositeModel' :: AssetCompositeModel -> Text
type'} -> Text
type') (\s :: AssetCompositeModel
s@AssetCompositeModel' {} Text
a -> AssetCompositeModel
s {$sel:type':AssetCompositeModel' :: Text
type' = Text
a} :: AssetCompositeModel)
assetCompositeModel_properties :: Lens.Lens' AssetCompositeModel [AssetProperty]
assetCompositeModel_properties :: ([AssetProperty] -> f [AssetProperty])
-> AssetCompositeModel -> f AssetCompositeModel
assetCompositeModel_properties = (AssetCompositeModel -> [AssetProperty])
-> (AssetCompositeModel -> [AssetProperty] -> AssetCompositeModel)
-> Lens
AssetCompositeModel
AssetCompositeModel
[AssetProperty]
[AssetProperty]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetCompositeModel' {[AssetProperty]
properties :: [AssetProperty]
$sel:properties:AssetCompositeModel' :: AssetCompositeModel -> [AssetProperty]
properties} -> [AssetProperty]
properties) (\s :: AssetCompositeModel
s@AssetCompositeModel' {} [AssetProperty]
a -> AssetCompositeModel
s {$sel:properties:AssetCompositeModel' :: [AssetProperty]
properties = [AssetProperty]
a} :: AssetCompositeModel) (([AssetProperty] -> f [AssetProperty])
-> AssetCompositeModel -> f AssetCompositeModel)
-> (([AssetProperty] -> f [AssetProperty])
-> [AssetProperty] -> f [AssetProperty])
-> ([AssetProperty] -> f [AssetProperty])
-> AssetCompositeModel
-> f AssetCompositeModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssetProperty] -> f [AssetProperty])
-> [AssetProperty] -> f [AssetProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AssetCompositeModel where
parseJSON :: Value -> Parser AssetCompositeModel
parseJSON =
String
-> (Object -> Parser AssetCompositeModel)
-> Value
-> Parser AssetCompositeModel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AssetCompositeModel"
( \Object
x ->
Maybe Text
-> Text -> Text -> [AssetProperty] -> AssetCompositeModel
AssetCompositeModel'
(Maybe Text
-> Text -> Text -> [AssetProperty] -> AssetCompositeModel)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> [AssetProperty] -> AssetCompositeModel)
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
"description")
Parser (Text -> Text -> [AssetProperty] -> AssetCompositeModel)
-> Parser Text
-> Parser (Text -> [AssetProperty] -> AssetCompositeModel)
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 (Text -> [AssetProperty] -> AssetCompositeModel)
-> Parser Text -> Parser ([AssetProperty] -> AssetCompositeModel)
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
"type")
Parser ([AssetProperty] -> AssetCompositeModel)
-> Parser [AssetProperty] -> Parser AssetCompositeModel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [AssetProperty])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"properties" Parser (Maybe [AssetProperty])
-> [AssetProperty] -> Parser [AssetProperty]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AssetProperty]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AssetCompositeModel
instance Prelude.NFData AssetCompositeModel