{-# 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-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.ProcessingS3Output 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.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
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]
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
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. 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'
      { $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 :: Lens' ProcessingS3Output Text
processingS3Output_s3Uri = 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 :: Lens' ProcessingS3Output Text
processingS3Output_localPath = 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 :: Lens' ProcessingS3Output ProcessingS3UploadMode
processingS3Output_s3UploadMode = 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 Data.FromJSON ProcessingS3Output where
  parseJSON :: Value -> Parser ProcessingS3Output
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProcessingS3Output"
      ( \Object
x ->
          Text -> Text -> ProcessingS3UploadMode -> ProcessingS3Output
ProcessingS3Output'
            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
"S3Uri")
            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
"LocalPath")
            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
"S3UploadMode")
      )

instance Prelude.Hashable ProcessingS3Output where
  hashWithSalt :: Int -> ProcessingS3Output -> Int
hashWithSalt Int
_salt ProcessingS3Output' {Text
ProcessingS3UploadMode
s3UploadMode :: ProcessingS3UploadMode
localPath :: Text
s3Uri :: Text
$sel:s3UploadMode:ProcessingS3Output' :: ProcessingS3Output -> ProcessingS3UploadMode
$sel:localPath:ProcessingS3Output' :: ProcessingS3Output -> Text
$sel:s3Uri:ProcessingS3Output' :: ProcessingS3Output -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ProcessingS3UploadMode
s3UploadMode

instance Prelude.NFData ProcessingS3Output where
  rnf :: ProcessingS3Output -> ()
rnf ProcessingS3Output' {Text
ProcessingS3UploadMode
s3UploadMode :: ProcessingS3UploadMode
localPath :: Text
s3Uri :: Text
$sel:s3UploadMode:ProcessingS3Output' :: ProcessingS3Output -> ProcessingS3UploadMode
$sel:localPath:ProcessingS3Output' :: ProcessingS3Output -> Text
$sel:s3Uri:ProcessingS3Output' :: ProcessingS3Output -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ProcessingS3UploadMode
s3UploadMode

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