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

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

-- | Configuration for uploading output data to Amazon S3 from the processing
-- container.
--
-- /See:/ 'newProcessingS3Output' smart constructor.
data ProcessingS3Output = ProcessingS3Output'
  { -- | A URI that identifies the Amazon S3 bucket where you want Amazon
    -- SageMaker to save the results of a processing job.
    ProcessingS3Output -> Text
s3Uri :: Prelude.Text,
    -- | The local path of a directory where you want Amazon SageMaker to upload
    -- its contents to Amazon S3. @LocalPath@ is an absolute path to a
    -- directory containing output files. This directory will be created by the
    -- platform and exist when your container\'s entrypoint is invoked.
    ProcessingS3Output -> Text
localPath :: Prelude.Text,
    -- | Whether to upload the results of the processing job continuously or
    -- after the job completes.
    ProcessingS3Output -> ProcessingS3UploadMode
s3UploadMode :: ProcessingS3UploadMode
  }
  deriving (ProcessingS3Output -> ProcessingS3Output -> Bool
(ProcessingS3Output -> ProcessingS3Output -> Bool)
-> (ProcessingS3Output -> ProcessingS3Output -> Bool)
-> Eq ProcessingS3Output
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProcessingS3Output -> ProcessingS3Output -> Bool
$c/= :: ProcessingS3Output -> ProcessingS3Output -> Bool
== :: ProcessingS3Output -> ProcessingS3Output -> Bool
$c== :: ProcessingS3Output -> ProcessingS3Output -> Bool
Prelude.Eq, ReadPrec [ProcessingS3Output]
ReadPrec ProcessingS3Output
Int -> ReadS ProcessingS3Output
ReadS [ProcessingS3Output]
(Int -> ReadS ProcessingS3Output)
-> ReadS [ProcessingS3Output]
-> ReadPrec ProcessingS3Output
-> ReadPrec [ProcessingS3Output]
-> Read ProcessingS3Output
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProcessingS3Output]
$creadListPrec :: ReadPrec [ProcessingS3Output]
readPrec :: ReadPrec ProcessingS3Output
$creadPrec :: ReadPrec ProcessingS3Output
readList :: ReadS [ProcessingS3Output]
$creadList :: ReadS [ProcessingS3Output]
readsPrec :: Int -> ReadS ProcessingS3Output
$creadsPrec :: Int -> ReadS ProcessingS3Output
Prelude.Read, Int -> ProcessingS3Output -> ShowS
[ProcessingS3Output] -> ShowS
ProcessingS3Output -> String
(Int -> ProcessingS3Output -> ShowS)
-> (ProcessingS3Output -> String)
-> ([ProcessingS3Output] -> ShowS)
-> Show ProcessingS3Output
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProcessingS3Output] -> ShowS
$cshowList :: [ProcessingS3Output] -> ShowS
show :: ProcessingS3Output -> String
$cshow :: ProcessingS3Output -> String
showsPrec :: Int -> ProcessingS3Output -> ShowS
$cshowsPrec :: Int -> ProcessingS3Output -> ShowS
Prelude.Show, (forall x. ProcessingS3Output -> Rep ProcessingS3Output x)
-> (forall x. Rep ProcessingS3Output x -> ProcessingS3Output)
-> Generic ProcessingS3Output
forall x. Rep ProcessingS3Output x -> ProcessingS3Output
forall x. ProcessingS3Output -> Rep ProcessingS3Output x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProcessingS3Output x -> ProcessingS3Output
$cfrom :: forall x. ProcessingS3Output -> Rep ProcessingS3Output x
Prelude.Generic)

-- |
-- Create a value of 'ProcessingS3Output' 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:
--
-- 's3Uri', 'processingS3Output_s3Uri' - A URI that identifies the Amazon S3 bucket where you want Amazon
-- SageMaker to save the results of a processing job.
--
-- 'localPath', 'processingS3Output_localPath' - The local path of a directory where you want Amazon SageMaker to upload
-- its contents to Amazon S3. @LocalPath@ is an absolute path to a
-- directory containing output files. This directory will be created by the
-- platform and exist when your container\'s entrypoint is invoked.
--
-- 's3UploadMode', 'processingS3Output_s3UploadMode' - Whether to upload the results of the processing job continuously or
-- after the job completes.
newProcessingS3Output ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'localPath'
  Prelude.Text ->
  -- | 's3UploadMode'
  ProcessingS3UploadMode ->
  ProcessingS3Output
