{-# 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.AttributeKey where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AttributeKey = AttributeKey'
{
AttributeKey -> Text
schemaArn :: Prelude.Text,
AttributeKey -> Text
facetName :: Prelude.Text,
AttributeKey -> Text
name :: Prelude.Text
}
deriving (AttributeKey -> AttributeKey -> Bool
(AttributeKey -> AttributeKey -> Bool)
-> (AttributeKey -> AttributeKey -> Bool) -> Eq AttributeKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeKey -> AttributeKey -> Bool
$c/= :: AttributeKey -> AttributeKey -> Bool
== :: AttributeKey -> AttributeKey -> Bool
$c== :: AttributeKey -> AttributeKey -> Bool
Prelude.Eq, ReadPrec [AttributeKey]
ReadPrec AttributeKey
Int -> ReadS AttributeKey
ReadS [AttributeKey]
(Int -> ReadS AttributeKey)
-> ReadS [AttributeKey]
-> ReadPrec AttributeKey
-> ReadPrec [AttributeKey]
-> Read AttributeKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeKey]
$creadListPrec :: ReadPrec [AttributeKey]
readPrec :: ReadPrec AttributeKey
$creadPrec :: ReadPrec AttributeKey
readList :: ReadS [AttributeKey]
$creadList :: ReadS [AttributeKey]
readsPrec :: Int -> ReadS AttributeKey
$creadsPrec :: Int -> ReadS AttributeKey
Prelude.Read, Int -> AttributeKey -> ShowS
[AttributeKey] -> ShowS
AttributeKey -> String
(Int -> AttributeKey -> ShowS)
-> (AttributeKey -> String)
-> ([AttributeKey] -> ShowS)
-> Show AttributeKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeKey] -> ShowS
$cshowList :: [AttributeKey] -> ShowS
show :: AttributeKey -> String
$cshow :: AttributeKey -> String
showsPrec :: Int -> AttributeKey -> ShowS
$cshowsPrec :: Int -> AttributeKey -> ShowS
Prelude.Show, (forall x. AttributeKey -> Rep AttributeKey x)
-> (forall x. Rep AttributeKey x -> AttributeKey)
-> Generic AttributeKey
forall x. Rep AttributeKey x -> AttributeKey
forall x. AttributeKey -> Rep AttributeKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeKey x -> AttributeKey
$cfrom :: forall x. AttributeKey -> Rep AttributeKey x
Prelude.Generic)
newAttributeKey ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AttributeKey
newAttributeKey :: Text -> Text -> Text -> AttributeKey
newAttributeKey Text
pSchemaArn_ Text
pFacetName_ Text
pName_ =
AttributeKey' :: Text -> Text -> Text -> AttributeKey
AttributeKey'
{ $sel:schemaArn:AttributeKey' :: Text
schemaArn = Text
pSchemaArn_,
$sel:facetName:AttributeKey' :: Text
facetName = Text
pFacetName_,
$sel:name:AttributeKey' :: Text
name = Text
pName_
}
attributeKey_schemaArn :: Lens.Lens' AttributeKey Prelude.Text
attributeKey_schemaArn :: (Text -> f Text) -> AttributeKey -> f AttributeKey
attributeKey_schemaArn = (AttributeKey -> Text)
-> (AttributeKey -> Text -> AttributeKey)
-> Lens AttributeKey AttributeKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeKey' {Text
schemaArn :: Text
$sel:schemaArn:AttributeKey' :: AttributeKey -> Text
schemaArn} -> Text
schemaArn) (\s :: AttributeKey
s@AttributeKey' {} Text
a -> AttributeKey
s {$sel:schemaArn:AttributeKey' :: Text
schemaArn = Text
a} :: AttributeKey)
attributeKey_facetName :: Lens.Lens' AttributeKey Prelude.Text
attributeKey_facetName :: (Text -> f Text) -> AttributeKey -> f AttributeKey
attributeKey_facetName = (AttributeKey -> Text)
-> (AttributeKey -> Text -> AttributeKey)
-> Lens AttributeKey AttributeKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeKey' {Text
facetName :: Text
$sel:facetName:AttributeKey' :: AttributeKey -> Text
facetName} -> Text
facetName) (\s :: AttributeKey
s@AttributeKey' {} Text
a -> AttributeKey
s {$sel:facetName:AttributeKey' :: Text
facetName = Text
a} :: AttributeKey)
attributeKey_name :: Lens.Lens' AttributeKey Prelude.Text
attributeKey_name :: (Text -> f Text) -> AttributeKey -> f AttributeKey
attributeKey_name = (AttributeKey -> Text)
-> (AttributeKey -> Text -> AttributeKey)
-> Lens AttributeKey AttributeKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeKey' {Text
name :: Text
$sel:name:AttributeKey' :: AttributeKey -> Text
name} -> Text
name) (\s :: AttributeKey
s@AttributeKey' {} Text
a -> AttributeKey
s {$sel:name:AttributeKey' :: Text
name = Text
a} :: AttributeKey)
instance Core.FromJSON AttributeKey where
parseJSON :: Value -> Parser AttributeKey
parseJSON =
String
-> (Object -> Parser AttributeKey) -> Value -> Parser AttributeKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AttributeKey"
( \Object
x ->
Text -> Text -> Text -> AttributeKey
AttributeKey'
(Text -> Text -> Text -> AttributeKey)
-> Parser Text -> Parser (Text -> Text -> AttributeKey)
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
"SchemaArn")
Parser (Text -> Text -> AttributeKey)
-> Parser Text -> Parser (Text -> AttributeKey)
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
"FacetName")
Parser (Text -> AttributeKey) -> Parser Text -> Parser AttributeKey
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
"Name")
)
instance Prelude.Hashable AttributeKey
instance Prelude.NFData AttributeKey
instance Core.ToJSON AttributeKey where
toJSON :: AttributeKey -> Value
toJSON AttributeKey' {Text
name :: Text
facetName :: Text
schemaArn :: Text
$sel:name:AttributeKey' :: AttributeKey -> Text
$sel:facetName:AttributeKey' :: AttributeKey -> Text
$sel:schemaArn:AttributeKey' :: AttributeKey -> 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
"SchemaArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
schemaArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FacetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
facetName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)