{-# 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.CloudDirectory.Types.FacetAttributeReference where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FacetAttributeReference = FacetAttributeReference'
{
FacetAttributeReference -> Text
targetFacetName :: Prelude.Text,
FacetAttributeReference -> Text
targetAttributeName :: Prelude.Text
}
deriving (FacetAttributeReference -> FacetAttributeReference -> Bool
(FacetAttributeReference -> FacetAttributeReference -> Bool)
-> (FacetAttributeReference -> FacetAttributeReference -> Bool)
-> Eq FacetAttributeReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FacetAttributeReference -> FacetAttributeReference -> Bool
$c/= :: FacetAttributeReference -> FacetAttributeReference -> Bool
== :: FacetAttributeReference -> FacetAttributeReference -> Bool
$c== :: FacetAttributeReference -> FacetAttributeReference -> Bool
Prelude.Eq, ReadPrec [FacetAttributeReference]
ReadPrec FacetAttributeReference
Int -> ReadS FacetAttributeReference
ReadS [FacetAttributeReference]
(Int -> ReadS FacetAttributeReference)
-> ReadS [FacetAttributeReference]
-> ReadPrec FacetAttributeReference
-> ReadPrec [FacetAttributeReference]
-> Read FacetAttributeReference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FacetAttributeReference]
$creadListPrec :: ReadPrec [FacetAttributeReference]
readPrec :: ReadPrec FacetAttributeReference
$creadPrec :: ReadPrec FacetAttributeReference
readList :: ReadS [FacetAttributeReference]
$creadList :: ReadS [FacetAttributeReference]
readsPrec :: Int -> ReadS FacetAttributeReference
$creadsPrec :: Int -> ReadS FacetAttributeReference
Prelude.Read, Int -> FacetAttributeReference -> ShowS
[FacetAttributeReference] -> ShowS
FacetAttributeReference -> String
(Int -> FacetAttributeReference -> ShowS)
-> (FacetAttributeReference -> String)
-> ([FacetAttributeReference] -> ShowS)
-> Show FacetAttributeReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FacetAttributeReference] -> ShowS
$cshowList :: [FacetAttributeReference] -> ShowS
show :: FacetAttributeReference -> String
$cshow :: FacetAttributeReference -> String
showsPrec :: Int -> FacetAttributeReference -> ShowS
$cshowsPrec :: Int -> FacetAttributeReference -> ShowS
Prelude.Show, (forall x.
FacetAttributeReference -> Rep FacetAttributeReference x)
-> (forall x.
Rep FacetAttributeReference x -> FacetAttributeReference)
-> Generic FacetAttributeReference
forall x. Rep FacetAttributeReference x -> FacetAttributeReference
forall x. FacetAttributeReference -> Rep FacetAttributeReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FacetAttributeReference x -> FacetAttributeReference
$cfrom :: forall x. FacetAttributeReference -> Rep FacetAttributeReference x
Prelude.Generic)
newFacetAttributeReference ::
Prelude.Text ->
Prelude.Text ->
FacetAttributeReference
newFacetAttributeReference :: Text -> Text -> FacetAttributeReference
newFacetAttributeReference
Text
pTargetFacetName_
Text
pTargetAttributeName_ =
FacetAttributeReference' :: Text -> Text -> FacetAttributeReference
FacetAttributeReference'
{ $sel:targetFacetName:FacetAttributeReference' :: Text
targetFacetName =
Text
pTargetFacetName_,
$sel:targetAttributeName:FacetAttributeReference' :: Text
targetAttributeName = Text
pTargetAttributeName_
}
facetAttributeReference_targetFacetName :: Lens.Lens' FacetAttributeReference Prelude.Text
facetAttributeReference_targetFacetName :: (Text -> f Text)
-> FacetAttributeReference -> f FacetAttributeReference
facetAttributeReference_targetFacetName = (FacetAttributeReference -> Text)
-> (FacetAttributeReference -> Text -> FacetAttributeReference)
-> Lens FacetAttributeReference FacetAttributeReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FacetAttributeReference' {Text
targetFacetName :: Text
$sel:targetFacetName:FacetAttributeReference' :: FacetAttributeReference -> Text
targetFacetName} -> Text
targetFacetName) (\s :: FacetAttributeReference
s@FacetAttributeReference' {} Text
a -> FacetAttributeReference
s {$sel:targetFacetName:FacetAttributeReference' :: Text
targetFacetName = Text
a} :: FacetAttributeReference)
facetAttributeReference_targetAttributeName :: Lens.Lens' FacetAttributeReference Prelude.Text
facetAttributeReference_targetAttributeName :: (Text -> f Text)
-> FacetAttributeReference -> f FacetAttributeReference
facetAttributeReference_targetAttributeName = (FacetAttributeReference -> Text)
-> (FacetAttributeReference -> Text -> FacetAttributeReference)
-> Lens FacetAttributeReference FacetAttributeReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FacetAttributeReference' {Text
targetAttributeName :: Text
$sel:targetAttributeName:FacetAttributeReference' :: FacetAttributeReference -> Text
targetAttributeName} -> Text
targetAttributeName) (\s :: FacetAttributeReference
s@FacetAttributeReference' {} Text
a -> FacetAttributeReference
s {$sel:targetAttributeName:FacetAttributeReference' :: Text
targetAttributeName = Text
a} :: FacetAttributeReference)
instance Core.FromJSON FacetAttributeReference where
parseJSON :: Value -> Parser FacetAttributeReference
parseJSON =
String
-> (Object -> Parser FacetAttributeReference)
-> Value
-> Parser FacetAttributeReference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FacetAttributeReference"
( \Object
x ->
Text -> Text -> FacetAttributeReference
FacetAttributeReference'
(Text -> Text -> FacetAttributeReference)
-> Parser Text -> Parser (Text -> FacetAttributeReference)
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
"TargetFacetName")
Parser (Text -> FacetAttributeReference)
-> Parser Text -> Parser FacetAttributeReference
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
"TargetAttributeName")
)
instance Prelude.Hashable FacetAttributeReference
instance Prelude.NFData FacetAttributeReference
instance Core.ToJSON FacetAttributeReference where
toJSON :: FacetAttributeReference -> Value
toJSON FacetAttributeReference' {Text
targetAttributeName :: Text
targetFacetName :: Text
$sel:targetAttributeName:FacetAttributeReference' :: FacetAttributeReference -> Text
$sel:targetFacetName:FacetAttributeReference' :: FacetAttributeReference -> 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
"TargetFacetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetFacetName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TargetAttributeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetAttributeName)
]
)