{-# 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.IoTEvents.Types.IotSiteWiseAction where
import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.AssetPropertyValue
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IotSiteWiseAction = IotSiteWiseAction'
{
IotSiteWiseAction -> Maybe Text
entryId :: Prelude.Maybe Prelude.Text,
IotSiteWiseAction -> Maybe Text
propertyAlias :: Prelude.Maybe Prelude.Text,
IotSiteWiseAction -> Maybe AssetPropertyValue
propertyValue :: Prelude.Maybe AssetPropertyValue,
IotSiteWiseAction -> Maybe Text
propertyId :: Prelude.Maybe Prelude.Text,
IotSiteWiseAction -> Maybe Text
assetId :: Prelude.Maybe Prelude.Text
}
deriving (IotSiteWiseAction -> IotSiteWiseAction -> Bool
(IotSiteWiseAction -> IotSiteWiseAction -> Bool)
-> (IotSiteWiseAction -> IotSiteWiseAction -> Bool)
-> Eq IotSiteWiseAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
$c/= :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
== :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
$c== :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
Prelude.Eq, ReadPrec [IotSiteWiseAction]
ReadPrec IotSiteWiseAction
Int -> ReadS IotSiteWiseAction
ReadS [IotSiteWiseAction]
(Int -> ReadS IotSiteWiseAction)
-> ReadS [IotSiteWiseAction]
-> ReadPrec IotSiteWiseAction
-> ReadPrec [IotSiteWiseAction]
-> Read IotSiteWiseAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IotSiteWiseAction]
$creadListPrec :: ReadPrec [IotSiteWiseAction]
readPrec :: ReadPrec IotSiteWiseAction
$creadPrec :: ReadPrec IotSiteWiseAction
readList :: ReadS [IotSiteWiseAction]
$creadList :: ReadS [IotSiteWiseAction]
readsPrec :: Int -> ReadS IotSiteWiseAction
$creadsPrec :: Int -> ReadS IotSiteWiseAction
Prelude.Read, Int -> IotSiteWiseAction -> ShowS
[IotSiteWiseAction] -> ShowS
IotSiteWiseAction -> String
(Int -> IotSiteWiseAction -> ShowS)
-> (IotSiteWiseAction -> String)
-> ([IotSiteWiseAction] -> ShowS)
-> Show IotSiteWiseAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IotSiteWiseAction] -> ShowS
$cshowList :: [IotSiteWiseAction] -> ShowS
show :: IotSiteWiseAction -> String
$cshow :: IotSiteWiseAction -> String
showsPrec :: Int -> IotSiteWiseAction -> ShowS
$cshowsPrec :: Int -> IotSiteWiseAction -> ShowS
Prelude.Show, (forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x)
-> (forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction)
-> Generic IotSiteWiseAction
forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction
forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction
$cfrom :: forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x
Prelude.Generic)
newIotSiteWiseAction ::
IotSiteWiseAction
newIotSiteWiseAction :: IotSiteWiseAction
newIotSiteWiseAction =
IotSiteWiseAction' :: Maybe Text
-> Maybe Text
-> Maybe AssetPropertyValue
-> Maybe Text
-> Maybe Text
-> IotSiteWiseAction
IotSiteWiseAction'
{ $sel:entryId:IotSiteWiseAction' :: Maybe Text
entryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:propertyAlias:IotSiteWiseAction' :: Maybe Text
propertyAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:propertyValue:IotSiteWiseAction' :: Maybe AssetPropertyValue
propertyValue = Maybe AssetPropertyValue
forall a. Maybe a
Prelude.Nothing,
$sel:propertyId:IotSiteWiseAction' :: Maybe Text
propertyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetId:IotSiteWiseAction' :: Maybe Text
assetId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
iotSiteWiseAction_entryId :: Lens.Lens' IotSiteWiseAction (Prelude.Maybe Prelude.Text)
iotSiteWiseAction_entryId :: (Maybe Text -> f (Maybe Text))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_entryId = (IotSiteWiseAction -> Maybe Text)
-> (IotSiteWiseAction -> Maybe Text -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction IotSiteWiseAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Maybe Text
entryId :: Maybe Text
$sel:entryId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
entryId} -> Maybe Text
entryId) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Maybe Text
a -> IotSiteWiseAction
s {$sel:entryId:IotSiteWiseAction' :: Maybe Text
entryId = Maybe Text
a} :: IotSiteWiseAction)
iotSiteWiseAction_propertyAlias :: Lens.Lens' IotSiteWiseAction (Prelude.Maybe Prelude.Text)
iotSiteWiseAction_propertyAlias :: (Maybe Text -> f (Maybe Text))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_propertyAlias = (IotSiteWiseAction -> Maybe Text)
-> (IotSiteWiseAction -> Maybe Text -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction IotSiteWiseAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Maybe Text
propertyAlias :: Maybe Text
$sel:propertyAlias:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
propertyAlias} -> Maybe Text
propertyAlias) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Maybe Text
a -> IotSiteWiseAction
s {$sel:propertyAlias:IotSiteWiseAction' :: Maybe Text
propertyAlias = Maybe Text
a} :: IotSiteWiseAction)
iotSiteWiseAction_propertyValue :: Lens.Lens' IotSiteWiseAction (Prelude.Maybe AssetPropertyValue)
iotSiteWiseAction_propertyValue :: (Maybe AssetPropertyValue -> f (Maybe AssetPropertyValue))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_propertyValue = (IotSiteWiseAction -> Maybe AssetPropertyValue)
-> (IotSiteWiseAction
-> Maybe AssetPropertyValue -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction
IotSiteWiseAction
(Maybe AssetPropertyValue)
(Maybe AssetPropertyValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Maybe AssetPropertyValue
propertyValue :: Maybe AssetPropertyValue
$sel:propertyValue:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe AssetPropertyValue
propertyValue} -> Maybe AssetPropertyValue
propertyValue) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Maybe AssetPropertyValue
a -> IotSiteWiseAction
s {$sel:propertyValue:IotSiteWiseAction' :: Maybe AssetPropertyValue
propertyValue = Maybe AssetPropertyValue
a} :: IotSiteWiseAction)
iotSiteWiseAction_propertyId :: Lens.Lens' IotSiteWiseAction (Prelude.Maybe Prelude.Text)
iotSiteWiseAction_propertyId :: (Maybe Text -> f (Maybe Text))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_propertyId = (IotSiteWiseAction -> Maybe Text)
-> (IotSiteWiseAction -> Maybe Text -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction IotSiteWiseAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Maybe Text
propertyId :: Maybe Text
$sel:propertyId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
propertyId} -> Maybe Text
propertyId) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Maybe Text
a -> IotSiteWiseAction
s {$sel:propertyId:IotSiteWiseAction' :: Maybe Text
propertyId = Maybe Text
a} :: IotSiteWiseAction)
iotSiteWiseAction_assetId :: Lens.Lens' IotSiteWiseAction (Prelude.Maybe Prelude.Text)
iotSiteWiseAction_assetId :: (Maybe Text -> f (Maybe Text))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_assetId = (IotSiteWiseAction -> Maybe Text)
-> (IotSiteWiseAction -> Maybe Text -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction IotSiteWiseAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Maybe Text
assetId :: Maybe Text
$sel:assetId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
assetId} -> Maybe Text
assetId) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Maybe Text
a -> IotSiteWiseAction
s {$sel:assetId:IotSiteWiseAction' :: Maybe Text
assetId = Maybe Text
a} :: IotSiteWiseAction)
instance Core.FromJSON IotSiteWiseAction where
parseJSON :: Value -> Parser IotSiteWiseAction
parseJSON =
String
-> (Object -> Parser IotSiteWiseAction)
-> Value
-> Parser IotSiteWiseAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IotSiteWiseAction"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe AssetPropertyValue
-> Maybe Text
-> Maybe Text
-> IotSiteWiseAction
IotSiteWiseAction'
(Maybe Text
-> Maybe Text
-> Maybe AssetPropertyValue
-> Maybe Text
-> Maybe Text
-> IotSiteWiseAction)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe AssetPropertyValue
-> Maybe Text
-> Maybe Text
-> IotSiteWiseAction)
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
"entryId")
Parser
(Maybe Text
-> Maybe AssetPropertyValue
-> Maybe Text
-> Maybe Text
-> IotSiteWiseAction)
-> Parser (Maybe Text)
-> Parser
(Maybe AssetPropertyValue
-> Maybe Text -> Maybe Text -> IotSiteWiseAction)
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
"propertyAlias")
Parser
(Maybe AssetPropertyValue
-> Maybe Text -> Maybe Text -> IotSiteWiseAction)
-> Parser (Maybe AssetPropertyValue)
-> Parser (Maybe Text -> Maybe Text -> IotSiteWiseAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssetPropertyValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"propertyValue")
Parser (Maybe Text -> Maybe Text -> IotSiteWiseAction)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IotSiteWiseAction)
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
"propertyId")
Parser (Maybe Text -> IotSiteWiseAction)
-> Parser (Maybe Text) -> Parser IotSiteWiseAction
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
"assetId")
)
instance Prelude.Hashable IotSiteWiseAction
instance Prelude.NFData IotSiteWiseAction
instance Core.ToJSON IotSiteWiseAction where
toJSON :: IotSiteWiseAction -> Value
toJSON IotSiteWiseAction' {Maybe Text
Maybe AssetPropertyValue
assetId :: Maybe Text
propertyId :: Maybe Text
propertyValue :: Maybe AssetPropertyValue
propertyAlias :: Maybe Text
entryId :: Maybe Text
$sel:assetId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
$sel:propertyId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
$sel:propertyValue:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe AssetPropertyValue
$sel:propertyAlias:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
$sel:entryId:IotSiteWiseAction' :: IotSiteWiseAction -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"entryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
entryId,
(Text
"propertyAlias" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
propertyAlias,
(Text
"propertyValue" Text -> AssetPropertyValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AssetPropertyValue -> Pair)
-> Maybe AssetPropertyValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssetPropertyValue
propertyValue,
(Text
"propertyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
propertyId,
(Text
"assetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
assetId
]
)