{-# 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.AutoMLDataSource
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.AutoMLDataSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.AutoMLS3DataSource

-- | The data source for the Autopilot job.
--
-- /See:/ 'newAutoMLDataSource' smart constructor.
data AutoMLDataSource = AutoMLDataSource'
  { -- | The Amazon S3 location of the input data.
    --
    -- The input data must be in CSV format and contain at least 500 rows.
    AutoMLDataSource -> AutoMLS3DataSource
s3DataSource :: AutoMLS3DataSource
  }
  deriving (AutoMLDataSource -> AutoMLDataSource -> Bool
(AutoMLDataSource -> AutoMLDataSource -> Bool)
-> (AutoMLDataSource -> AutoMLDataSource -> Bool)
-> Eq AutoMLDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLDataSource -> AutoMLDataSource -> Bool
$c/= :: AutoMLDataSource -> AutoMLDataSource -> Bool
== :: AutoMLDataSource -> AutoMLDataSource -> Bool
$c== :: AutoMLDataSource -> AutoMLDataSource -> Bool
Prelude.Eq, ReadPrec [AutoMLDataSource]
ReadPrec AutoMLDataSource
Int -> ReadS AutoMLDataSource
ReadS [AutoMLDataSource]
(Int -> ReadS AutoMLDataSource)
-> ReadS [AutoMLDataSource]
-> ReadPrec AutoMLDataSource
-> ReadPrec [AutoMLDataSource]
-> Read AutoMLDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLDataSource]
$creadListPrec :: ReadPrec [AutoMLDataSource]
readPrec :: ReadPrec AutoMLDataSource
$creadPrec :: ReadPrec AutoMLDataSource
readList :: ReadS [AutoMLDataSource]
$creadList :: ReadS [AutoMLDataSource]
readsPrec :: Int -> ReadS AutoMLDataSource
$creadsPrec :: Int -> ReadS AutoMLDataSource
Prelude.Read, Int -> AutoMLDataSource -> ShowS
[AutoMLDataSource] -> ShowS
AutoMLDataSource -> String
(Int -> AutoMLDataSource -> ShowS)
-> (AutoMLDataSource -> String)
-> ([AutoMLDataSource] -> ShowS)
-> Show AutoMLDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLDataSource] -> ShowS
$cshowList :: [AutoMLDataSource] -> ShowS
show :: AutoMLDataSource -> String
$cshow :: AutoMLDataSource -> String
showsPrec :: Int -> AutoMLDataSource -> ShowS
$cshowsPrec :: Int -> AutoMLDataSource -> ShowS
Prelude.Show, (forall x. AutoMLDataSource -> Rep AutoMLDataSource x)
-> (forall x. Rep AutoMLDataSource x -> AutoMLDataSource)
-> Generic AutoMLDataSource
forall x. Rep AutoMLDataSource x -> AutoMLDataSource
forall x. AutoMLDataSource -> Rep AutoMLDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLDataSource x -> AutoMLDataSource
$cfrom :: forall x. AutoMLDataSource -> Rep AutoMLDataSource x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLDataSource' 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:
--
-- 's3DataSource', 'autoMLDataSource_s3DataSource' - The Amazon S3 location of the input data.
--
-- The input data must be in CSV format and contain at least 500 rows.
newAutoMLDataSource ::
  -- | 's3DataSource'
  AutoMLS3DataSource ->
  AutoMLDataSource
newAutoMLDataSource :: AutoMLS3DataSource -> AutoMLDataSource
newAutoMLDataSource AutoMLS3DataSource
pS3DataSource_ =
  AutoMLDataSource' :: AutoMLS3DataSource -> AutoMLDataSource
AutoMLDataSource' {$sel:s3DataSource:AutoMLDataSource' :: AutoMLS3DataSource
s3DataSource = AutoMLS3DataSource
pS3DataSource_}

-- | The Amazon S3 location of the input data.
--
-- The input data must be in CSV format and contain at least 500 rows.
autoMLDataSource_s3DataSource :: Lens.Lens' AutoMLDataSource AutoMLS3DataSource
autoMLDataSource_s3DataSource :: (AutoMLS3DataSource -> f AutoMLS3DataSource)
-> AutoMLDataSource -> f AutoMLDataSource
autoMLDataSource_s3DataSource = (AutoMLDataSource -> AutoMLS3DataSource)
-> (AutoMLDataSource -> AutoMLS3DataSource -> AutoMLDataSource)
-> Lens
     AutoMLDataSource
     AutoMLDataSource
     AutoMLS3DataSource
     AutoMLS3DataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLDataSource' {AutoMLS3DataSource
s3DataSource :: AutoMLS3DataSource
$sel:s3DataSource:AutoMLDataSource' :: AutoMLDataSource -> AutoMLS3DataSource
s3DataSource} -> AutoMLS3DataSource
s3DataSource) (\s :: AutoMLDataSource
s@AutoMLDataSource' {} AutoMLS3DataSource
a -> AutoMLDataSource
s {$sel:s3DataSource:AutoMLDataSource' :: AutoMLS3DataSource
s3DataSource = AutoMLS3DataSource
a} :: AutoMLDataSource)

instance Core.FromJSON AutoMLDataSource where
  parseJSON :: Value -> Parser AutoMLDataSource
parseJSON =
    String
-> (Object -> Parser AutoMLDataSource)
-> Value
-> Parser AutoMLDataSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoMLDataSource"
      ( \Object
x ->
          AutoMLS3DataSource -> AutoMLDataSource
AutoMLDataSource'
            (AutoMLS3DataSource -> AutoMLDataSource)
-> Parser AutoMLS3DataSource -> Parser AutoMLDataSource
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AutoMLS3DataSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3DataSource")
      )

instance Prelude.Hashable AutoMLDataSource

instance Prelude.NFData AutoMLDataSource

instance Core.ToJSON AutoMLDataSource where
  toJSON :: AutoMLDataSource -> Value
toJSON AutoMLDataSource' {AutoMLS3DataSource
s3DataSource :: AutoMLS3DataSource
$sel:s3DataSource:AutoMLDataSource' :: AutoMLDataSource -> AutoMLS3DataSource
..} =
    [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
"S3DataSource" Text -> AutoMLS3DataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AutoMLS3DataSource
s3DataSource)]
      )