{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data FacetAttributeReference = FacetAttributeReference'
{
FacetAttributeReference -> Text
targetFacetName :: Prelude.Text,
FacetAttributeReference -> Text
targetAttributeName :: Prelude.Text
}
deriving (FacetAttributeReference -> FacetAttributeReference -> Bool
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]
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
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. 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'
{ $sel:targetFacetName:FacetAttributeReference' :: Text
targetFacetName =
Text
pTargetFacetName_,
$sel:targetAttributeName:FacetAttributeReference' :: Text
targetAttributeName = Text
pTargetAttributeName_
}
facetAttributeReference_targetFacetName :: Lens.Lens' FacetAttributeReference Prelude.Text
facetAttributeReference_targetFacetName :: Lens' FacetAttributeReference Text
facetAttributeReference_targetFacetName = 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 :: Lens' FacetAttributeReference Text
facetAttributeReference_targetAttributeName = 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 Data.FromJSON FacetAttributeReference where
parseJSON :: Value -> Parser FacetAttributeReference
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FacetAttributeReference"
( \Object
x ->
Text -> Text -> FacetAttributeReference
FacetAttributeReference'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TargetFacetName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TargetAttributeName")
)
instance Prelude.Hashable FacetAttributeReference where
hashWithSalt :: Int -> FacetAttributeReference -> Int
hashWithSalt Int
_salt FacetAttributeReference' {Text
targetAttributeName :: Text
targetFacetName :: Text
$sel:targetAttributeName:FacetAttributeReference' :: FacetAttributeReference -> Text
$sel:targetFacetName:FacetAttributeReference' :: FacetAttributeReference -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetFacetName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetAttributeName
instance Prelude.NFData FacetAttributeReference where
rnf :: FacetAttributeReference -> ()
rnf FacetAttributeReference' {Text
targetAttributeName :: Text
targetFacetName :: Text
$sel:targetAttributeName:FacetAttributeReference' :: FacetAttributeReference -> Text
$sel:targetFacetName:FacetAttributeReference' :: FacetAttributeReference -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
targetFacetName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetAttributeName
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"TargetFacetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetFacetName),
forall a. a -> Maybe a
Prelude.Just
(Key
"TargetAttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetAttributeName)
]
)