{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FeatureValue = FeatureValue'
{
FeatureValue -> Text
featureName :: Prelude.Text,
FeatureValue -> Text
valueAsString :: Prelude.Text
}
deriving (FeatureValue -> FeatureValue -> Bool
(FeatureValue -> FeatureValue -> Bool)
-> (FeatureValue -> FeatureValue -> Bool) -> Eq FeatureValue
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]
(Int -> ReadS FeatureValue)
-> ReadS [FeatureValue]
-> ReadPrec FeatureValue
-> ReadPrec [FeatureValue]
-> Read 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
(Int -> FeatureValue -> ShowS)
-> (FeatureValue -> String)
-> ([FeatureValue] -> ShowS)
-> Show FeatureValue
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. FeatureValue -> Rep FeatureValue x)
-> (forall x. Rep FeatureValue x -> FeatureValue)
-> Generic FeatureValue
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' :: Text -> Text -> FeatureValue
FeatureValue'
{ $sel:featureName:FeatureValue' :: Text
featureName = Text
pFeatureName_,
$sel:valueAsString:FeatureValue' :: Text
valueAsString = Text
pValueAsString_
}
featureValue_featureName :: Lens.Lens' FeatureValue Prelude.Text
featureValue_featureName :: (Text -> f Text) -> FeatureValue -> f FeatureValue
featureValue_featureName = (FeatureValue -> Text)
-> (FeatureValue -> Text -> FeatureValue)
-> Lens FeatureValue FeatureValue Text Text
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 :: (Text -> f Text) -> FeatureValue -> f FeatureValue
featureValue_valueAsString = (FeatureValue -> Text)
-> (FeatureValue -> Text -> FeatureValue)
-> Lens FeatureValue FeatureValue Text Text
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 Core.FromJSON FeatureValue where
parseJSON :: Value -> Parser FeatureValue
parseJSON =
String
-> (Object -> Parser FeatureValue) -> Value -> Parser FeatureValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FeatureValue"
( \Object
x ->
Text -> Text -> FeatureValue
FeatureValue'
(Text -> Text -> FeatureValue)
-> Parser Text -> Parser (Text -> FeatureValue)
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
"FeatureName")
Parser (Text -> FeatureValue) -> Parser Text -> Parser FeatureValue
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
"ValueAsString")
)
instance Prelude.Hashable FeatureValue
instance Prelude.NFData FeatureValue
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FeatureName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
featureName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ValueAsString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
valueAsString)
]
)