{-# 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.IoT1ClickDevices.Types.DeviceMethod where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data DeviceMethod = DeviceMethod'
{
DeviceMethod -> Maybe Text
deviceType :: Prelude.Maybe Prelude.Text,
DeviceMethod -> Maybe Text
methodName :: Prelude.Maybe Prelude.Text
}
deriving (DeviceMethod -> DeviceMethod -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceMethod -> DeviceMethod -> Bool
$c/= :: DeviceMethod -> DeviceMethod -> Bool
== :: DeviceMethod -> DeviceMethod -> Bool
$c== :: DeviceMethod -> DeviceMethod -> Bool
Prelude.Eq, ReadPrec [DeviceMethod]
ReadPrec DeviceMethod
Int -> ReadS DeviceMethod
ReadS [DeviceMethod]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceMethod]
$creadListPrec :: ReadPrec [DeviceMethod]
readPrec :: ReadPrec DeviceMethod
$creadPrec :: ReadPrec DeviceMethod
readList :: ReadS [DeviceMethod]
$creadList :: ReadS [DeviceMethod]
readsPrec :: Int -> ReadS DeviceMethod
$creadsPrec :: Int -> ReadS DeviceMethod
Prelude.Read, Int -> DeviceMethod -> ShowS
[DeviceMethod] -> ShowS
DeviceMethod -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceMethod] -> ShowS
$cshowList :: [DeviceMethod] -> ShowS
show :: DeviceMethod -> String
$cshow :: DeviceMethod -> String
showsPrec :: Int -> DeviceMethod -> ShowS
$cshowsPrec :: Int -> DeviceMethod -> ShowS
Prelude.Show, forall x. Rep DeviceMethod x -> DeviceMethod
forall x. DeviceMethod -> Rep DeviceMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceMethod x -> DeviceMethod
$cfrom :: forall x. DeviceMethod -> Rep DeviceMethod x
Prelude.Generic)
newDeviceMethod ::
DeviceMethod
newDeviceMethod :: DeviceMethod
newDeviceMethod =
DeviceMethod'
{ $sel:deviceType:DeviceMethod' :: Maybe Text
deviceType = forall a. Maybe a
Prelude.Nothing,
$sel:methodName:DeviceMethod' :: Maybe Text
methodName = forall a. Maybe a
Prelude.Nothing
}
deviceMethod_deviceType :: Lens.Lens' DeviceMethod (Prelude.Maybe Prelude.Text)
deviceMethod_deviceType :: Lens' DeviceMethod (Maybe Text)
deviceMethod_deviceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceMethod' {Maybe Text
deviceType :: Maybe Text
$sel:deviceType:DeviceMethod' :: DeviceMethod -> Maybe Text
deviceType} -> Maybe Text
deviceType) (\s :: DeviceMethod
s@DeviceMethod' {} Maybe Text
a -> DeviceMethod
s {$sel:deviceType:DeviceMethod' :: Maybe Text
deviceType = Maybe Text
a} :: DeviceMethod)
deviceMethod_methodName :: Lens.Lens' DeviceMethod (Prelude.Maybe Prelude.Text)
deviceMethod_methodName :: Lens' DeviceMethod (Maybe Text)
deviceMethod_methodName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceMethod' {Maybe Text
methodName :: Maybe Text
$sel:methodName:DeviceMethod' :: DeviceMethod -> Maybe Text
methodName} -> Maybe Text
methodName) (\s :: DeviceMethod
s@DeviceMethod' {} Maybe Text
a -> DeviceMethod
s {$sel:methodName:DeviceMethod' :: Maybe Text
methodName = Maybe Text
a} :: DeviceMethod)
instance Data.FromJSON DeviceMethod where
parseJSON :: Value -> Parser DeviceMethod
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DeviceMethod"
( \Object
x ->
Maybe Text -> Maybe Text -> DeviceMethod
DeviceMethod'
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
"deviceType")
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
"methodName")
)
instance Prelude.Hashable DeviceMethod where
hashWithSalt :: Int -> DeviceMethod -> Int
hashWithSalt Int
_salt DeviceMethod' {Maybe Text
methodName :: Maybe Text
deviceType :: Maybe Text
$sel:methodName:DeviceMethod' :: DeviceMethod -> Maybe Text
$sel:deviceType:DeviceMethod' :: DeviceMethod -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
methodName
instance Prelude.NFData DeviceMethod where
rnf :: DeviceMethod -> ()
rnf DeviceMethod' {Maybe Text
methodName :: Maybe Text
deviceType :: Maybe Text
$sel:methodName:DeviceMethod' :: DeviceMethod -> Maybe Text
$sel:deviceType:DeviceMethod' :: DeviceMethod -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
methodName
instance Data.ToJSON DeviceMethod where
toJSON :: DeviceMethod -> Value
toJSON DeviceMethod' {Maybe Text
methodName :: Maybe Text
deviceType :: Maybe Text
$sel:methodName:DeviceMethod' :: DeviceMethod -> Maybe Text
$sel:deviceType:DeviceMethod' :: DeviceMethod -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"deviceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deviceType,
(Key
"methodName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
methodName
]
)