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