{-# 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.Forecast.Types.SchemaAttribute where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Forecast.Types.AttributeType
import qualified Amazonka.Prelude as Prelude
data SchemaAttribute = SchemaAttribute'
{
SchemaAttribute -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
SchemaAttribute -> Maybe AttributeType
attributeType :: Prelude.Maybe AttributeType
}
deriving (SchemaAttribute -> SchemaAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaAttribute -> SchemaAttribute -> Bool
$c/= :: SchemaAttribute -> SchemaAttribute -> Bool
== :: SchemaAttribute -> SchemaAttribute -> Bool
$c== :: SchemaAttribute -> SchemaAttribute -> Bool
Prelude.Eq, ReadPrec [SchemaAttribute]
ReadPrec SchemaAttribute
Int -> ReadS SchemaAttribute
ReadS [SchemaAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaAttribute]
$creadListPrec :: ReadPrec [SchemaAttribute]
readPrec :: ReadPrec SchemaAttribute
$creadPrec :: ReadPrec SchemaAttribute
readList :: ReadS [SchemaAttribute]
$creadList :: ReadS [SchemaAttribute]
readsPrec :: Int -> ReadS SchemaAttribute
$creadsPrec :: Int -> ReadS SchemaAttribute
Prelude.Read, Int -> SchemaAttribute -> ShowS
[SchemaAttribute] -> ShowS
SchemaAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaAttribute] -> ShowS
$cshowList :: [SchemaAttribute] -> ShowS
show :: SchemaAttribute -> String
$cshow :: SchemaAttribute -> String
showsPrec :: Int -> SchemaAttribute -> ShowS
$cshowsPrec :: Int -> SchemaAttribute -> ShowS
Prelude.Show, forall x. Rep SchemaAttribute x -> SchemaAttribute
forall x. SchemaAttribute -> Rep SchemaAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaAttribute x -> SchemaAttribute
$cfrom :: forall x. SchemaAttribute -> Rep SchemaAttribute x
Prelude.Generic)
newSchemaAttribute ::
SchemaAttribute
newSchemaAttribute :: SchemaAttribute
newSchemaAttribute =
SchemaAttribute'
{ $sel:attributeName:SchemaAttribute' :: Maybe Text
attributeName = forall a. Maybe a
Prelude.Nothing,
$sel:attributeType:SchemaAttribute' :: Maybe AttributeType
attributeType = forall a. Maybe a
Prelude.Nothing
}
schemaAttribute_attributeName :: Lens.Lens' SchemaAttribute (Prelude.Maybe Prelude.Text)
schemaAttribute_attributeName :: Lens' SchemaAttribute (Maybe Text)
schemaAttribute_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttribute' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:SchemaAttribute' :: SchemaAttribute -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: SchemaAttribute
s@SchemaAttribute' {} Maybe Text
a -> SchemaAttribute
s {$sel:attributeName:SchemaAttribute' :: Maybe Text
attributeName = Maybe Text
a} :: SchemaAttribute)
schemaAttribute_attributeType :: Lens.Lens' SchemaAttribute (Prelude.Maybe AttributeType)
schemaAttribute_attributeType :: Lens' SchemaAttribute (Maybe AttributeType)
schemaAttribute_attributeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaAttribute' {Maybe AttributeType
attributeType :: Maybe AttributeType
$sel:attributeType:SchemaAttribute' :: SchemaAttribute -> Maybe AttributeType
attributeType} -> Maybe AttributeType
attributeType) (\s :: SchemaAttribute
s@SchemaAttribute' {} Maybe AttributeType
a -> SchemaAttribute
s {$sel:attributeType:SchemaAttribute' :: Maybe AttributeType
attributeType = Maybe AttributeType
a} :: SchemaAttribute)
instance Data.FromJSON SchemaAttribute where
parseJSON :: Value -> Parser SchemaAttribute
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SchemaAttribute"
( \Object
x ->
Maybe Text -> Maybe AttributeType -> SchemaAttribute
SchemaAttribute'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AttributeName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AttributeType")
)
instance Prelude.Hashable SchemaAttribute where
hashWithSalt :: Int -> SchemaAttribute -> Int
hashWithSalt Int
_salt SchemaAttribute' {Maybe Text
Maybe AttributeType
attributeType :: Maybe AttributeType
attributeName :: Maybe Text
$sel:attributeType:SchemaAttribute' :: SchemaAttribute -> Maybe AttributeType
$sel:attributeName:SchemaAttribute' :: SchemaAttribute -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AttributeType
attributeType
instance Prelude.NFData SchemaAttribute where
rnf :: SchemaAttribute -> ()
rnf SchemaAttribute' {Maybe Text
Maybe AttributeType
attributeType :: Maybe AttributeType
attributeName :: Maybe Text
$sel:attributeType:SchemaAttribute' :: SchemaAttribute -> Maybe AttributeType
$sel:attributeName:SchemaAttribute' :: SchemaAttribute -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AttributeType
attributeType
instance Data.ToJSON SchemaAttribute where
toJSON :: SchemaAttribute -> Value
toJSON SchemaAttribute' {Maybe Text
Maybe AttributeType
attributeType :: Maybe AttributeType
attributeName :: Maybe Text
$sel:attributeType:SchemaAttribute' :: SchemaAttribute -> Maybe AttributeType
$sel:attributeName:SchemaAttribute' :: SchemaAttribute -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
attributeName,
(Key
"AttributeType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AttributeType
attributeType
]
)