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