{-# 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.AutoMLS3DataSource
-- 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.AutoMLS3DataSource where

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

-- | The Amazon S3 data source.
--
-- /See:/ 'newAutoMLS3DataSource' smart constructor.
data AutoMLS3DataSource = AutoMLS3DataSource'
  { -- | The data type.
    AutoMLS3DataSource -> AutoMLS3DataType
s3DataType :: AutoMLS3DataType,
    -- | The URL to the Amazon S3 data source.
    AutoMLS3DataSource -> Text
s3Uri :: Prelude.Text
  }
  deriving (AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
(AutoMLS3DataSource -> AutoMLS3DataSource -> Bool)
-> (AutoMLS3DataSource -> AutoMLS3DataSource -> Bool)
-> Eq AutoMLS3DataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
$c/= :: AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
== :: AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
$c== :: AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
Prelude.Eq, ReadPrec [AutoMLS3DataSource]
ReadPrec AutoMLS3DataSource
Int -> ReadS AutoMLS3DataSource
ReadS [AutoMLS3DataSource]
(Int -> ReadS AutoMLS3DataSource)
-> ReadS [AutoMLS3DataSource]
-> ReadPrec AutoMLS3DataSource
-> ReadPrec [AutoMLS3DataSource]
-> Read AutoMLS3DataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLS3DataSource]
$creadListPrec :: ReadPrec [AutoMLS3DataSource]
readPrec :: ReadPrec AutoMLS3DataSource
$creadPrec :: ReadPrec AutoMLS3DataSource
readList :: ReadS [AutoMLS3DataSource]
$creadList :: ReadS [AutoMLS3DataSource]
readsPrec :: Int -> ReadS AutoMLS3DataSource
$creadsPrec :: Int -> ReadS AutoMLS3DataSource
Prelude.Read, Int -> AutoMLS3DataSource -> ShowS
[AutoMLS3DataSource] -> ShowS
AutoMLS3DataSource -> String
(Int -> AutoMLS3DataSource -> ShowS)
-> (AutoMLS3DataSource -> String)
-> ([AutoMLS3DataSource] -> ShowS)
-> Show AutoMLS3DataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLS3DataSource] -> ShowS
$cshowList :: [AutoMLS3DataSource] -> ShowS
show :: AutoMLS3DataSource -> String
$cshow :: AutoMLS3DataSource -> String
showsPrec :: Int -> AutoMLS3DataSource -> ShowS
$cshowsPrec :: Int -> AutoMLS3DataSource -> ShowS
Prelude.Show, (forall x. AutoMLS3DataSource -> Rep AutoMLS3DataSource x)
-> (forall x. Rep AutoMLS3DataSource x -> AutoMLS3DataSource)
-> Generic AutoMLS3DataSource
forall x. Rep AutoMLS3DataSource x -> AutoMLS3DataSource
forall x. AutoMLS3DataSource -> Rep AutoMLS3DataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLS3DataSource x -> AutoMLS3DataSource
$cfrom :: forall x. AutoMLS3DataSource -> Rep AutoMLS3DataSource x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLS3DataSource' 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:
--
-- 's3DataType', 'autoMLS3DataSource_s3DataType' - The data type.
--
-- 's3Uri', 'autoMLS3DataSource_s3Uri' - The URL to the Amazon S3 data source.
newAutoMLS3DataSource ::
  -- | 's3DataType'
  AutoMLS3DataType ->
  -- | 's3Uri'
  Prelude.Text ->
  AutoMLS3DataSource
newAutoMLS3DataSource :: AutoMLS3DataType -> Text -> AutoMLS3DataSource
newAutoMLS3DataSource AutoMLS3DataType
pS3DataType_ Text
pS3Uri_ =
  AutoMLS3DataSource' :: AutoMLS3DataType -> Text -> AutoMLS3DataSource
AutoMLS3DataSource'
    { $sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataType
s3DataType = AutoMLS3DataType
pS3DataType_,
      $sel:s3Uri:AutoMLS3DataSource' :: Text
s3Uri = Text
pS3Uri_
    }

-- | The data type.
autoMLS3DataSource_s3DataType :: Lens.Lens' AutoMLS3DataSource AutoMLS3DataType
autoMLS3DataSource_s3DataType :: (AutoMLS3DataType -> f AutoMLS3DataType)
-> AutoMLS3DataSource -> f AutoMLS3DataSource
autoMLS3DataSource_s3DataType = (AutoMLS3DataSource -> AutoMLS3DataType)
-> (AutoMLS3DataSource -> AutoMLS3DataType -> AutoMLS3DataSource)
-> Lens
     AutoMLS3DataSource
     AutoMLS3DataSource
     AutoMLS3DataType
     AutoMLS3DataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLS3DataSource' {AutoMLS3DataType
s3DataType :: AutoMLS3DataType
$sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataSource -> AutoMLS3DataType
s3DataType} -> AutoMLS3DataType
s3DataType) (\s :: AutoMLS3DataSource
s@AutoMLS3DataSource' {} AutoMLS3DataType
a -> AutoMLS3DataSource
s {$sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataType
s3DataType = AutoMLS3DataType
a} :: AutoMLS3DataSource)

-- | The URL to the Amazon S3 data source.
autoMLS3DataSource_s3Uri :: Lens.Lens' AutoMLS3DataSource Prelude.Text
autoMLS3DataSource_s3Uri :: (Text -> f Text) -> AutoMLS3DataSource -> f AutoMLS3DataSource
autoMLS3DataSource_s3Uri = (AutoMLS3DataSource -> Text)
-> (AutoMLS3DataSource -> Text -> AutoMLS3DataSource)
-> Lens AutoMLS3DataSource AutoMLS3DataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLS3DataSource' {Text
s3Uri :: Text
$sel:s3Uri:AutoMLS3DataSource' :: AutoMLS3DataSource -> Text
s3Uri} -> Text
s3Uri) (\s :: AutoMLS3DataSource
s@AutoMLS3DataSource' {} Text
a -> AutoMLS3DataSource
s {$sel:s3Uri:AutoMLS3DataSource' :: Text
s3Uri = Text
a} :: AutoMLS3DataSource)

instance Core.FromJSON AutoMLS3DataSource where
  parseJSON :: Value -> Parser AutoMLS3DataSource
parseJSON =
    String
-> (Object -> Parser AutoMLS3DataSource)
-> Value
-> Parser AutoMLS3DataSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoMLS3DataSource"
      ( \Object
x ->
          AutoMLS3DataType -> Text -> AutoMLS3DataSource
AutoMLS3DataSource'
            (AutoMLS3DataType -> Text -> AutoMLS3DataSource)
-> Parser AutoMLS3DataType -> Parser (Text -> AutoMLS3DataSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AutoMLS3DataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3DataType")
            Parser (Text -> AutoMLS3DataSource)
-> Parser Text -> Parser AutoMLS3DataSource
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
"S3Uri")
      )

instance Prelude.Hashable AutoMLS3DataSource

instance Prelude.NFData AutoMLS3DataSource

instance Core.ToJSON AutoMLS3DataSource where
  toJSON :: AutoMLS3DataSource -> Value
toJSON AutoMLS3DataSource' {Text
AutoMLS3DataType
s3Uri :: Text
s3DataType :: AutoMLS3DataType
$sel:s3Uri:AutoMLS3DataSource' :: AutoMLS3DataSource -> Text
$sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataSource -> AutoMLS3DataType
..} =
    [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
"S3DataType" Text -> AutoMLS3DataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AutoMLS3DataType
s3DataType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri)
          ]
      )