{-# 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.Core 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 Core = Core'
{
Core -> Maybe Bool
syncShadow :: Prelude.Maybe Prelude.Bool,
Core -> Text
thingArn :: Prelude.Text,
Core -> Text
id :: Prelude.Text,
Core -> Text
certificateArn :: Prelude.Text
}
deriving (Core -> Core -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Core -> Core -> Bool
$c/= :: Core -> Core -> Bool
== :: Core -> Core -> Bool
$c== :: Core -> Core -> Bool
Prelude.Eq, ReadPrec [Core]
ReadPrec Core
Int -> ReadS Core
ReadS [Core]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Core]
$creadListPrec :: ReadPrec [Core]
readPrec :: ReadPrec Core
$creadPrec :: ReadPrec Core
readList :: ReadS [Core]
$creadList :: ReadS [Core]
readsPrec :: Int -> ReadS Core
$creadsPrec :: Int -> ReadS Core
Prelude.Read, Int -> Core -> ShowS
[Core] -> ShowS
Core -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Core] -> ShowS
$cshowList :: [Core] -> ShowS
show :: Core -> String
$cshow :: Core -> String
showsPrec :: Int -> Core -> ShowS
$cshowsPrec :: Int -> Core -> ShowS
Prelude.Show, forall x. Rep Core x -> Core
forall x. Core -> Rep Core x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Core x -> Core
$cfrom :: forall x. Core -> Rep Core x
Prelude.Generic)
newCore ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Core
newCore :: Text -> Text -> Text -> Core
newCore Text
pThingArn_ Text
pId_ Text
pCertificateArn_ =
Core'
{ $sel:syncShadow:Core' :: Maybe Bool
syncShadow = forall a. Maybe a
Prelude.Nothing,
$sel:thingArn:Core' :: Text
thingArn = Text
pThingArn_,
$sel:id:Core' :: Text
id = Text
pId_,
$sel:certificateArn:Core' :: Text
certificateArn = Text
pCertificateArn_
}
core_syncShadow :: Lens.Lens' Core (Prelude.Maybe Prelude.Bool)
core_syncShadow :: Lens' Core (Maybe Bool)
core_syncShadow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Core' {Maybe Bool
syncShadow :: Maybe Bool
$sel:syncShadow:Core' :: Core -> Maybe Bool
syncShadow} -> Maybe Bool
syncShadow) (\s :: Core
s@Core' {} Maybe Bool
a -> Core
s {$sel:syncShadow:Core' :: Maybe Bool
syncShadow = Maybe Bool
a} :: Core)
core_thingArn :: Lens.Lens' Core Prelude.Text
core_thingArn :: Lens' Core Text
core_thingArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Core' {Text
thingArn :: Text
$sel:thingArn:Core' :: Core -> Text
thingArn} -> Text
thingArn) (\s :: Core
s@Core' {} Text
a -> Core
s {$sel:thingArn:Core' :: Text
thingArn = Text
a} :: Core)
core_id :: Lens.Lens' Core Prelude.Text
core_id :: Lens' Core Text
core_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Core' {Text
id :: Text
$sel:id:Core' :: Core -> Text
id} -> Text
id) (\s :: Core
s@Core' {} Text
a -> Core
s {$sel:id:Core' :: Text
id = Text
a} :: Core)
core_certificateArn :: Lens.Lens' Core Prelude.Text
core_certificateArn :: Lens' Core Text
core_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Core' {Text
certificateArn :: Text
$sel:certificateArn:Core' :: Core -> Text
certificateArn} -> Text
certificateArn) (\s :: Core
s@Core' {} Text
a -> Core
s {$sel:certificateArn:Core' :: Text
certificateArn = Text
a} :: Core)
instance Data.FromJSON Core where
parseJSON :: Value -> Parser Core
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Core"
( \Object
x ->
Maybe Bool -> Text -> Text -> Text -> Core
Core'
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 Core where
hashWithSalt :: Int -> Core -> Int
hashWithSalt Int
_salt Core' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Core' :: Core -> Text
$sel:id:Core' :: Core -> Text
$sel:thingArn:Core' :: Core -> Text
$sel:syncShadow:Core' :: Core -> 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 Core where
rnf :: Core -> ()
rnf Core' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Core' :: Core -> Text
$sel:id:Core' :: Core -> Text
$sel:thingArn:Core' :: Core -> Text
$sel:syncShadow:Core' :: Core -> 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 Core where
toJSON :: Core -> Value
toJSON Core' {Maybe Bool
Text
certificateArn :: Text
id :: Text
thingArn :: Text
syncShadow :: Maybe Bool
$sel:certificateArn:Core' :: Core -> Text
$sel:id:Core' :: Core -> Text
$sel:thingArn:Core' :: Core -> Text
$sel:syncShadow:Core' :: Core -> 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)
]
)