{-# 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.IoT1ClickProjects.Types.DeviceTemplate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DeviceTemplate = DeviceTemplate'
{
DeviceTemplate -> Maybe Text
deviceType :: Prelude.Maybe Prelude.Text,
DeviceTemplate -> Maybe (HashMap Text Text)
callbackOverrides :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (DeviceTemplate -> DeviceTemplate -> Bool
(DeviceTemplate -> DeviceTemplate -> Bool)
-> (DeviceTemplate -> DeviceTemplate -> Bool) -> Eq DeviceTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceTemplate -> DeviceTemplate -> Bool
$c/= :: DeviceTemplate -> DeviceTemplate -> Bool
== :: DeviceTemplate -> DeviceTemplate -> Bool
$c== :: DeviceTemplate -> DeviceTemplate -> Bool
Prelude.Eq, ReadPrec [DeviceTemplate]
ReadPrec DeviceTemplate
Int -> ReadS DeviceTemplate
ReadS [DeviceTemplate]
(Int -> ReadS DeviceTemplate)
-> ReadS [DeviceTemplate]
-> ReadPrec DeviceTemplate
-> ReadPrec [DeviceTemplate]
-> Read DeviceTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceTemplate]
$creadListPrec :: ReadPrec [DeviceTemplate]
readPrec :: ReadPrec DeviceTemplate
$creadPrec :: ReadPrec DeviceTemplate
readList :: ReadS [DeviceTemplate]
$creadList :: ReadS [DeviceTemplate]
readsPrec :: Int -> ReadS DeviceTemplate
$creadsPrec :: Int -> ReadS DeviceTemplate
Prelude.Read, Int -> DeviceTemplate -> ShowS
[DeviceTemplate] -> ShowS
DeviceTemplate -> String
(Int -> DeviceTemplate -> ShowS)
-> (DeviceTemplate -> String)
-> ([DeviceTemplate] -> ShowS)
-> Show DeviceTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceTemplate] -> ShowS
$cshowList :: [DeviceTemplate] -> ShowS
show :: DeviceTemplate -> String
$cshow :: DeviceTemplate -> String
showsPrec :: Int -> DeviceTemplate -> ShowS
$cshowsPrec :: Int -> DeviceTemplate -> ShowS
Prelude.Show, (forall x. DeviceTemplate -> Rep DeviceTemplate x)
-> (forall x. Rep DeviceTemplate x -> DeviceTemplate)
-> Generic DeviceTemplate
forall x. Rep DeviceTemplate x -> DeviceTemplate
forall x. DeviceTemplate -> Rep DeviceTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceTemplate x -> DeviceTemplate
$cfrom :: forall x. DeviceTemplate -> Rep DeviceTemplate x
Prelude.Generic)
newDeviceTemplate ::
DeviceTemplate
newDeviceTemplate :: DeviceTemplate
newDeviceTemplate =
DeviceTemplate' :: Maybe Text -> Maybe (HashMap Text Text) -> DeviceTemplate
DeviceTemplate'
{ $sel:deviceType:DeviceTemplate' :: Maybe Text
deviceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:callbackOverrides:DeviceTemplate' :: Maybe (HashMap Text Text)
callbackOverrides = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
deviceTemplate_deviceType :: Lens.Lens' DeviceTemplate (Prelude.Maybe Prelude.Text)
deviceTemplate_deviceType :: (Maybe Text -> f (Maybe Text))
-> DeviceTemplate -> f DeviceTemplate
deviceTemplate_deviceType = (DeviceTemplate -> Maybe Text)
-> (DeviceTemplate -> Maybe Text -> DeviceTemplate)
-> Lens DeviceTemplate DeviceTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceTemplate' {Maybe Text
deviceType :: Maybe Text
$sel:deviceType:DeviceTemplate' :: DeviceTemplate -> Maybe Text
deviceType} -> Maybe Text
deviceType) (\s :: DeviceTemplate
s@DeviceTemplate' {} Maybe Text
a -> DeviceTemplate
s {$sel:deviceType:DeviceTemplate' :: Maybe Text
deviceType = Maybe Text
a} :: DeviceTemplate)
deviceTemplate_callbackOverrides :: Lens.Lens' DeviceTemplate (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deviceTemplate_callbackOverrides :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceTemplate -> f DeviceTemplate
deviceTemplate_callbackOverrides = (DeviceTemplate -> Maybe (HashMap Text Text))
-> (DeviceTemplate -> Maybe (HashMap Text Text) -> DeviceTemplate)
-> Lens
DeviceTemplate
DeviceTemplate
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceTemplate' {Maybe (HashMap Text Text)
callbackOverrides :: Maybe (HashMap Text Text)
$sel:callbackOverrides:DeviceTemplate' :: DeviceTemplate -> Maybe (HashMap Text Text)
callbackOverrides} -> Maybe (HashMap Text Text)
callbackOverrides) (\s :: DeviceTemplate
s@DeviceTemplate' {} Maybe (HashMap Text Text)
a -> DeviceTemplate
s {$sel:callbackOverrides:DeviceTemplate' :: Maybe (HashMap Text Text)
callbackOverrides = Maybe (HashMap Text Text)
a} :: DeviceTemplate) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceTemplate -> f DeviceTemplate)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceTemplate
-> f DeviceTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DeviceTemplate where
parseJSON :: Value -> Parser DeviceTemplate
parseJSON =
String
-> (Object -> Parser DeviceTemplate)
-> Value
-> Parser DeviceTemplate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DeviceTemplate"
( \Object
x ->
Maybe Text -> Maybe (HashMap Text Text) -> DeviceTemplate
DeviceTemplate'
(Maybe Text -> Maybe (HashMap Text Text) -> DeviceTemplate)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> DeviceTemplate)
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
"deviceType")
Parser (Maybe (HashMap Text Text) -> DeviceTemplate)
-> Parser (Maybe (HashMap Text Text)) -> Parser DeviceTemplate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"callbackOverrides"
Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable DeviceTemplate
instance Prelude.NFData DeviceTemplate
instance Core.ToJSON DeviceTemplate where
toJSON :: DeviceTemplate -> Value
toJSON DeviceTemplate' {Maybe Text
Maybe (HashMap Text Text)
callbackOverrides :: Maybe (HashMap Text Text)
deviceType :: Maybe Text
$sel:callbackOverrides:DeviceTemplate' :: DeviceTemplate -> Maybe (HashMap Text Text)
$sel:deviceType:DeviceTemplate' :: DeviceTemplate -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"deviceType" 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
deviceType,
(Text
"callbackOverrides" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
callbackOverrides
]
)