{-# 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.IotTwinMaker.Types.PropertyResponse where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.DataValue
import Amazonka.IotTwinMaker.Types.PropertyDefinitionResponse
import qualified Amazonka.Prelude as Prelude
data PropertyResponse = PropertyResponse'
{
PropertyResponse -> Maybe PropertyDefinitionResponse
definition :: Prelude.Maybe PropertyDefinitionResponse,
PropertyResponse -> Maybe DataValue
value :: Prelude.Maybe DataValue
}
deriving (PropertyResponse -> PropertyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PropertyResponse -> PropertyResponse -> Bool
$c/= :: PropertyResponse -> PropertyResponse -> Bool
== :: PropertyResponse -> PropertyResponse -> Bool
$c== :: PropertyResponse -> PropertyResponse -> Bool
Prelude.Eq, ReadPrec [PropertyResponse]
ReadPrec PropertyResponse
Int -> ReadS PropertyResponse
ReadS [PropertyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PropertyResponse]
$creadListPrec :: ReadPrec [PropertyResponse]
readPrec :: ReadPrec PropertyResponse
$creadPrec :: ReadPrec PropertyResponse
readList :: ReadS [PropertyResponse]
$creadList :: ReadS [PropertyResponse]
readsPrec :: Int -> ReadS PropertyResponse
$creadsPrec :: Int -> ReadS PropertyResponse
Prelude.Read, Int -> PropertyResponse -> ShowS
[PropertyResponse] -> ShowS
PropertyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PropertyResponse] -> ShowS
$cshowList :: [PropertyResponse] -> ShowS
show :: PropertyResponse -> String
$cshow :: PropertyResponse -> String
showsPrec :: Int -> PropertyResponse -> ShowS
$cshowsPrec :: Int -> PropertyResponse -> ShowS
Prelude.Show, forall x. Rep PropertyResponse x -> PropertyResponse
forall x. PropertyResponse -> Rep PropertyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PropertyResponse x -> PropertyResponse
$cfrom :: forall x. PropertyResponse -> Rep PropertyResponse x
Prelude.Generic)
newPropertyResponse ::
PropertyResponse
newPropertyResponse :: PropertyResponse
newPropertyResponse =
PropertyResponse'
{ $sel:definition:PropertyResponse' :: Maybe PropertyDefinitionResponse
definition = forall a. Maybe a
Prelude.Nothing,
$sel:value:PropertyResponse' :: Maybe DataValue
value = forall a. Maybe a
Prelude.Nothing
}
propertyResponse_definition :: Lens.Lens' PropertyResponse (Prelude.Maybe PropertyDefinitionResponse)
propertyResponse_definition :: Lens' PropertyResponse (Maybe PropertyDefinitionResponse)
propertyResponse_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyResponse' {Maybe PropertyDefinitionResponse
definition :: Maybe PropertyDefinitionResponse
$sel:definition:PropertyResponse' :: PropertyResponse -> Maybe PropertyDefinitionResponse
definition} -> Maybe PropertyDefinitionResponse
definition) (\s :: PropertyResponse
s@PropertyResponse' {} Maybe PropertyDefinitionResponse
a -> PropertyResponse
s {$sel:definition:PropertyResponse' :: Maybe PropertyDefinitionResponse
definition = Maybe PropertyDefinitionResponse
a} :: PropertyResponse)
propertyResponse_value :: Lens.Lens' PropertyResponse (Prelude.Maybe DataValue)
propertyResponse_value :: Lens' PropertyResponse (Maybe DataValue)
propertyResponse_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PropertyResponse' {Maybe DataValue
value :: Maybe DataValue
$sel:value:PropertyResponse' :: PropertyResponse -> Maybe DataValue
value} -> Maybe DataValue
value) (\s :: PropertyResponse
s@PropertyResponse' {} Maybe DataValue
a -> PropertyResponse
s {$sel:value:PropertyResponse' :: Maybe DataValue
value = Maybe DataValue
a} :: PropertyResponse)
instance Data.FromJSON PropertyResponse where
parseJSON :: Value -> Parser PropertyResponse
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PropertyResponse"
( \Object
x ->
Maybe PropertyDefinitionResponse
-> Maybe DataValue -> PropertyResponse
PropertyResponse'
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
"definition")
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
"value")
)
instance Prelude.Hashable PropertyResponse where
hashWithSalt :: Int -> PropertyResponse -> Int
hashWithSalt Int
_salt PropertyResponse' {Maybe DataValue
Maybe PropertyDefinitionResponse
value :: Maybe DataValue
definition :: Maybe PropertyDefinitionResponse
$sel:value:PropertyResponse' :: PropertyResponse -> Maybe DataValue
$sel:definition:PropertyResponse' :: PropertyResponse -> Maybe PropertyDefinitionResponse
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PropertyDefinitionResponse
definition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataValue
value
instance Prelude.NFData PropertyResponse where
rnf :: PropertyResponse -> ()
rnf PropertyResponse' {Maybe DataValue
Maybe PropertyDefinitionResponse
value :: Maybe DataValue
definition :: Maybe PropertyDefinitionResponse
$sel:value:PropertyResponse' :: PropertyResponse -> Maybe DataValue
$sel:definition:PropertyResponse' :: PropertyResponse -> Maybe PropertyDefinitionResponse
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe PropertyDefinitionResponse
definition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataValue
value