newProcessingS3Output :: Text -> Text -> ProcessingS3UploadMode -> ProcessingS3Output
newProcessingS3Output
  Text
pS3Uri_
  Text
pLocalPath_
  ProcessingS3UploadMode
pS3UploadMode_ =
    ProcessingS3Output' :: Text -> Text -> ProcessingS3UploadMode -> ProcessingS3Output
ProcessingS3Output'
      { $sel:s3Uri:ProcessingS3Output' :: Text
s3Uri = Text
pS3Uri_,
        $sel:localPath:ProcessingS3Output' :: Text
localPath = Text
pLocalPath_,
        $sel:s3UploadMode:ProcessingS3Output' :: ProcessingS3UploadMode
s3UploadMode = ProcessingS3UploadMode
pS3UploadMode_
      }

-- | A URI that identifies the Amazon S3 bucket where you want Amazon
-- SageMaker to save the results of a processing job.
processingS3Output_s3Uri :: Lens.Lens' ProcessingS3Output Prelude.Text
processingS3Output_s3Uri :: (Text -> f Text) -> ProcessingS3Output -> f ProcessingS3Output
processingS3Output_s3Uri = (ProcessingS3Output -> Text)
-> (ProcessingS3Output -> Text -> ProcessingS3Output)
-> Lens ProcessingS3Output ProcessingS3Output Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingS3Output' {Text
s3Uri :: Text
$sel:s3Uri:ProcessingS3Output' :: ProcessingS3Output -> Text
s3Uri} -> Text
s3Uri) (\s :: ProcessingS3Output
s@ProcessingS3Output' {} Text
a -> ProcessingS3Output
s {$sel:s3Uri:ProcessingS3Output' :: Text
s3Uri = Text
a} :: ProcessingS3Output)

-- | The local path of a directory where you want Amazon SageMaker to upload
-- its contents to Amazon S3. @LocalPath@ is an absolute path to a
-- directory containing output files. This directory will be created by the
-- platform and exist when your container\'s entrypoint is invoked.
processingS3Output_localPath :: Lens.Lens' ProcessingS3Output Prelude.Text
processingS3Output_localPath :: (Text -> f Text) -> ProcessingS3Output -> f ProcessingS3Output
processingS3Output_localPath = (ProcessingS3Output -> Text)
-> (ProcessingS3Output -> Text -> ProcessingS3Output)
-> Lens ProcessingS3Output ProcessingS3Output Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingS3Output' {Text
localPath :: Text
$sel:localPath:ProcessingS3Output' :: ProcessingS3Output -> Text
localPath} -> Text
localPath) (\s :: ProcessingS3Output
s@ProcessingS3Output' {} Text
a -> ProcessingS3Output
s {$sel:localPath:ProcessingS3Output' :: Text
localPath = Text
a} :: ProcessingS3Output)

-- | Whether to upload the results of the processing job continuously or
-- after the job completes.
processingS3Output_s3UploadMode :: Lens.Lens' ProcessingS3Output ProcessingS3UploadMode
processingS3Output_s3UploadMode :: (ProcessingS3UploadMode -> f ProcessingS3UploadMode)
-> ProcessingS3Output -> f ProcessingS3Output
processingS3Output_s3UploadMode = (ProcessingS3Output -> ProcessingS3UploadMode)
-> (ProcessingS3Output
    -> ProcessingS3UploadMode -> ProcessingS3Output)
-> Lens
     ProcessingS3Output
     ProcessingS3Output
     ProcessingS3UploadMode
     ProcessingS3UploadMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingS3Output' {ProcessingS3UploadMode
s3UploadMode :: ProcessingS3UploadMode
$sel:s3UploadMode:ProcessingS3Output' :: ProcessingS3Output -> ProcessingS3UploadMode
s3UploadMode} -> ProcessingS3UploadMode
s3UploadMode) (\s :: ProcessingS3Output
s@ProcessingS3Output' {} ProcessingS3UploadMode
a -> ProcessingS3Output
s {$sel:s3UploadMode:ProcessingS3Output' :: ProcessingS3UploadMode
s3UploadMode = ProcessingS3UploadMode
a} :: ProcessingS3Output)

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

instance Prelude.Hashable ProcessingS3Output

instance Prelude.NFData ProcessingS3Output

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