{-# 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.ThingTypeProperties where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ThingTypeProperties = ThingTypeProperties'
{
ThingTypeProperties -> Maybe [Text]
searchableAttributes :: Prelude.Maybe [Prelude.Text],
ThingTypeProperties -> Maybe Text
thingTypeDescription :: Prelude.Maybe Prelude.Text
}
deriving (ThingTypeProperties -> ThingTypeProperties -> Bool
(ThingTypeProperties -> ThingTypeProperties -> Bool)
-> (ThingTypeProperties -> ThingTypeProperties -> Bool)
-> Eq ThingTypeProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThingTypeProperties -> ThingTypeProperties -> Bool
$c/= :: ThingTypeProperties -> ThingTypeProperties -> Bool
== :: ThingTypeProperties -> ThingTypeProperties -> Bool
$c== :: ThingTypeProperties -> ThingTypeProperties -> Bool
Prelude.Eq, ReadPrec [ThingTypeProperties]
ReadPrec ThingTypeProperties
Int -> ReadS ThingTypeProperties
ReadS [ThingTypeProperties]
(Int -> ReadS ThingTypeProperties)
-> ReadS [ThingTypeProperties]
-> ReadPrec ThingTypeProperties
-> ReadPrec [ThingTypeProperties]
-> Read ThingTypeProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThingTypeProperties]
$creadListPrec :: ReadPrec [ThingTypeProperties]
readPrec :: ReadPrec ThingTypeProperties
$creadPrec :: ReadPrec ThingTypeProperties
readList :: ReadS [ThingTypeProperties]
$creadList :: ReadS [ThingTypeProperties]
readsPrec :: Int -> ReadS ThingTypeProperties
$creadsPrec :: Int -> ReadS ThingTypeProperties
Prelude.Read, Int -> ThingTypeProperties -> ShowS
[ThingTypeProperties] -> ShowS
ThingTypeProperties -> String
(Int -> ThingTypeProperties -> ShowS)
-> (ThingTypeProperties -> String)
-> ([ThingTypeProperties] -> ShowS)
-> Show ThingTypeProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThingTypeProperties] -> ShowS
$cshowList :: [ThingTypeProperties] -> ShowS
show :: ThingTypeProperties -> String
$cshow :: ThingTypeProperties -> String
showsPrec :: Int -> ThingTypeProperties -> ShowS
$cshowsPrec :: Int -> ThingTypeProperties -> ShowS
Prelude.Show, (forall x. ThingTypeProperties -> Rep ThingTypeProperties x)
-> (forall x. Rep ThingTypeProperties x -> ThingTypeProperties)
-> Generic ThingTypeProperties
forall x. Rep ThingTypeProperties x -> ThingTypeProperties
forall x. ThingTypeProperties -> Rep ThingTypeProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThingTypeProperties x -> ThingTypeProperties
$cfrom :: forall x. ThingTypeProperties -> Rep ThingTypeProperties x
Prelude.Generic)
newThingTypeProperties ::
ThingTypeProperties
newThingTypeProperties :: ThingTypeProperties
newThingTypeProperties =
ThingTypeProperties' :: Maybe [Text] -> Maybe Text -> ThingTypeProperties
ThingTypeProperties'
{ $sel:searchableAttributes:ThingTypeProperties' :: Maybe [Text]
searchableAttributes =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:thingTypeDescription:ThingTypeProperties' :: Maybe Text
thingTypeDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
thingTypeProperties_searchableAttributes :: Lens.Lens' ThingTypeProperties (Prelude.Maybe [Prelude.Text])
thingTypeProperties_searchableAttributes :: (Maybe [Text] -> f (Maybe [Text]))
-> ThingTypeProperties -> f ThingTypeProperties
thingTypeProperties_searchableAttributes = (ThingTypeProperties -> Maybe [Text])
-> (ThingTypeProperties -> Maybe [Text] -> ThingTypeProperties)
-> Lens
ThingTypeProperties
ThingTypeProperties
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeProperties' {Maybe [Text]
searchableAttributes :: Maybe [Text]
$sel:searchableAttributes:ThingTypeProperties' :: ThingTypeProperties -> Maybe [Text]
searchableAttributes} -> Maybe [Text]
searchableAttributes) (\s :: ThingTypeProperties
s@ThingTypeProperties' {} Maybe [Text]
a -> ThingTypeProperties
s {$sel:searchableAttributes:ThingTypeProperties' :: Maybe [Text]
searchableAttributes = Maybe [Text]
a} :: ThingTypeProperties) ((Maybe [Text] -> f (Maybe [Text]))
-> ThingTypeProperties -> f ThingTypeProperties)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ThingTypeProperties
-> f ThingTypeProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
thingTypeProperties_thingTypeDescription :: Lens.Lens' ThingTypeProperties (Prelude.Maybe Prelude.Text)
thingTypeProperties_thingTypeDescription :: (Maybe Text -> f (Maybe Text))
-> ThingTypeProperties -> f ThingTypeProperties
thingTypeProperties_thingTypeDescription = (ThingTypeProperties -> Maybe Text)
-> (ThingTypeProperties -> Maybe Text -> ThingTypeProperties)
-> Lens
ThingTypeProperties ThingTypeProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThingTypeProperties' {Maybe Text
thingTypeDescription :: Maybe Text
$sel:thingTypeDescription:ThingTypeProperties' :: ThingTypeProperties -> Maybe Text
thingTypeDescription} -> Maybe Text
thingTypeDescription) (\s :: ThingTypeProperties
s@ThingTypeProperties' {} Maybe Text
a -> ThingTypeProperties
s {$sel:thingTypeDescription:ThingTypeProperties' :: Maybe Text
thingTypeDescription = Maybe Text
a} :: ThingTypeProperties)
instance Core.FromJSON ThingTypeProperties where
parseJSON :: Value -> Parser ThingTypeProperties
parseJSON =
String
-> (Object -> Parser ThingTypeProperties)
-> Value
-> Parser ThingTypeProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ThingTypeProperties"
( \Object
x ->
Maybe [Text] -> Maybe Text -> ThingTypeProperties
ThingTypeProperties'
(Maybe [Text] -> Maybe Text -> ThingTypeProperties)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> ThingTypeProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"searchableAttributes"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> ThingTypeProperties)
-> Parser (Maybe Text) -> Parser ThingTypeProperties
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
"thingTypeDescription")
)
instance Prelude.Hashable ThingTypeProperties
instance Prelude.NFData ThingTypeProperties
instance Core.ToJSON ThingTypeProperties where
toJSON :: ThingTypeProperties -> Value
toJSON ThingTypeProperties' {Maybe [Text]
Maybe Text
thingTypeDescription :: Maybe Text
searchableAttributes :: Maybe [Text]
$sel:thingTypeDescription:ThingTypeProperties' :: ThingTypeProperties -> Maybe Text
$sel:searchableAttributes:ThingTypeProperties' :: ThingTypeProperties -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"searchableAttributes" 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]
searchableAttributes,
(Text
"thingTypeDescription" 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
thingTypeDescription
]
)