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

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

-- | Describes the S3 data source.
--
-- /See:/ 'newTransformS3DataSource' smart constructor.
data TransformS3DataSource = TransformS3DataSource'
  { -- | If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix. Amazon
    -- SageMaker uses all objects with the specified key name prefix for batch
    -- transform.
    --
    -- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
    -- manifest file containing a list of object keys that you want Amazon
    -- SageMaker to use for batch transform.
    --
    -- The following values are compatible: @ManifestFile@, @S3Prefix@
    --
    -- The following value is not compatible: @AugmentedManifestFile@
    TransformS3DataSource -> S3DataType
s3DataType :: S3DataType,
    -- | Depending on the value specified for the @S3DataType@, identifies either
    -- a key name prefix or a manifest. For example:
    --
    -- -   A key name prefix might look like this:
    --     @s3:\/\/bucketname\/exampleprefix@.
    --
    -- -   A manifest might look like this:
    --     @s3:\/\/bucketname\/example.manifest@
    --
    --     The manifest is an S3 object which is a JSON file with the following
    --     format:
    --
    --     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
    --
    --     @\"relative\/path\/to\/custdata-1\",@
    --
    --     @\"relative\/path\/custdata-2\",@
    --
    --     @...@
    --
    --     @\"relative\/path\/custdata-N\"@
    --
    --     @]@
    --
    --     The preceding JSON matches the following @S3Uris@:
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
    --
    --     @...@
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
    --
    --     The complete set of @S3Uris@ in this manifest constitutes the input
    --     data for the channel for this datasource. The object that each
    --     @S3Uris@ points to must be readable by the IAM role that Amazon
    --     SageMaker uses to perform tasks on your behalf.
    TransformS3DataSource -> Text
s3Uri :: Prelude.Text
  }
  deriving (TransformS3DataSource -> TransformS3DataSource -> Bool
(TransformS3DataSource -> TransformS3DataSource -> Bool)
-> (TransformS3DataSource -> TransformS3DataSource -> Bool)
-> Eq TransformS3DataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransformS3DataSource -> TransformS3DataSource -> Bool
$c/= :: TransformS3DataSource -> TransformS3DataSource -> Bool
== :: TransformS3DataSource -> TransformS3DataSource -> Bool
$c== :: TransformS3DataSource -> TransformS3DataSource -> Bool
Prelude.Eq, ReadPrec [TransformS3DataSource]
ReadPrec TransformS3DataSource
Int -> ReadS TransformS3DataSource
ReadS [TransformS3DataSource]
(Int -> ReadS TransformS3DataSource)
-> ReadS [TransformS3DataSource]
-> ReadPrec TransformS3DataSource
-> ReadPrec [TransformS3DataSource]
-> Read TransformS3DataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransformS3DataSource]
$creadListPrec :: ReadPrec [TransformS3DataSource]
readPrec :: ReadPrec TransformS3DataSource
$creadPrec :: ReadPrec TransformS3DataSource
readList :: ReadS [TransformS3DataSource]
$creadList :: ReadS [TransformS3DataSource]
readsPrec :: Int -> ReadS TransformS3DataSource
$creadsPrec :: Int -> ReadS TransformS3DataSource
Prelude.Read, Int -> TransformS3DataSource -> ShowS
[TransformS3DataSource] -> ShowS
TransformS3DataSource -> String
(Int -> TransformS3DataSource -> ShowS)
-> (TransformS3DataSource -> String)
-> ([TransformS3DataSource] -> ShowS)
-> Show TransformS3DataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransformS3DataSource] -> ShowS
$cshowList :: [TransformS3DataSource] -> ShowS
show :: TransformS3DataSource -> String
$cshow :: TransformS3DataSource -> String
showsPrec :: Int -> TransformS3DataSource -> ShowS
$cshowsPrec :: Int -> TransformS3DataSource -> ShowS
Prelude.Show, (forall x. TransformS3DataSource -> Rep TransformS3DataSource x)
-> (forall x. Rep TransformS3DataSource x -> TransformS3DataSource)
-> Generic TransformS3DataSource
forall x. Rep TransformS3DataSource x -> TransformS3DataSource
forall x. TransformS3DataSource -> Rep TransformS3DataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransformS3DataSource x -> TransformS3DataSource
$cfrom :: forall x. TransformS3DataSource -> Rep TransformS3DataSource x
Prelude.Generic)

