{-# 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.ThingGroupProperties where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.AttributePayload
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ThingGroupProperties = ThingGroupProperties'
{
ThingGroupProperties -> Maybe AttributePayload
attributePayload :: Prelude.Maybe AttributePayload,
ThingGroupProperties -> Maybe Text
thingGroupDescription :: Prelude.Maybe Prelude.Text
}
deriving (ThingGroupProperties -> ThingGroupProperties -> Bool
(ThingGroupProperties -> ThingGroupProperties -> Bool)
-> (ThingGroupProperties -> ThingGroupProperties -> Bool)
-> Eq ThingGroupProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingGroupProperties -> ThingGroupProperties -> Bool
$c/= :: ThingGroupProperties -> ThingGroupProperties -> Bool
== :: ThingGroupProperties -> ThingGroupProperties -> Bool
$c== :: ThingGroupProperties -> ThingGroupProperties -> Bool
Prelude.Eq, ReadPrec [ThingGroupProperties]
ReadPrec ThingGroupProperties
Int -> ReadS ThingGroupProperties
ReadS [ThingGroupProperties]
(Int -> ReadS ThingGroupProperties)
-> ReadS [ThingGroupProperties]
-> ReadPrec ThingGroupProperties
-> ReadPrec [ThingGroupProperties]
-> Read ThingGroupProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingGroupProperties]
$creadListPrec :: ReadPrec [ThingGroupProperties]
readPrec :: ReadPrec ThingGroupProperties
$creadPrec :: ReadPrec ThingGroupProperties
readList :: ReadS [ThingGroupProperties]
$creadList :: ReadS [ThingGroupProperties]
readsPrec :: Int -> ReadS ThingGroupProperties
$creadsPrec :: Int -> ReadS ThingGroupProperties
Prelude.Read, Int -> ThingGroupProperties -> ShowS
[ThingGroupProperties] -> ShowS
ThingGroupProperties -> String
(Int -> ThingGroupProperties -> ShowS)
-> (ThingGroupProperties -> String)
-> ([ThingGroupProperties] -> ShowS)
-> Show ThingGroupProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingGroupProperties] -> ShowS
$cshowList :: [ThingGroupProperties] -> ShowS
show :: ThingGroupProperties -> String
$cshow :: ThingGroupProperties -> String
showsPrec :: Int -> ThingGroupProperties -> ShowS
$cshowsPrec :: Int -> ThingGroupProperties -> ShowS
Prelude.Show, (forall x. ThingGroupProperties -> Rep ThingGroupProperties x)
-> (forall x. Rep ThingGroupProperties x -> ThingGroupProperties)
-> Generic ThingGroupProperties
forall x. Rep ThingGroupProperties x -> ThingGroupProperties
forall x. ThingGroupProperties -> Rep ThingGroupProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingGroupProperties x -> ThingGroupProperties
$cfrom :: forall x. ThingGroupProperties -> Rep ThingGroupProperties x
Prelude.Generic)
newThingGroupProperties ::
ThingGroupProperties
newThingGroupProperties :: ThingGroupProperties
newThingGroupProperties =
ThingGroupProperties' :: Maybe AttributePayload -> Maybe Text -> ThingGroupProperties
ThingGroupProperties'
{ $sel:attributePayload:ThingGroupProperties' :: Maybe AttributePayload
attributePayload =
Maybe AttributePayload
forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupDescription:ThingGroupProperties' :: Maybe Text
thingGroupDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
thingGroupProperties_attributePayload :: Lens.Lens' ThingGroupProperties (Prelude.Maybe AttributePayload)
thingGroupProperties_attributePayload :: (Maybe AttributePayload -> f (Maybe AttributePayload))
-> ThingGroupProperties -> f ThingGroupProperties
thingGroupProperties_attributePayload = (ThingGroupProperties -> Maybe AttributePayload)
-> (ThingGroupProperties
-> Maybe AttributePayload -> ThingGroupProperties)
-> Lens
ThingGroupProperties
ThingGroupProperties
(Maybe AttributePayload)
(Maybe AttributePayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingGroupProperties' {Maybe AttributePayload
attributePayload :: Maybe AttributePayload
$sel:attributePayload:ThingGroupProperties' :: ThingGroupProperties -> Maybe AttributePayload
attributePayload} -> Maybe AttributePayload
attributePayload) (\s :: ThingGroupProperties
s@ThingGroupProperties' {} Maybe AttributePayload
a -> ThingGroupProperties
s {$sel:attributePayload:ThingGroupProperties' :: Maybe AttributePayload
attributePayload = Maybe AttributePayload
a} :: ThingGroupProperties)
thingGroupProperties_thingGroupDescription :: Lens.Lens' ThingGroupProperties (Prelude.Maybe Prelude.Text)
thingGroupProperties_thingGroupDescription :: (Maybe Text -> f (Maybe Text))
-> ThingGroupProperties -> f ThingGroupProperties
thingGroupProperties_thingGroupDescription = (ThingGroupProperties -> Maybe Text)
-> (ThingGroupProperties -> Maybe Text -> ThingGroupProperties)
-> Lens
ThingGroupProperties ThingGroupProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingGroupProperties' {Maybe Text
thingGroupDescription :: Maybe Text
$sel:thingGroupDescription:ThingGroupProperties' :: ThingGroupProperties -> Maybe Text
thingGroupDescription} -> Maybe Text
thingGroupDescription) (\s :: ThingGroupProperties
s@ThingGroupProperties' {} Maybe Text
a -> ThingGroupProperties
s {$sel:thingGroupDescription:ThingGroupProperties' :: Maybe Text
thingGroupDescription = Maybe Text
a} :: ThingGroupProperties)
instance Core.FromJSON ThingGroupProperties where
parseJSON :: Value -> Parser ThingGroupProperties
parseJSON =
String
-> (Object -> Parser ThingGroupProperties)
-> Value
-> Parser ThingGroupProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ThingGroupProperties"
( \Object
x ->
Maybe AttributePayload -> Maybe Text -> ThingGroupProperties
ThingGroupProperties'
(Maybe AttributePayload -> Maybe Text -> ThingGroupProperties)
-> Parser (Maybe AttributePayload)
-> Parser (Maybe Text -> ThingGroupProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AttributePayload)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributePayload")
Parser (Maybe Text -> ThingGroupProperties)
-> Parser (Maybe Text) -> Parser ThingGroupProperties
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
"thingGroupDescription")
)
instance Prelude.Hashable ThingGroupProperties
instance Prelude.NFData ThingGroupProperties
instance Core.ToJSON ThingGroupProperties where
toJSON :: ThingGroupProperties -> Value
toJSON ThingGroupProperties' {Maybe Text
Maybe AttributePayload
thingGroupDescription :: Maybe Text
attributePayload :: Maybe AttributePayload
$sel:thingGroupDescription:ThingGroupProperties' :: ThingGroupProperties -> Maybe Text
$sel:attributePayload:ThingGroupProperties' :: ThingGroupProperties -> Maybe AttributePayload
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"attributePayload" Text -> AttributePayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AttributePayload -> Pair) -> Maybe AttributePayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AttributePayload
attributePayload,
(Text
"thingGroupDescription" 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
thingGroupDescription
]
)