{-# 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.ThingAttribute where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ThingAttribute = ThingAttribute'
{
ThingAttribute -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
ThingAttribute -> Maybe Text
thingArn :: Prelude.Maybe Prelude.Text,
ThingAttribute -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ThingAttribute -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
ThingAttribute -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
}
deriving (ThingAttribute -> ThingAttribute -> Bool
(ThingAttribute -> ThingAttribute -> Bool)
-> (ThingAttribute -> ThingAttribute -> Bool) -> Eq ThingAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingAttribute -> ThingAttribute -> Bool
$c/= :: ThingAttribute -> ThingAttribute -> Bool
== :: ThingAttribute -> ThingAttribute -> Bool
$c== :: ThingAttribute -> ThingAttribute -> Bool
Prelude.Eq, ReadPrec [ThingAttribute]
ReadPrec ThingAttribute
Int -> ReadS ThingAttribute
ReadS [ThingAttribute]
(Int -> ReadS ThingAttribute)
-> ReadS [ThingAttribute]
-> ReadPrec ThingAttribute
-> ReadPrec [ThingAttribute]
-> Read ThingAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingAttribute]
$creadListPrec :: ReadPrec [ThingAttribute]
readPrec :: ReadPrec ThingAttribute
$creadPrec :: ReadPrec ThingAttribute
readList :: ReadS [ThingAttribute]
$creadList :: ReadS [ThingAttribute]
readsPrec :: Int -> ReadS ThingAttribute
$creadsPrec :: Int -> ReadS ThingAttribute
Prelude.Read, Int -> ThingAttribute -> ShowS
[ThingAttribute] -> ShowS
ThingAttribute -> String
(Int -> ThingAttribute -> ShowS)
-> (ThingAttribute -> String)
-> ([ThingAttribute] -> ShowS)
-> Show ThingAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingAttribute] -> ShowS
$cshowList :: [ThingAttribute] -> ShowS
show :: ThingAttribute -> String
$cshow :: ThingAttribute -> String
showsPrec :: Int -> ThingAttribute -> ShowS
$cshowsPrec :: Int -> ThingAttribute -> ShowS
Prelude.Show, (forall x. ThingAttribute -> Rep ThingAttribute x)
-> (forall x. Rep ThingAttribute x -> ThingAttribute)
-> Generic ThingAttribute
forall x. Rep ThingAttribute x -> ThingAttribute
forall x. ThingAttribute -> Rep ThingAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingAttribute x -> ThingAttribute
$cfrom :: forall x. ThingAttribute -> Rep ThingAttribute x
Prelude.Generic)
newThingAttribute ::
ThingAttribute
newThingAttribute :: ThingAttribute
newThingAttribute =
ThingAttribute' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Maybe Text
-> ThingAttribute
ThingAttribute'
{ $sel:thingTypeName:ThingAttribute' :: Maybe Text
thingTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingArn:ThingAttribute' :: Maybe Text
thingArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:ThingAttribute' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:version:ThingAttribute' :: Maybe Integer
version = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:ThingAttribute' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
thingAttribute_thingTypeName :: Lens.Lens' ThingAttribute (Prelude.Maybe Prelude.Text)
thingAttribute_thingTypeName :: (Maybe Text -> f (Maybe Text))
-> ThingAttribute -> f ThingAttribute
thingAttribute_thingTypeName = (ThingAttribute -> Maybe Text)
-> (ThingAttribute -> Maybe Text -> ThingAttribute)
-> Lens ThingAttribute ThingAttribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingAttribute' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:ThingAttribute' :: ThingAttribute -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: ThingAttribute
s@ThingAttribute' {} Maybe Text
a -> ThingAttribute
s {$sel:thingTypeName:ThingAttribute' :: Maybe Text
thingTypeName = Maybe Text
a} :: ThingAttribute)
thingAttribute_thingArn :: Lens.Lens' ThingAttribute (Prelude.Maybe Prelude.Text)
thingAttribute_thingArn :: (Maybe Text -> f (Maybe Text))
-> ThingAttribute -> f ThingAttribute
thingAttribute_thingArn = (ThingAttribute -> Maybe Text)
-> (ThingAttribute -> Maybe Text -> ThingAttribute)
-> Lens ThingAttribute ThingAttribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingAttribute' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:ThingAttribute' :: ThingAttribute -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: ThingAttribute
s@ThingAttribute' {} Maybe Text
a -> ThingAttribute
s {$sel:thingArn:ThingAttribute' :: Maybe Text
thingArn = Maybe Text
a} :: ThingAttribute)
thingAttribute_attributes :: Lens.Lens' ThingAttribute (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
thingAttribute_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ThingAttribute -> f ThingAttribute
thingAttribute_attributes = (ThingAttribute -> Maybe (HashMap Text Text))
-> (ThingAttribute -> Maybe (HashMap Text Text) -> ThingAttribute)
-> Lens
ThingAttribute
ThingAttribute
(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 (\ThingAttribute' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:ThingAttribute' :: ThingAttribute -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: ThingAttribute
s@ThingAttribute' {} Maybe (HashMap Text Text)
a -> ThingAttribute
s {$sel:attributes:ThingAttribute' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: ThingAttribute) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ThingAttribute -> f ThingAttribute)
-> ((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)))
-> ThingAttribute
-> f ThingAttribute
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
thingAttribute_version :: Lens.Lens' ThingAttribute (Prelude.Maybe Prelude.Integer)
thingAttribute_version :: (Maybe Integer -> f (Maybe Integer))
-> ThingAttribute -> f ThingAttribute
thingAttribute_version = (ThingAttribute -> Maybe Integer)
-> (ThingAttribute -> Maybe Integer -> ThingAttribute)
-> Lens
ThingAttribute ThingAttribute (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingAttribute' {Maybe Integer
version :: Maybe Integer
$sel:version:ThingAttribute' :: ThingAttribute -> Maybe Integer
version} -> Maybe Integer
version) (\s :: ThingAttribute
s@ThingAttribute' {} Maybe Integer
a -> ThingAttribute
s {$sel:version:ThingAttribute' :: Maybe Integer
version = Maybe Integer
a} :: ThingAttribute)
thingAttribute_thingName :: Lens.Lens' ThingAttribute (Prelude.Maybe Prelude.Text)
thingAttribute_thingName :: (Maybe Text -> f (Maybe Text))
-> ThingAttribute -> f ThingAttribute
thingAttribute_thingName = (ThingAttribute -> Maybe Text)
-> (ThingAttribute -> Maybe Text -> ThingAttribute)
-> Lens ThingAttribute ThingAttribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingAttribute' {Maybe Text
thingName :: Maybe Text
$sel:thingName:ThingAttribute' :: ThingAttribute -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: ThingAttribute
s@ThingAttribute' {} Maybe Text
a -> ThingAttribute
s {$sel:thingName:ThingAttribute' :: Maybe Text
thingName = Maybe Text
a} :: ThingAttribute)
instance Core.FromJSON ThingAttribute where
parseJSON :: Value -> Parser ThingAttribute
parseJSON =
String
-> (Object -> Parser ThingAttribute)
-> Value
-> Parser ThingAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ThingAttribute"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Maybe Text
-> ThingAttribute
ThingAttribute'
(Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Maybe Text
-> ThingAttribute)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Maybe Text
-> ThingAttribute)
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
"thingTypeName")
Parser
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> Maybe Text
-> ThingAttribute)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe Integer -> Maybe Text -> ThingAttribute)
forall (f :: * -> *) a b. Applicative f => 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
"thingArn")
Parser
(Maybe (HashMap Text Text)
-> Maybe Integer -> Maybe Text -> ThingAttribute)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Integer -> Maybe Text -> ThingAttribute)
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
"attributes" 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)
Parser (Maybe Integer -> Maybe Text -> ThingAttribute)
-> Parser (Maybe Integer) -> Parser (Maybe Text -> ThingAttribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"version")
Parser (Maybe Text -> ThingAttribute)
-> Parser (Maybe Text) -> Parser ThingAttribute
forall (f :: * -> *) a b. Applicative f => 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
"thingName")
)
instance Prelude.Hashable ThingAttribute
instance Prelude.NFData ThingAttribute