-- |
-- Create a value of 'TransformS3DataSource' 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', 'transformS3DataSource_s3DataType' - If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix. Amazon
-- SageMaker uses all objects with the specified key name prefix for batch
-- transform.
--
-- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
-- manifest file containing a list of object keys that you want Amazon
-- SageMaker to use for batch transform.
--
-- The following values are compatible: @ManifestFile@, @S3Prefix@
--
-- The following value is not compatible: @AugmentedManifestFile@
--
-- 's3Uri', 'transformS3DataSource_s3Uri' - Depending on the value specified for the @S3DataType@, identifies either
-- a key name prefix or a manifest. For example:
--
-- -   A key name prefix might look like this:
--     @s3:\/\/bucketname\/exampleprefix@.
--
-- -   A manifest might look like this:
--     @s3:\/\/bucketname\/example.manifest@
--
--     The manifest is an S3 object which is a JSON file with the following
--     format:
--
--     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
--
--     @\"relative\/path\/to\/custdata-1\",@
--
--     @\"relative\/path\/custdata-2\",@
--
--     @...@
--
--     @\"relative\/path\/custdata-N\"@
--
--     @]@
--
--     The preceding JSON matches the following @S3Uris@:
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
--
--     @...@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
--
--     The complete set of @S3Uris@ in this manifest constitutes the input
--     data for the channel for this datasource. The object that each
--     @S3Uris@ points to must be readable by the IAM role that Amazon
--     SageMaker uses to perform tasks on your behalf.
newTransformS3DataSource ::
  -- | 's3DataType'
  S3DataType ->
  -- | 's3Uri'
  Prelude.Text ->
  TransformS3DataSource
newTransformS3DataSource :: S3DataType -> Text -> TransformS3DataSource
newTransformS3DataSource S3DataType
pS3DataType_ Text
pS3Uri_ =
  TransformS3DataSource' :: S3DataType -> Text -> TransformS3DataSource
TransformS3DataSource'
    { $sel:s3DataType:TransformS3DataSource' :: S3DataType
s3DataType = S3DataType
pS3DataType_,
      $sel:s3Uri:TransformS3DataSource' :: Text
s3Uri = Text
pS3Uri_
    }

-- | If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix. Amazon
-- SageMaker uses all objects with the specified key name prefix for batch
-- transform.
--
-- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
-- manifest file containing a list of object keys that you want Amazon
-- SageMaker to use for batch transform.
--
-- The following values are compatible: @ManifestFile@, @S3Prefix@
--
-- The following value is not compatible: @AugmentedManifestFile@
transformS3DataSource_s3DataType :: Lens.Lens' TransformS3DataSource S3DataType
transformS3DataSource_s3DataType :: (S3DataType -> f S3DataType)
-> TransformS3DataSource -> f TransformS3DataSource
transformS3DataSource_s3DataType = (TransformS3DataSource -> S3DataType)
-> (TransformS3DataSource -> S3DataType -> TransformS3DataSource)
-> Lens
     TransformS3DataSource TransformS3DataSource S3DataType S3DataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformS3DataSource' {S3DataType
s3DataType :: S3DataType
$sel:s3DataType:TransformS3DataSource' :: TransformS3DataSource -> S3DataType
s3DataType} -> S3DataType
s3DataType) (\s :: TransformS3DataSource
s@TransformS3DataSource' {} S3DataType
a -> TransformS3DataSource
s {$sel:s3DataType:TransformS3DataSource' :: S3DataType
s3DataType = S3DataType
a} :: TransformS3DataSource)

-- | Depending on the value specified for the @S3DataType@, identifies either
-- a key name prefix or a manifest. For example:
--
-- -   A key name prefix might look like this:
--     @s3:\/\/bucketname\/exampleprefix@.
--
-- -   A manifest might look like this:
--     @s3:\/\/bucketname\/example.manifest@
--
--     The manifest is an S3 object which is a JSON file with the following
--     format:
--
--     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
--
--     @\"relative\/path\/to\/custdata-1\",@
--
--     @\"relative\/path\/custdata-2\",@
--
--     @...@
--
--     @\"relative\/path\/custdata-N\"@
--
--     @]@
--
--     The preceding JSON matches the following @S3Uris@:
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
--
--     @...@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
--
--     The complete set of @S3Uris@ in this manifest constitutes the input
--     data for the channel for this datasource. The object that each
--     @S3Uris@ points to must be readable by the IAM role that Amazon
--     SageMaker uses to perform tasks on your behalf.
transformS3DataSource_s3Uri :: Lens.Lens' TransformS3DataSource Prelude.Text
transformS3DataSource_s3Uri :: (Text -> f Text)
-> TransformS3DataSource -> f TransformS3DataSource
transformS3DataSource_s3Uri = (TransformS3DataSource -> Text)
-> (TransformS3DataSource -> Text -> TransformS3DataSource)
-> Lens TransformS3DataSource TransformS3DataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformS3DataSource' {Text
s3Uri :: Text
$sel:s3Uri:TransformS3DataSource' :: TransformS3DataSource -> Text
s3Uri} -> Text
s3Uri) (\s :: TransformS3DataSource
s@TransformS3DataSource' {} Text
a -> TransformS3DataSource
s {$sel:s3Uri:TransformS3DataSource' :: Text
s3Uri = Text
a} :: TransformS3DataSource)

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

instance Prelude.NFData TransformS3DataSource

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