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