{-# 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.SageMakerFeatureStoreRuntime.Types.FeatureValue 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 FeatureValue = FeatureValue'
{
FeatureValue -> Text
featureName :: Prelude.Text,
FeatureValue -> Text
valueAsString :: Prelude.Text
}
deriving (FeatureValue -> FeatureValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FeatureValue -> FeatureValue -> Bool
$c/= :: FeatureValue -> FeatureValue -> Bool
== :: FeatureValue -> FeatureValue -> Bool
$c== :: FeatureValue -> FeatureValue -> Bool
Prelude.Eq, ReadPrec [FeatureValue]
ReadPrec FeatureValue
Int -> ReadS FeatureValue
ReadS [FeatureValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FeatureValue]
$creadListPrec :: ReadPrec [FeatureValue]
readPrec :: ReadPrec FeatureValue
$creadPrec :: ReadPrec FeatureValue
readList :: ReadS [FeatureValue]
$creadList :: ReadS [FeatureValue]
readsPrec :: Int -> ReadS FeatureValue
$creadsPrec :: Int -> ReadS FeatureValue
Prelude.Read, Int -> FeatureValue -> ShowS
[FeatureValue] -> ShowS
FeatureValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FeatureValue] -> ShowS
$cshowList :: [FeatureValue] -> ShowS
show :: FeatureValue -> String
$cshow :: FeatureValue -> String
showsPrec :: Int -> FeatureValue -> ShowS
$cshowsPrec :: Int -> FeatureValue -> ShowS
Prelude.Show, forall x. Rep FeatureValue x -> FeatureValue
forall x. FeatureValue -> Rep FeatureValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FeatureValue x -> FeatureValue
$cfrom :: forall x. FeatureValue -> Rep FeatureValue x
Prelude.Generic)
newFeatureValue ::
Prelude.Text ->
Prelude.Text ->
FeatureValue
newFeatureValue :: Text -> Text -> FeatureValue
newFeatureValue Text
pFeatureName_ Text
pValueAsString_ =
FeatureValue'
{ $sel:featureName:FeatureValue' :: Text
featureName = Text
pFeatureName_,
$sel:valueAsString:FeatureValue' :: Text
valueAsString = Text
pValueAsString_
}
featureValue_featureName :: Lens.Lens' FeatureValue Prelude.Text
featureValue_featureName :: Lens' FeatureValue Text
featureValue_featureName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeatureValue' {Text
featureName :: Text
$sel:featureName:FeatureValue' :: FeatureValue -> Text
featureName} -> Text
featureName) (\s :: FeatureValue
s@FeatureValue' {} Text
a -> FeatureValue
s {$sel:featureName:FeatureValue' :: Text
featureName = Text
a} :: FeatureValue)
featureValue_valueAsString :: Lens.Lens' FeatureValue Prelude.Text
featureValue_valueAsString :: Lens' FeatureValue Text
featureValue_valueAsString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FeatureValue' {Text
valueAsString :: Text
$sel:valueAsString:FeatureValue' :: FeatureValue -> Text
valueAsString} -> Text
valueAsString) (\s :: FeatureValue
s@FeatureValue' {} Text
a -> FeatureValue
s {$sel:valueAsString:FeatureValue' :: Text
valueAsString = Text
a} :: FeatureValue)
instance Data.FromJSON FeatureValue where
parseJSON :: Value -> Parser FeatureValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FeatureValue"
( \Object
x ->
Text -> Text -> FeatureValue
FeatureValue'
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
"FeatureName")
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
"ValueAsString")
)
instance Prelude.Hashable FeatureValue where
hashWithSalt :: Int -> FeatureValue -> Int
hashWithSalt Int
_salt FeatureValue' {Text
valueAsString :: Text
featureName :: Text
$sel:valueAsString:FeatureValue' :: FeatureValue -> Text
$sel:featureName:FeatureValue' :: FeatureValue -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
featureName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
valueAsString
instance Prelude.NFData FeatureValue where
rnf :: FeatureValue -> ()
rnf FeatureValue' {Text
valueAsString :: Text
featureName :: Text
$sel:valueAsString:FeatureValue' :: FeatureValue -> Text
$sel:featureName:FeatureValue' :: FeatureValue -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
featureName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
valueAsString
instance Data.ToJSON FeatureValue where
toJSON :: FeatureValue -> Value
toJSON FeatureValue' {Text
valueAsString :: Text
featureName :: Text
$sel:valueAsString:FeatureValue' :: FeatureValue -> Text
$sel:featureName:FeatureValue' :: FeatureValue -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"FeatureName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
featureName),
forall a. a -> Maybe a
Prelude.Just
(Key
"ValueAsString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
valueAsString)
]
)