{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.Types.AutoMLChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.AutoMLChannel 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
import Amazonka.SageMaker.Types.AutoMLChannelType
import Amazonka.SageMaker.Types.AutoMLDataSource
import Amazonka.SageMaker.Types.CompressionType

-- | A channel is a named input source that training algorithms can consume.
-- The validation dataset size is limited to less than 2 GB. The training
-- dataset size must be less than 100 GB. For more information, see .
--
-- A validation dataset must contain the same headers as the training
-- dataset.
--
-- /See:/ 'newAutoMLChannel' smart constructor.
data AutoMLChannel = AutoMLChannel'
  { -- | The channel type (optional) is an @enum@ string. The default value is
    -- @training@. Channels for training and validation must share the same
    -- @ContentType@ and @TargetAttributeName@. For information on specifying
    -- training and validation channel types, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/autopilot-datasets-problem-types.html#autopilot-data-sources-training-or-validation How to specify training and validation datasets>
    -- .
    AutoMLChannel -> Maybe AutoMLChannelType
channelType :: Prelude.Maybe AutoMLChannelType,
    -- | You can use @Gzip@ or @None@. The default value is @None@.
    AutoMLChannel -> Maybe CompressionType
compressionType :: Prelude.Maybe CompressionType,
    -- | The content type of the data from the input source. You can use
    -- @text\/csv;header=present@ or @x-application\/vnd.amazon+parquet@. The
    -- default value is @text\/csv;header=present@.
    AutoMLChannel -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
    -- | The data source for an AutoML channel.
    AutoMLChannel -> AutoMLDataSource
dataSource :: AutoMLDataSource,
    -- | The name of the target variable in supervised learning, usually
    -- represented by \'y\'.
    AutoMLChannel -> Text
targetAttributeName :: Prelude.Text
  }
  deriving (AutoMLChannel -> AutoMLChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLChannel -> AutoMLChannel -> Bool
$c/= :: AutoMLChannel -> AutoMLChannel -> Bool
== :: AutoMLChannel -> AutoMLChannel -> Bool
$c== :: AutoMLChannel -> AutoMLChannel -> Bool
Prelude.Eq, ReadPrec [AutoMLChannel]
ReadPrec AutoMLChannel
Int -> ReadS AutoMLChannel
ReadS [AutoMLChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLChannel]
$creadListPrec :: ReadPrec [AutoMLChannel]
readPrec :: ReadPrec AutoMLChannel
$creadPrec :: ReadPrec AutoMLChannel
readList :: ReadS [AutoMLChannel]
$creadList :: ReadS [AutoMLChannel]
readsPrec :: Int -> ReadS AutoMLChannel
$creadsPrec :: Int -> ReadS AutoMLChannel
Prelude.Read, Int -> AutoMLChannel -> ShowS
[AutoMLChannel] -> ShowS
AutoMLChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLChannel] -> ShowS
$cshowList :: [AutoMLChannel] -> ShowS
show :: AutoMLChannel -> String
$cshow :: AutoMLChannel -> String
showsPrec :: Int -> AutoMLChannel -> ShowS
$cshowsPrec :: Int -> AutoMLChannel -> ShowS
Prelude.Show, forall x. Rep AutoMLChannel x -> AutoMLChannel
forall x. AutoMLChannel -> Rep AutoMLChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLChannel x -> AutoMLChannel
$cfrom :: forall x. AutoMLChannel -> Rep AutoMLChannel x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLChannel' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'channelType', 'autoMLChannel_channelType' - The channel type (optional) is an @enum@ string. The default value is
-- @training@. Channels for training and validation must share the same
-- @ContentType@ and @TargetAttributeName@. For information on specifying
-- training and validation channel types, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/autopilot-datasets-problem-types.html#autopilot-data-sources-training-or-validation How to specify training and validation datasets>
-- .
--
-- 'compressionType', 'autoMLChannel_compressionType' - You can use @Gzip@ or @None@. The default value is @None@.
--
-- 'contentType', 'autoMLChannel_contentType' - The content type of the data from the input source. You can use
-- @text\/csv;header=present@ or @x-application\/vnd.amazon+parquet@. The
-- default value is @text\/csv;header=present@.
--
-- 'dataSource', 'autoMLChannel_dataSource' - The data source for an AutoML channel.
--
-- 'targetAttributeName', 'autoMLChannel_targetAttributeName' - The name of the target variable in supervised learning, usually
-- represented by \'y\'.
newAutoMLChannel ::
  -- | 'dataSource'
  AutoMLDataSource ->
  -- | 'targetAttributeName'
  Prelude.Text ->
  AutoMLChannel
newAutoMLChannel :: AutoMLDataSource -> Text -> AutoMLChannel
newAutoMLChannel AutoMLDataSource
pDataSource_ Text
pTargetAttributeName_ =
  AutoMLChannel'
    { $sel:channelType:AutoMLChannel' :: Maybe AutoMLChannelType
channelType = forall a. Maybe a
Prelude.Nothing,
      $sel:compressionType:AutoMLChannel' :: Maybe CompressionType
compressionType = forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:AutoMLChannel' :: Maybe Text
contentType = forall a. Maybe a
Prelude.Nothing,
      $sel:dataSource:AutoMLChannel' :: AutoMLDataSource
dataSource = AutoMLDataSource
pDataSource_,
      $sel:targetAttributeName:AutoMLChannel' :: Text
targetAttributeName = Text
pTargetAttributeName_
    }

-- | The channel type (optional) is an @enum@ string. The default value is
-- @training@. Channels for training and validation must share the same
-- @ContentType@ and @TargetAttributeName@. For information on specifying
-- training and validation channel types, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/autopilot-datasets-problem-types.html#autopilot-data-sources-training-or-validation How to specify training and validation datasets>
-- .
autoMLChannel_channelType :: Lens.Lens' AutoMLChannel (Prelude.Maybe AutoMLChannelType)
autoMLChannel_channelType :: Lens' AutoMLChannel (Maybe AutoMLChannelType)
autoMLChannel_channelType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLChannel' {Maybe AutoMLChannelType
channelType :: Maybe AutoMLChannelType
$sel:channelType:AutoMLChannel' :: AutoMLChannel -> Maybe AutoMLChannelType
channelType} -> Maybe AutoMLChannelType
channelType) (\s :: AutoMLChannel
s@AutoMLChannel' {} Maybe AutoMLChannelType
a -> AutoMLChannel
s {$sel:channelType:AutoMLChannel' :: Maybe AutoMLChannelType
channelType = Maybe AutoMLChannelType
a} :: AutoMLChannel)

