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