{-# 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.Featurization where
import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.FeaturizationMethod
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Featurization = Featurization'
{
Featurization -> Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline :: Prelude.Maybe (Prelude.NonEmpty FeaturizationMethod),
Featurization -> Text
attributeName :: Prelude.Text
}
deriving (Featurization -> Featurization -> Bool
(Featurization -> Featurization -> Bool)
-> (Featurization -> Featurization -> Bool) -> Eq Featurization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Featurization -> Featurization -> Bool
$c/= :: Featurization -> Featurization -> Bool
== :: Featurization -> Featurization -> Bool
$c== :: Featurization -> Featurization -> Bool
Prelude.Eq, ReadPrec [Featurization]
ReadPrec Featurization
Int -> ReadS Featurization
ReadS [Featurization]
(Int -> ReadS Featurization)
-> ReadS [Featurization]
-> ReadPrec Featurization
-> ReadPrec [Featurization]
-> Read Featurization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Featurization]
$creadListPrec :: ReadPrec [Featurization]
readPrec :: ReadPrec Featurization
$creadPrec :: ReadPrec Featurization
readList :: ReadS [Featurization]
$creadList :: ReadS [Featurization]
readsPrec :: Int -> ReadS Featurization
$creadsPrec :: Int -> ReadS Featurization
Prelude.Read, Int -> Featurization -> ShowS
[Featurization] -> ShowS
Featurization -> String
(Int -> Featurization -> ShowS)
-> (Featurization -> String)
-> ([Featurization] -> ShowS)
-> Show Featurization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Featurization] -> ShowS
$cshowList :: [Featurization] -> ShowS
show :: Featurization -> String
$cshow :: Featurization -> String
showsPrec :: Int -> Featurization -> ShowS
$cshowsPrec :: Int -> Featurization -> ShowS
Prelude.Show, (forall x. Featurization -> Rep Featurization x)
-> (forall x. Rep Featurization x -> Featurization)
-> Generic Featurization
forall x. Rep Featurization x -> Featurization
forall x. Featurization -> Rep Featurization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Featurization x -> Featurization
$cfrom :: forall x. Featurization -> Rep Featurization x
Prelude.Generic)
newFeaturization ::
Prelude.Text ->
Featurization
newFeaturization :: Text -> Featurization
newFeaturization Text
pAttributeName_ =
Featurization' :: Maybe (NonEmpty FeaturizationMethod) -> Text -> Featurization
Featurization'
{ $sel:featurizationPipeline:Featurization' :: Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline =
Maybe (NonEmpty FeaturizationMethod)
forall a. Maybe a
Prelude.Nothing,
$sel:attributeName:Featurization' :: Text
attributeName = Text
pAttributeName_
}
featurization_featurizationPipeline :: Lens.Lens' Featurization (Prelude.Maybe (Prelude.NonEmpty FeaturizationMethod))
featurization_featurizationPipeline :: (Maybe (NonEmpty FeaturizationMethod)
-> f (Maybe (NonEmpty FeaturizationMethod)))
-> Featurization -> f Featurization
featurization_featurizationPipeline = (Featurization -> Maybe (NonEmpty FeaturizationMethod))
-> (Featurization
-> Maybe (NonEmpty FeaturizationMethod) -> Featurization)
-> Lens
Featurization
Featurization
(Maybe (NonEmpty FeaturizationMethod))
(Maybe (NonEmpty FeaturizationMethod))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Featurization' {Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline :: Maybe (NonEmpty FeaturizationMethod)
$sel:featurizationPipeline:Featurization' :: Featurization -> Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline} -> Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline) (\s :: Featurization
s@Featurization' {} Maybe (NonEmpty FeaturizationMethod)
a -> Featurization
s {$sel:featurizationPipeline:Featurization' :: Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline = Maybe (NonEmpty FeaturizationMethod)
a} :: Featurization) ((Maybe (NonEmpty FeaturizationMethod)
-> f (Maybe (NonEmpty FeaturizationMethod)))
-> Featurization -> f Featurization)
-> ((Maybe (NonEmpty FeaturizationMethod)
-> f (Maybe (NonEmpty FeaturizationMethod)))
-> Maybe (NonEmpty FeaturizationMethod)
-> f (Maybe (NonEmpty FeaturizationMethod)))
-> (Maybe (NonEmpty FeaturizationMethod)
-> f (Maybe (NonEmpty FeaturizationMethod)))
-> Featurization
-> f Featurization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
-> Iso
(Maybe (NonEmpty FeaturizationMethod))
(Maybe (NonEmpty FeaturizationMethod))
(Maybe (NonEmpty FeaturizationMethod))
(Maybe (NonEmpty FeaturizationMethod))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
(NonEmpty FeaturizationMethod)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
featurization_attributeName :: Lens.Lens' Featurization Prelude.Text
featurization_attributeName :: (Text -> f Text) -> Featurization -> f Featurization
featurization_attributeName = (Featurization -> Text)
-> (Featurization -> Text -> Featurization)
-> Lens Featurization Featurization Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Featurization' {Text
attributeName :: Text
$sel:attributeName:Featurization' :: Featurization -> Text
attributeName} -> Text
attributeName) (\s :: Featurization
s@Featurization' {} Text
a -> Featurization
s {$sel:attributeName:Featurization' :: Text
attributeName = Text
a} :: Featurization)
instance Core.FromJSON Featurization where
parseJSON :: Value -> Parser Featurization
parseJSON =
String
-> (Object -> Parser Featurization)
-> Value
-> Parser Featurization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Featurization"
( \Object
x ->
Maybe (NonEmpty FeaturizationMethod) -> Text -> Featurization
Featurization'
(Maybe (NonEmpty FeaturizationMethod) -> Text -> Featurization)
-> Parser (Maybe (NonEmpty FeaturizationMethod))
-> Parser (Text -> Featurization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty FeaturizationMethod))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FeaturizationPipeline")
Parser (Text -> Featurization)
-> Parser Text -> Parser Featurization
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
"AttributeName")
)
instance Prelude.Hashable Featurization
instance Prelude.NFData Featurization
instance Core.ToJSON Featurization where
toJSON :: Featurization -> Value
toJSON Featurization' {Maybe (NonEmpty FeaturizationMethod)
Text
attributeName :: Text
featurizationPipeline :: Maybe (NonEmpty FeaturizationMethod)
$sel:attributeName:Featurization' :: Featurization -> Text
$sel:featurizationPipeline:Featurization' :: Featurization -> Maybe (NonEmpty FeaturizationMethod)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FeaturizationPipeline" Text -> NonEmpty FeaturizationMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty FeaturizationMethod -> Pair)
-> Maybe (NonEmpty FeaturizationMethod) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty FeaturizationMethod)
featurizationPipeline,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AttributeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
attributeName)
]
)