{-# 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.IoT.Types.ThingDocument where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.ThingConnectivity
import qualified Amazonka.Prelude as Prelude
data ThingDocument = ThingDocument'
{
ThingDocument -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ThingDocument -> Maybe ThingConnectivity
connectivity :: Prelude.Maybe ThingConnectivity,
ThingDocument -> Maybe Text
deviceDefender :: Prelude.Maybe Prelude.Text,
ThingDocument -> Maybe Text
shadow :: Prelude.Maybe Prelude.Text,
ThingDocument -> Maybe [Text]
thingGroupNames :: Prelude.Maybe [Prelude.Text],
ThingDocument -> Maybe Text
thingId :: Prelude.Maybe Prelude.Text,
ThingDocument -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text,
ThingDocument -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text
}
deriving (ThingDocument -> ThingDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingDocument -> ThingDocument -> Bool
$c/= :: ThingDocument -> ThingDocument -> Bool
== :: ThingDocument -> ThingDocument -> Bool
$c== :: ThingDocument -> ThingDocument -> Bool
Prelude.Eq, ReadPrec [ThingDocument]
ReadPrec ThingDocument
Int -> ReadS ThingDocument
ReadS [ThingDocument]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingDocument]
$creadListPrec :: ReadPrec [ThingDocument]
readPrec :: ReadPrec ThingDocument
$creadPrec :: ReadPrec ThingDocument
readList :: ReadS [ThingDocument]
$creadList :: ReadS [ThingDocument]
readsPrec :: Int -> ReadS ThingDocument
$creadsPrec :: Int -> ReadS ThingDocument
Prelude.Read, Int -> ThingDocument -> ShowS
[ThingDocument] -> ShowS
ThingDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingDocument] -> ShowS
$cshowList :: [ThingDocument] -> ShowS
show :: ThingDocument -> String
$cshow :: ThingDocument -> String
showsPrec :: Int -> ThingDocument -> ShowS
$cshowsPrec :: Int -> ThingDocument -> ShowS
Prelude.Show, forall x. Rep ThingDocument x -> ThingDocument
forall x. ThingDocument -> Rep ThingDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingDocument x -> ThingDocument
$cfrom :: forall x. ThingDocument -> Rep ThingDocument x
Prelude.Generic)
newThingDocument ::
ThingDocument
newThingDocument :: ThingDocument
newThingDocument =
ThingDocument'
{ $sel:attributes:ThingDocument' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:connectivity:ThingDocument' :: Maybe ThingConnectivity
connectivity = forall a. Maybe a
Prelude.Nothing,
$sel:deviceDefender:ThingDocument' :: Maybe Text
deviceDefender = forall a. Maybe a
Prelude.Nothing,
$sel:shadow:ThingDocument' :: Maybe Text
shadow = forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupNames:ThingDocument' :: Maybe [Text]
thingGroupNames = forall a. Maybe a
Prelude.Nothing,
$sel:thingId:ThingDocument' :: Maybe Text
thingId = forall a. Maybe a
Prelude.Nothing,
$sel:thingName:ThingDocument' :: Maybe Text
thingName = forall a. Maybe a
Prelude.Nothing,
$sel:thingTypeName:ThingDocument' :: Maybe Text
thingTypeName = forall a. Maybe a
Prelude.Nothing
}
thingDocument_attributes :: Lens.Lens' ThingDocument (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
thingDocument_attributes :: Lens' ThingDocument (Maybe (HashMap Text Text))
thingDocument_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:ThingDocument' :: ThingDocument -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: ThingDocument
s@ThingDocument' {} Maybe (HashMap Text Text)
a -> ThingDocument
s {$sel:attributes:ThingDocument' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: ThingDocument) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
thingDocument_connectivity :: Lens.Lens' ThingDocument (Prelude.Maybe ThingConnectivity)
thingDocument_connectivity :: Lens' ThingDocument (Maybe ThingConnectivity)
thingDocument_connectivity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe ThingConnectivity
connectivity :: Maybe ThingConnectivity
$sel:connectivity:ThingDocument' :: ThingDocument -> Maybe ThingConnectivity
connectivity} -> Maybe ThingConnectivity
connectivity) (\s :: ThingDocument
s@ThingDocument' {} Maybe ThingConnectivity
a -> ThingDocument
s {$sel:connectivity:ThingDocument' :: Maybe ThingConnectivity
connectivity = Maybe ThingConnectivity
a} :: ThingDocument)
thingDocument_deviceDefender :: Lens.Lens' ThingDocument (Prelude.Maybe Prelude.Text)
thingDocument_deviceDefender :: Lens' ThingDocument (Maybe Text)
thingDocument_deviceDefender = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe Text
deviceDefender :: Maybe Text
$sel:deviceDefender:ThingDocument' :: ThingDocument -> Maybe Text
deviceDefender} -> Maybe Text
deviceDefender) (\s :: ThingDocument
s@ThingDocument' {} Maybe Text
a -> ThingDocument
s {$sel:deviceDefender:ThingDocument' :: Maybe Text
deviceDefender = Maybe Text
a} :: ThingDocument)
thingDocument_shadow :: Lens.Lens' ThingDocument (Prelude.Maybe Prelude.Text)
thingDocument_shadow :: Lens' ThingDocument (Maybe Text)
thingDocument_shadow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe Text
shadow :: Maybe Text
$sel:shadow:ThingDocument' :: ThingDocument -> Maybe Text
shadow} -> Maybe Text
shadow) (\s :: ThingDocument
s@ThingDocument' {} Maybe Text
a -> ThingDocument
s {$sel:shadow:ThingDocument' :: Maybe Text
shadow = Maybe Text
a} :: ThingDocument)
thingDocument_thingGroupNames :: Lens.Lens' ThingDocument (Prelude.Maybe [Prelude.Text])
thingDocument_thingGroupNames :: Lens' ThingDocument (Maybe [Text])
thingDocument_thingGroupNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe [Text]
thingGroupNames :: Maybe [Text]
$sel:thingGroupNames:ThingDocument' :: ThingDocument -> Maybe [Text]
thingGroupNames} -> Maybe [Text]
thingGroupNames) (\s :: ThingDocument
s@ThingDocument' {} Maybe [Text]
a -> ThingDocument
s {$sel:thingGroupNames:ThingDocument' :: Maybe [Text]
thingGroupNames = Maybe [Text]
a} :: ThingDocument) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
thingDocument_thingId :: Lens.Lens' ThingDocument (Prelude.Maybe Prelude.Text)
thingDocument_thingId :: Lens' ThingDocument (Maybe Text)
thingDocument_thingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe Text
thingId :: Maybe Text
$sel:thingId:ThingDocument' :: ThingDocument -> Maybe Text
thingId} -> Maybe Text
thingId) (\s :: ThingDocument
s@ThingDocument' {} Maybe Text
a -> ThingDocument
s {$sel:thingId:ThingDocument' :: Maybe Text
thingId = Maybe Text
a} :: ThingDocument)
thingDocument_thingName :: Lens.Lens' ThingDocument (Prelude.Maybe Prelude.Text)
thingDocument_thingName :: Lens' ThingDocument (Maybe Text)
thingDocument_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe Text
thingName :: Maybe Text
$sel:thingName:ThingDocument' :: ThingDocument -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: ThingDocument
s@ThingDocument' {} Maybe Text
a -> ThingDocument
s {$sel:thingName:ThingDocument' :: Maybe Text
thingName = Maybe Text
a} :: ThingDocument)
thingDocument_thingTypeName :: Lens.Lens' ThingDocument (Prelude.Maybe Prelude.Text)
thingDocument_thingTypeName :: Lens' ThingDocument (Maybe Text)
thingDocument_thingTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingDocument' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:ThingDocument' :: ThingDocument -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: ThingDocument
s@ThingDocument' {} Maybe Text
a -> ThingDocument
s {$sel:thingTypeName:ThingDocument' :: Maybe Text
thingTypeName = Maybe Text
a} :: ThingDocument)
instance Data.FromJSON ThingDocument where
parseJSON :: Value -> Parser ThingDocument
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ThingDocument"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe ThingConnectivity
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ThingDocument
ThingDocument'
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
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"connectivity")
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
"deviceDefender")
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
"shadow")
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
"thingGroupNames"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
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
"thingId")
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
"thingName")
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
"thingTypeName")
)
instance Prelude.Hashable ThingDocument where
hashWithSalt :: Int -> ThingDocument -> Int
hashWithSalt Int
_salt ThingDocument' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe ThingConnectivity
thingTypeName :: Maybe Text
thingName :: Maybe Text
thingId :: Maybe Text
thingGroupNames :: Maybe [Text]
shadow :: Maybe Text
deviceDefender :: Maybe Text
connectivity :: Maybe ThingConnectivity
attributes :: Maybe (HashMap Text Text)
$sel:thingTypeName:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingName:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingId:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingGroupNames:ThingDocument' :: ThingDocument -> Maybe [Text]
$sel:shadow:ThingDocument' :: ThingDocument -> Maybe Text
$sel:deviceDefender:ThingDocument' :: ThingDocument -> Maybe Text
$sel:connectivity:ThingDocument' :: ThingDocument -> Maybe ThingConnectivity
$sel:attributes:ThingDocument' :: ThingDocument -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThingConnectivity
connectivity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceDefender
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
shadow
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
thingGroupNames
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingTypeName
instance Prelude.NFData ThingDocument where
rnf :: ThingDocument -> ()
rnf ThingDocument' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe ThingConnectivity
thingTypeName :: Maybe Text
thingName :: Maybe Text
thingId :: Maybe Text
thingGroupNames :: Maybe [Text]
shadow :: Maybe Text
deviceDefender :: Maybe Text
connectivity :: Maybe ThingConnectivity
attributes :: Maybe (HashMap Text Text)
$sel:thingTypeName:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingName:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingId:ThingDocument' :: ThingDocument -> Maybe Text
$sel:thingGroupNames:ThingDocument' :: ThingDocument -> Maybe [Text]
$sel:shadow:ThingDocument' :: ThingDocument -> Maybe Text
$sel:deviceDefender:ThingDocument' :: ThingDocument -> Maybe Text
$sel:connectivity:ThingDocument' :: ThingDocument -> Maybe ThingConnectivity
$sel:attributes:ThingDocument' :: ThingDocument -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThingConnectivity
connectivity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceDefender
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
shadow
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
thingGroupNames
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingTypeName