{-# 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.Greengrass.Types.Device 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 Device = Device'
{
Device -> Maybe Bool
syncShadow :: Prelude.Maybe Prelude.Bool,
Device -> Text
thingArn :: Prelude.Text,
Device -> Text
id :: Prelude.Text,
Device -> Text
certificateArn :: Prelude.Text
}
deriving (Device -> Device -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Device -> Device -> Bool
$c/= :: Device -> Device -> Bool
== :: Device -> Device -> Bool
$c== :: Device -> Device -> Bool
Prelude.Eq, ReadPrec [Device]
ReadPrec Device
Int -> ReadS Device
ReadS [Device]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Device]
$creadListPrec :: ReadPrec [Device]
readPrec :: ReadPrec Device
$creadPrec :: ReadPrec Device
readList :: ReadS [Device]
$creadList :: ReadS [Device]
readsPrec :: Int -> ReadS Device
$creadsPrec :: Int -> ReadS Device
Prelude.Read, Int -> Device -> ShowS
[Device] -> ShowS
Device -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Device] -> ShowS
$cshowList :: [Device] -> ShowS
show :: Device -> String
$cshow :: Device -> String
showsPrec :: Int -> Device -> ShowS
$cshowsPrec :: Int -> Device -> ShowS
Prelude.Show, forall x. Rep Device x -> Device
forall x. Device -> Rep Device x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Device x -> Device
$cfrom :: forall x. Device -> Rep Device x
Prelude.Generic)
newDevice ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Device
newDevice :: Text -> Text -> Text -> Device
newDevice Text
pThingArn_ Text
pId_ Text
pCertificateArn_ =
Device'
{ $sel:syncShadow:Device' :: Maybe Bool
syncShadow = forall a. Maybe a
Prelude.Nothing,
$sel:thingArn:Device' :: Text
thingArn = Text
pThingArn_,
$sel:id:Device' :: Text
id = Text
pId_,
$sel:certificateArn:Device' :: Text
certificateArn = Text
pCertificateArn_
}
device_syncShadow :: Lens.Lens' Device (Prelude.Maybe Prelude.Bool)
device_syncShadow :: Lens' Device (Maybe Bool)
device_syncShadow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Device' {Maybe Bool
syncShadow :: Maybe Bool
$sel:syncShadow:Device' :: Device -> Maybe Bool
syncShadow} -> Maybe Bool
syncShadow) (\s :: Device
s@Device' {} Maybe Bool
a -> Device
s {$sel:syncShadow:Device' :: Maybe Bool
syncShadow = Maybe Bool
a} :: Device)
device_thingArn :: Lens.Lens' Device Prelude.Text
device_thingArn :: Lens' Device Text
device_thingArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Device' {Text
thingArn :: Text
$sel:thingArn:Device' :: Device -> Text
thingArn} -> Text
thingArn) (\s :: Device
s@Device' {} Text
a -> Device
s {$sel:thingArn:Device' :: Text
thingArn = Text
a} :: Device)
device_id :: Lens.Lens' Device Prelude.Text
device_id :: Lens' Device Text
device_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Device' {Text
id :: Text
$sel:id:Device' :: Device -> Text
id} -> Text
id) (\s :: Device
s@Device' {} Text
a -> Device
s {$sel:id:Device' :: Text
id = Text
a} :: Device)
device_certificateArn :: Lens.Lens' Device Prelude.Text
device_certificateArn :: Lens' Device Text
device_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Device' {Text
certificateArn :: Text
$sel:certificateArn:Device' :: Device -> Text
certificateArn} -> Text
certificateArn) (\s :: Device
s@Device' {} Text
a -> Device
s {$sel:certificateArn:Device' :: Text
certificateArn = Text
a} :: Device)
instance Data.FromJSON Device where
parseJSON :: Value -> Parser Device
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Device"
( \Object
x ->
Maybe Bool -> Text -> Text -> Text -> Device
Device'
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
"SyncShadow")
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
"ThingArn")
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
"Id")
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
"CertificateArn")
)
instance Prelude.Hashable Device where
hashWithSalt :: Int -> Device -> Int
hashWithSalt Int
_salt Device' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Device' :: Device -> Text
$sel:id:Device' :: Device -> Text
$sel:thingArn:Device' :: Device -> Text
$sel:syncShadow:Device' :: Device -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
syncShadow
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
thingArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateArn
instance Prelude.NFData Device where
rnf :: Device -> ()
rnf Device' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Device' :: Device -> Text
$sel:id:Device' :: Device -> Text
$sel:thingArn:Device' :: Device -> Text
$sel:syncShadow:Device' :: Device -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
syncShadow
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
thingArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
certificateArn
instance Data.ToJSON Device where
toJSON :: Device -> Value
toJSON Device' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Device' :: Device -> Text
$sel:id:Device' :: Device -> Text
$sel:thingArn:Device' :: Device -> Text
$sel:syncShadow:Device' :: Device -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SyncShadow" 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 Bool
syncShadow,
forall a. a -> Maybe a
Prelude.Just (Key
"ThingArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
thingArn),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
forall a. a -> Maybe a
Prelude.Just
(Key
"CertificateArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
certificateArn)
]
)