{-# 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.PropertyNotification where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.PropertyNotificationState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PropertyNotification = PropertyNotification'
{
PropertyNotification -> Text
topic :: Prelude.Text,
PropertyNotification -> PropertyNotificationState
state :: PropertyNotificationState
}
deriving (PropertyNotification -> PropertyNotification -> Bool
(PropertyNotification -> PropertyNotification -> Bool)
-> (PropertyNotification -> PropertyNotification -> Bool)
-> Eq PropertyNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PropertyNotification -> PropertyNotification -> Bool
$c/= :: PropertyNotification -> PropertyNotification -> Bool
== :: PropertyNotification -> PropertyNotification -> Bool
$c== :: PropertyNotification -> PropertyNotification -> Bool
Prelude.Eq, ReadPrec [PropertyNotification]
ReadPrec PropertyNotification
Int -> ReadS PropertyNotification
ReadS [PropertyNotification]
(Int -> ReadS PropertyNotification)
-> ReadS [PropertyNotification]
-> ReadPrec PropertyNotification
-> ReadPrec [PropertyNotification]
-> Read PropertyNotification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PropertyNotification]
$creadListPrec :: ReadPrec [PropertyNotification]
readPrec :: ReadPrec PropertyNotification
$creadPrec :: ReadPrec PropertyNotification
readList :: ReadS [PropertyNotification]
$creadList :: ReadS [PropertyNotification]
readsPrec :: Int -> ReadS PropertyNotification
$creadsPrec :: Int -> ReadS PropertyNotification
Prelude.Read, Int -> PropertyNotification -> ShowS
[PropertyNotification] -> ShowS
PropertyNotification -> String
(Int -> PropertyNotification -> ShowS)
-> (PropertyNotification -> String)
-> ([PropertyNotification] -> ShowS)
-> Show PropertyNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PropertyNotification] -> ShowS
$cshowList :: [PropertyNotification] -> ShowS
show :: PropertyNotification -> String
$cshow :: PropertyNotification -> String
showsPrec :: Int -> PropertyNotification -> ShowS
$cshowsPrec :: Int -> PropertyNotification -> ShowS
Prelude.Show, (forall x. PropertyNotification -> Rep PropertyNotification x)
-> (forall x. Rep PropertyNotification x -> PropertyNotification)
-> Generic PropertyNotification
forall x. Rep PropertyNotification x -> PropertyNotification
forall x. PropertyNotification -> Rep PropertyNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PropertyNotification x -> PropertyNotification
$cfrom :: forall x. PropertyNotification -> Rep PropertyNotification x
Prelude.Generic)
newPropertyNotification ::
Prelude.Text ->
PropertyNotificationState ->
PropertyNotification
newPropertyNotification :: Text -> PropertyNotificationState -> PropertyNotification
newPropertyNotification Text
pTopic_ PropertyNotificationState
pState_ =
PropertyNotification' :: Text -> PropertyNotificationState -> PropertyNotification
PropertyNotification'
{ $sel:topic:PropertyNotification' :: Text
topic = Text
pTopic_,
$sel:state:PropertyNotification' :: PropertyNotificationState
state = PropertyNotificationState
pState_
}
propertyNotification_topic :: Lens.Lens' PropertyNotification Prelude.Text
propertyNotification_topic :: (Text -> f Text) -> PropertyNotification -> f PropertyNotification
propertyNotification_topic = (PropertyNotification -> Text)
-> (PropertyNotification -> Text -> PropertyNotification)
-> Lens PropertyNotification PropertyNotification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyNotification' {Text
topic :: Text
$sel:topic:PropertyNotification' :: PropertyNotification -> Text
topic} -> Text
topic) (\s :: PropertyNotification
s@PropertyNotification' {} Text
a -> PropertyNotification
s {$sel:topic:PropertyNotification' :: Text
topic = Text
a} :: PropertyNotification)
propertyNotification_state :: Lens.Lens' PropertyNotification PropertyNotificationState
propertyNotification_state :: (PropertyNotificationState -> f PropertyNotificationState)
-> PropertyNotification -> f PropertyNotification
propertyNotification_state = (PropertyNotification -> PropertyNotificationState)
-> (PropertyNotification
-> PropertyNotificationState -> PropertyNotification)
-> Lens
PropertyNotification
PropertyNotification
PropertyNotificationState
PropertyNotificationState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyNotification' {PropertyNotificationState
state :: PropertyNotificationState
$sel:state:PropertyNotification' :: PropertyNotification -> PropertyNotificationState
state} -> PropertyNotificationState
state) (\s :: PropertyNotification
s@PropertyNotification' {} PropertyNotificationState
a -> PropertyNotification
s {$sel:state:PropertyNotification' :: PropertyNotificationState
state = PropertyNotificationState
a} :: PropertyNotification)
instance Core.FromJSON PropertyNotification where
parseJSON :: Value -> Parser PropertyNotification
parseJSON =
String
-> (Object -> Parser PropertyNotification)
-> Value
-> Parser PropertyNotification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PropertyNotification"
( \Object
x ->
Text -> PropertyNotificationState -> PropertyNotification
PropertyNotification'
(Text -> PropertyNotificationState -> PropertyNotification)
-> Parser Text
-> Parser (PropertyNotificationState -> PropertyNotification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"topic") Parser (PropertyNotificationState -> PropertyNotification)
-> Parser PropertyNotificationState -> Parser PropertyNotification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PropertyNotificationState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"state")
)
instance Prelude.Hashable PropertyNotification
instance Prelude.NFData PropertyNotification