-- | You can use @Gzip@ or @None@. The default value is @None@.
autoMLChannel_compressionType :: Lens.Lens' AutoMLChannel (Prelude.Maybe CompressionType)
autoMLChannel_compressionType :: Lens' AutoMLChannel (Maybe CompressionType)
autoMLChannel_compressionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLChannel' {Maybe CompressionType
compressionType :: Maybe CompressionType
$sel:compressionType:AutoMLChannel' :: AutoMLChannel -> Maybe CompressionType
compressionType} -> Maybe CompressionType
compressionType) (\s :: AutoMLChannel
s@AutoMLChannel' {} Maybe CompressionType
a -> AutoMLChannel
s {$sel:compressionType:AutoMLChannel' :: Maybe CompressionType
compressionType = Maybe CompressionType
a} :: AutoMLChannel)

-- | The content type of the data from the input source. You can use
-- @text\/csv;header=present@ or @x-application\/vnd.amazon+parquet@. The
-- default value is @text\/csv;header=present@.
autoMLChannel_contentType :: Lens.Lens' AutoMLChannel (Prelude.Maybe Prelude.Text)
autoMLChannel_contentType :: Lens' AutoMLChannel (Maybe Text)
autoMLChannel_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLChannel' {Maybe Text
contentType :: Maybe Text
$sel:contentType:AutoMLChannel' :: AutoMLChannel -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: AutoMLChannel
s@AutoMLChannel' {} Maybe Text
a -> AutoMLChannel
s {$sel:contentType:AutoMLChannel' :: Maybe Text
contentType = Maybe Text
a} :: AutoMLChannel)

-- | The data source for an AutoML channel.
autoMLChannel_dataSource :: Lens.Lens' AutoMLChannel AutoMLDataSource
autoMLChannel_dataSource :: Lens' AutoMLChannel AutoMLDataSource
autoMLChannel_dataSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLChannel' {AutoMLDataSource
dataSource :: AutoMLDataSource
$sel:dataSource:AutoMLChannel' :: AutoMLChannel -> AutoMLDataSource
dataSource} -> AutoMLDataSource
dataSource) (\s :: AutoMLChannel
s@AutoMLChannel' {} AutoMLDataSource
a -> AutoMLChannel
s {$sel:dataSource:AutoMLChannel' :: AutoMLDataSource
dataSource = AutoMLDataSource
a} :: AutoMLChannel)

