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