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