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

-- | The Amazon S3 data source.
--
-- /See:/ 'newAutoMLS3DataSource' smart constructor.
data AutoMLS3DataSource = AutoMLS3DataSource'
  { -- | The data type.
    --
    -- A ManifestFile should have the format shown below:
    --
    -- @[ {\"prefix\": \"s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER\/DOC-EXAMPLE-PREFIX\/\"}, @
    --
    -- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-1\",@
    --
    -- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-2\",@
    --
    -- @... \"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-N\" ]@
    --
    -- An S3Prefix should have the following format:
    --
    -- @s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER-OR-FILE@
    AutoMLS3DataSource -> AutoMLS3DataType
s3DataType :: AutoMLS3DataType,
    -- | The URL to the Amazon S3 data source.
    AutoMLS3DataSource -> Text
s3Uri :: Prelude.Text
  }
  deriving (AutoMLS3DataSource -> AutoMLS3DataSource -> Bool
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]
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
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. 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.
--
-- A ManifestFile should have the format shown below:
--
-- @[ {\"prefix\": \"s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER\/DOC-EXAMPLE-PREFIX\/\"}, @
--
-- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-1\",@
--
-- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-2\",@
--
-- @... \"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-N\" ]@
--
-- An S3Prefix should have the following format:
--
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER-OR-FILE@
--
-- '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'
    { $sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataType
s3DataType = AutoMLS3DataType
pS3DataType_,
      $sel:s3Uri:AutoMLS3DataSource' :: Text
s3Uri = Text
pS3Uri_
    }

-- | The data type.
--
-- A ManifestFile should have the format shown below:
--
-- @[ {\"prefix\": \"s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER\/DOC-EXAMPLE-PREFIX\/\"}, @
--
-- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-1\",@
--
-- @\"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-2\",@
--
-- @... \"DOC-EXAMPLE-RELATIVE-PATH\/DOC-EXAMPLE-FOLDER\/DATA-N\" ]@
--
-- An S3Prefix should have the following format:
--
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/DOC-EXAMPLE-FOLDER-OR-FILE@
autoMLS3DataSource_s3DataType :: Lens.Lens' AutoMLS3DataSource AutoMLS3DataType
autoMLS3DataSource_s3DataType :: Lens' AutoMLS3DataSource AutoMLS3DataType
autoMLS3DataSource_s3DataType = 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 :: Lens' AutoMLS3DataSource Text
autoMLS3DataSource_s3Uri = 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 Data.FromJSON AutoMLS3DataSource where
  parseJSON :: Value -> Parser AutoMLS3DataSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutoMLS3DataSource"
      ( \Object
x ->
          AutoMLS3DataType -> Text -> AutoMLS3DataSource
AutoMLS3DataSource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3DataType")
            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
"S3Uri")
      )

instance Prelude.Hashable AutoMLS3DataSource where
  hashWithSalt :: Int -> AutoMLS3DataSource -> Int
hashWithSalt Int
_salt AutoMLS3DataSource' {Text
AutoMLS3DataType
s3Uri :: Text
s3DataType :: AutoMLS3DataType
$sel:s3Uri:AutoMLS3DataSource' :: AutoMLS3DataSource -> Text
$sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataSource -> AutoMLS3DataType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AutoMLS3DataType
s3DataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri

instance Prelude.NFData AutoMLS3DataSource where
  rnf :: AutoMLS3DataSource -> ()
rnf AutoMLS3DataSource' {Text
AutoMLS3DataType
s3Uri :: Text
s3DataType :: AutoMLS3DataType
$sel:s3Uri:AutoMLS3DataSource' :: AutoMLS3DataSource -> Text
$sel:s3DataType:AutoMLS3DataSource' :: AutoMLS3DataSource -> AutoMLS3DataType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf AutoMLS3DataType
s3DataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"S3DataType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AutoMLS3DataType
s3DataType),
            forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri)
          ]
      )