-- | The name of the target variable in supervised learning, usually
-- represented by \'y\'.
autoMLChannel_targetAttributeName :: Lens.Lens' AutoMLChannel Prelude.Text
autoMLChannel_targetAttributeName :: Lens' AutoMLChannel Text
autoMLChannel_targetAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLChannel' {Text
targetAttributeName :: Text
$sel:targetAttributeName:AutoMLChannel' :: AutoMLChannel -> Text
targetAttributeName} -> Text
targetAttributeName) (\s :: AutoMLChannel
s@AutoMLChannel' {} Text
a -> AutoMLChannel
s {$sel:targetAttributeName:AutoMLChannel' :: Text
targetAttributeName = Text
a} :: AutoMLChannel)

instance Data.FromJSON AutoMLChannel where
  parseJSON :: Value -> Parser AutoMLChannel
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutoMLChannel"
      ( \Object
x ->
          Maybe AutoMLChannelType
-> Maybe CompressionType
-> Maybe Text
-> AutoMLDataSource
-> Text
-> AutoMLChannel
AutoMLChannel'
            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
"ChannelType")
            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
"CompressionType")
            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
"ContentType")
            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
"DataSource")
            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
"TargetAttributeName")
      )

instance Prelude.Hashable AutoMLChannel where
  hashWithSalt :: Int -> AutoMLChannel -> Int
hashWithSalt Int
_salt AutoMLChannel' {Maybe Text
Maybe AutoMLChannelType
Maybe CompressionType
Text
AutoMLDataSource
targetAttributeName :: Text
dataSource :: AutoMLDataSource
contentType :: Maybe Text
compressionType :: Maybe CompressionType
channelType :: Maybe AutoMLChannelType
$sel:targetAttributeName:AutoMLChannel' :: AutoMLChannel -> Text
$sel:dataSource:AutoMLChannel' :: AutoMLChannel -> AutoMLDataSource
$sel:contentType:AutoMLChannel' :: AutoMLChannel -> Maybe Text
$sel:compressionType:AutoMLChannel' :: AutoMLChannel -> Maybe CompressionType
$sel:channelType:AutoMLChannel' :: AutoMLChannel -> Maybe AutoMLChannelType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoMLChannelType
channelType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CompressionType
compressionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AutoMLDataSource
dataSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetAttributeName

instance Prelude.NFData AutoMLChannel where
  rnf :: AutoMLChannel -> ()
rnf AutoMLChannel' {Maybe Text
Maybe AutoMLChannelType
Maybe CompressionType
Text
AutoMLDataSource
targetAttributeName :: Text
dataSource :: AutoMLDataSource
contentType :: Maybe Text
compressionType :: Maybe CompressionType
channelType :: Maybe AutoMLChannelType
$sel:targetAttributeName:AutoMLChannel' :: AutoMLChannel -> Text
$sel:dataSource:AutoMLChannel' :: AutoMLChannel -> AutoMLDataSource
$sel:contentType:AutoMLChannel' :: AutoMLChannel -> Maybe Text
$sel:compressionType:AutoMLChannel' :: AutoMLChannel -> Maybe CompressionType
$sel:channelType:AutoMLChannel' :: AutoMLChannel -> Maybe AutoMLChannelType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoMLChannelType
channelType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CompressionType
compressionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AutoMLDataSource
dataSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetAttributeName

instance Data.ToJSON AutoMLChannel where
  toJSON :: AutoMLChannel -> Value
toJSON AutoMLChannel' {Maybe Text
Maybe AutoMLChannelType
Maybe CompressionType
Text
AutoMLDataSource
targetAttributeName :: Text
dataSource :: AutoMLDataSource
contentType :: Maybe Text
compressionType :: Maybe CompressionType
channelType :: Maybe AutoMLChannelType
$sel:targetAttributeName:AutoMLChannel' :: AutoMLChannel -> Text
$sel:dataSource:AutoMLChannel' :: AutoMLChannel -> AutoMLDataSource
$sel:contentType:AutoMLChannel' :: AutoMLChannel -> Maybe Text
$sel:compressionType:AutoMLChannel' :: AutoMLChannel -> Maybe CompressionType
$sel:channelType:AutoMLChannel' :: AutoMLChannel -> Maybe AutoMLChannelType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ChannelType" 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 AutoMLChannelType
channelType,
            (Key
"CompressionType" 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 CompressionType
compressionType,
            (Key
"ContentType" 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
contentType,
            forall a. a -> Maybe a
Prelude.Just (Key
"DataSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AutoMLDataSource
dataSource),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TargetAttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetAttributeName)
          ]
      )