{-# 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.SageMaker.Types.Channel where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.CompressionType
import Amazonka.SageMaker.Types.DataSource
import Amazonka.SageMaker.Types.RecordWrapper
import Amazonka.SageMaker.Types.ShuffleConfig
import Amazonka.SageMaker.Types.TrainingInputMode
data Channel = Channel'
{
Channel -> Maybe ShuffleConfig
shuffleConfig :: Prelude.Maybe ShuffleConfig,
Channel -> Maybe RecordWrapper
recordWrapperType :: Prelude.Maybe RecordWrapper,
Channel -> Maybe TrainingInputMode
inputMode :: Prelude.Maybe TrainingInputMode,
Channel -> Maybe CompressionType
compressionType :: Prelude.Maybe CompressionType,
Channel -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
Channel -> Text
channelName :: Prelude.Text,
Channel -> DataSource
dataSource :: DataSource
}
deriving (Channel -> Channel -> Bool
(Channel -> Channel -> Bool)
-> (Channel -> Channel -> Bool) -> Eq Channel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Channel -> Channel -> Bool
$c/= :: Channel -> Channel -> Bool
== :: Channel -> Channel -> Bool
$c== :: Channel -> Channel -> Bool
Prelude.Eq, ReadPrec [Channel]
ReadPrec Channel
Int -> ReadS Channel
ReadS [Channel]
(Int -> ReadS Channel)
-> ReadS [Channel]
-> ReadPrec Channel
-> ReadPrec [Channel]
-> Read Channel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Channel]
$creadListPrec :: ReadPrec [Channel]
readPrec :: ReadPrec Channel
$creadPrec :: ReadPrec Channel
readList :: ReadS [Channel]
$creadList :: ReadS [Channel]
readsPrec :: Int -> ReadS Channel
$creadsPrec :: Int -> ReadS Channel
Prelude.Read, Int -> Channel -> ShowS
[Channel] -> ShowS
Channel -> String
(Int -> Channel -> ShowS)
-> (Channel -> String) -> ([Channel] -> ShowS) -> Show Channel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Channel] -> ShowS
$cshowList :: [Channel] -> ShowS
show :: Channel -> String
$cshow :: Channel -> String
showsPrec :: Int -> Channel -> ShowS
$cshowsPrec :: Int -> Channel -> ShowS
Prelude.Show, (forall x. Channel -> Rep Channel x)
-> (forall x. Rep Channel x -> Channel) -> Generic Channel
forall x. Rep Channel x -> Channel
forall x. Channel -> Rep Channel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Channel x -> Channel
$cfrom :: forall x. Channel -> Rep Channel x
Prelude.Generic)
newChannel ::
Prelude.Text ->
DataSource ->
Channel
newChannel :: Text -> DataSource -> Channel
newChannel Text
pChannelName_ DataSource
pDataSource_ =
Channel' :: Maybe ShuffleConfig
-> Maybe RecordWrapper
-> Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel
Channel'
{ $sel:shuffleConfig:Channel' :: Maybe ShuffleConfig
shuffleConfig = Maybe ShuffleConfig
forall a. Maybe a
Prelude.Nothing,
$sel:recordWrapperType:Channel' :: Maybe RecordWrapper
recordWrapperType = Maybe RecordWrapper
forall a. Maybe a
Prelude.Nothing,
$sel:inputMode:Channel' :: Maybe TrainingInputMode
inputMode = Maybe TrainingInputMode
forall a. Maybe a
Prelude.Nothing,
$sel:compressionType:Channel' :: Maybe CompressionType
compressionType = Maybe CompressionType
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:Channel' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelName:Channel' :: Text
channelName = Text
pChannelName_,
$sel:dataSource:Channel' :: DataSource
dataSource = DataSource
pDataSource_
}
channel_shuffleConfig :: Lens.Lens' Channel (Prelude.Maybe ShuffleConfig)
channel_shuffleConfig :: (Maybe ShuffleConfig -> f (Maybe ShuffleConfig))
-> Channel -> f Channel
channel_shuffleConfig = (Channel -> Maybe ShuffleConfig)
-> (Channel -> Maybe ShuffleConfig -> Channel)
-> Lens Channel Channel (Maybe ShuffleConfig) (Maybe ShuffleConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe ShuffleConfig
shuffleConfig :: Maybe ShuffleConfig
$sel:shuffleConfig:Channel' :: Channel -> Maybe ShuffleConfig
shuffleConfig} -> Maybe ShuffleConfig
shuffleConfig) (\s :: Channel
s@Channel' {} Maybe ShuffleConfig
a -> Channel
s {$sel:shuffleConfig:Channel' :: Maybe ShuffleConfig
shuffleConfig = Maybe ShuffleConfig
a} :: Channel)
channel_recordWrapperType :: Lens.Lens' Channel (Prelude.Maybe RecordWrapper)
channel_recordWrapperType :: (Maybe RecordWrapper -> f (Maybe RecordWrapper))
-> Channel -> f Channel
channel_recordWrapperType = (Channel -> Maybe RecordWrapper)
-> (Channel -> Maybe RecordWrapper -> Channel)
-> Lens Channel Channel (Maybe RecordWrapper) (Maybe RecordWrapper)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe RecordWrapper
recordWrapperType :: Maybe RecordWrapper
$sel:recordWrapperType:Channel' :: Channel -> Maybe RecordWrapper
recordWrapperType} -> Maybe RecordWrapper
recordWrapperType) (\s :: Channel
s@Channel' {} Maybe RecordWrapper
a -> Channel
s {$sel:recordWrapperType:Channel' :: Maybe RecordWrapper
recordWrapperType = Maybe RecordWrapper
a} :: Channel)
channel_inputMode :: Lens.Lens' Channel (Prelude.Maybe TrainingInputMode)
channel_inputMode :: (Maybe TrainingInputMode -> f (Maybe TrainingInputMode))
-> Channel -> f Channel
channel_inputMode = (Channel -> Maybe TrainingInputMode)
-> (Channel -> Maybe TrainingInputMode -> Channel)
-> Lens
Channel Channel (Maybe TrainingInputMode) (Maybe TrainingInputMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe TrainingInputMode
inputMode :: Maybe TrainingInputMode
$sel:inputMode:Channel' :: Channel -> Maybe TrainingInputMode
inputMode} -> Maybe TrainingInputMode
inputMode) (\s :: Channel
s@Channel' {} Maybe TrainingInputMode
a -> Channel
s {$sel:inputMode:Channel' :: Maybe TrainingInputMode
inputMode = Maybe TrainingInputMode
a} :: Channel)
channel_compressionType :: Lens.Lens' Channel (Prelude.Maybe CompressionType)
channel_compressionType :: (Maybe CompressionType -> f (Maybe CompressionType))
-> Channel -> f Channel
channel_compressionType = (Channel -> Maybe CompressionType)
-> (Channel -> Maybe CompressionType -> Channel)
-> Lens
Channel Channel (Maybe CompressionType) (Maybe CompressionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe CompressionType
compressionType :: Maybe CompressionType
$sel:compressionType:Channel' :: Channel -> Maybe CompressionType
compressionType} -> Maybe CompressionType
compressionType) (\s :: Channel
s@Channel' {} Maybe CompressionType
a -> Channel
s {$sel:compressionType:Channel' :: Maybe CompressionType
compressionType = Maybe CompressionType
a} :: Channel)
channel_contentType :: Lens.Lens' Channel (Prelude.Maybe Prelude.Text)
channel_contentType :: (Maybe Text -> f (Maybe Text)) -> Channel -> f Channel
channel_contentType = (Channel -> Maybe Text)
-> (Channel -> Maybe Text -> Channel)
-> Lens Channel Channel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe Text
contentType :: Maybe Text
$sel:contentType:Channel' :: Channel -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: Channel
s@Channel' {} Maybe Text
a -> Channel
s {$sel:contentType:Channel' :: Maybe Text
contentType = Maybe Text
a} :: Channel)
channel_channelName :: Lens.Lens' Channel Prelude.Text
channel_channelName :: (Text -> f Text) -> Channel -> f Channel
channel_channelName = (Channel -> Text)
-> (Channel -> Text -> Channel) -> Lens Channel Channel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Text
channelName :: Text
$sel:channelName:Channel' :: Channel -> Text
channelName} -> Text
channelName) (\s :: Channel
s@Channel' {} Text
a -> Channel
s {$sel:channelName:Channel' :: Text
channelName = Text
a} :: Channel)
channel_dataSource :: Lens.Lens' Channel DataSource
channel_dataSource :: (DataSource -> f DataSource) -> Channel -> f Channel
channel_dataSource = (Channel -> DataSource)
-> (Channel -> DataSource -> Channel)
-> Lens Channel Channel DataSource DataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {DataSource
dataSource :: DataSource
$sel:dataSource:Channel' :: Channel -> DataSource
dataSource} -> DataSource
dataSource) (\s :: Channel
s@Channel' {} DataSource
a -> Channel
s {$sel:dataSource:Channel' :: DataSource
dataSource = DataSource
a} :: Channel)
instance Core.FromJSON Channel where
parseJSON :: Value -> Parser Channel
parseJSON =
String -> (Object -> Parser Channel) -> Value -> Parser Channel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Channel"
( \Object
x ->
Maybe ShuffleConfig
-> Maybe RecordWrapper
-> Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel
Channel'
(Maybe ShuffleConfig
-> Maybe RecordWrapper
-> Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel)
-> Parser (Maybe ShuffleConfig)
-> Parser
(Maybe RecordWrapper
-> Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ShuffleConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ShuffleConfig")
Parser
(Maybe RecordWrapper
-> Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel)
-> Parser (Maybe RecordWrapper)
-> Parser
(Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RecordWrapper)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RecordWrapperType")
Parser
(Maybe TrainingInputMode
-> Maybe CompressionType
-> Maybe Text
-> Text
-> DataSource
-> Channel)
-> Parser (Maybe TrainingInputMode)
-> Parser
(Maybe CompressionType
-> Maybe Text -> Text -> DataSource -> Channel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TrainingInputMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputMode")
Parser
(Maybe CompressionType
-> Maybe Text -> Text -> DataSource -> Channel)
-> Parser (Maybe CompressionType)
-> Parser (Maybe Text -> Text -> DataSource -> Channel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CompressionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompressionType")
Parser (Maybe Text -> Text -> DataSource -> Channel)
-> Parser (Maybe Text) -> Parser (Text -> DataSource -> Channel)
forall (f :: * -> *) a b. Applicative f => 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
"ContentType")
Parser (Text -> DataSource -> Channel)
-> Parser Text -> Parser (DataSource -> Channel)
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
"ChannelName")
Parser (DataSource -> Channel)
-> Parser DataSource -> Parser Channel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DataSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DataSource")
)
instance Prelude.Hashable Channel
instance Prelude.NFData Channel
instance Core.ToJSON Channel where
toJSON :: Channel -> Value
toJSON Channel' {Maybe Text
Maybe CompressionType
Maybe RecordWrapper
Maybe ShuffleConfig
Maybe TrainingInputMode
Text
DataSource
dataSource :: DataSource
channelName :: Text
contentType :: Maybe Text
compressionType :: Maybe CompressionType
inputMode :: Maybe TrainingInputMode
recordWrapperType :: Maybe RecordWrapper
shuffleConfig :: Maybe ShuffleConfig
$sel:dataSource:Channel' :: Channel -> DataSource
$sel:channelName:Channel' :: Channel -> Text
$sel:contentType:Channel' :: Channel -> Maybe Text
$sel:compressionType:Channel' :: Channel -> Maybe CompressionType
$sel:inputMode:Channel' :: Channel -> Maybe TrainingInputMode
$sel:recordWrapperType:Channel' :: Channel -> Maybe RecordWrapper
$sel:shuffleConfig:Channel' :: Channel -> Maybe ShuffleConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ShuffleConfig" Text -> ShuffleConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ShuffleConfig -> Pair) -> Maybe ShuffleConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ShuffleConfig
shuffleConfig,
(Text
"RecordWrapperType" Text -> RecordWrapper -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RecordWrapper -> Pair) -> Maybe RecordWrapper -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RecordWrapper
recordWrapperType,
(Text
"InputMode" Text -> TrainingInputMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TrainingInputMode -> Pair)
-> Maybe TrainingInputMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TrainingInputMode
inputMode,
(Text
"CompressionType" Text -> CompressionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CompressionType -> Pair) -> Maybe CompressionType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CompressionType
compressionType,
(Text
"ContentType" 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
contentType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChannelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
channelName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSource" Text -> DataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataSource
dataSource)
]
)