{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.PropertyNotificationState
import qualified Amazonka.Prelude as Prelude
data PropertyNotification = PropertyNotification'
{
PropertyNotification -> Text
topic :: Prelude.Text,
PropertyNotification -> PropertyNotificationState
state :: PropertyNotificationState
}
deriving (PropertyNotification -> PropertyNotification -> Bool
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]
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
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. 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'
{ $sel:topic:PropertyNotification' :: Text
topic = Text
pTopic_,
$sel:state:PropertyNotification' :: PropertyNotificationState
state = PropertyNotificationState
pState_
}
propertyNotification_topic :: Lens.Lens' PropertyNotification Prelude.Text
propertyNotification_topic :: Lens' PropertyNotification Text
propertyNotification_topic = 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 :: Lens' PropertyNotification PropertyNotificationState
propertyNotification_state = 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 Data.FromJSON PropertyNotification where
parseJSON :: Value -> Parser PropertyNotification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PropertyNotification"
( \Object
x ->
Text -> PropertyNotificationState -> PropertyNotification
PropertyNotification'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"topic")
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
"state")
)
instance Prelude.Hashable PropertyNotification where
hashWithSalt :: Int -> PropertyNotification -> Int
hashWithSalt Int
_salt PropertyNotification' {Text
PropertyNotificationState
state :: PropertyNotificationState
topic :: Text
$sel:state:PropertyNotification' :: PropertyNotification -> PropertyNotificationState
$sel:topic:PropertyNotification' :: PropertyNotification -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
topic
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PropertyNotificationState
state
instance Prelude.NFData PropertyNotification where
rnf :: PropertyNotification -> ()
rnf PropertyNotification' {Text
PropertyNotificationState
state :: PropertyNotificationState
topic :: Text
$sel:state:PropertyNotification' :: PropertyNotification -> PropertyNotificationState
$sel:topic:PropertyNotification' :: PropertyNotification -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
topic seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PropertyNotificationState
state