{-# 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.ProcessingOutput
-- 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.ProcessingOutput 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.ProcessingFeatureStoreOutput
import Amazonka.SageMaker.Types.ProcessingS3Output

-- | Describes the results of a processing job. The processing output must
-- specify exactly one of either @S3Output@ or @FeatureStoreOutput@ types.
--
-- /See:/ 'newProcessingOutput' smart constructor.
data ProcessingOutput = ProcessingOutput'
  { -- | When @True@, output operations such as data upload are managed natively
    -- by the processing job application. When @False@ (default), output
    -- operations are managed by Amazon SageMaker.
    ProcessingOutput -> Maybe Bool
appManaged :: Prelude.Maybe Prelude.Bool,
    -- | Configuration for processing job outputs in Amazon SageMaker Feature
    -- Store. This processing output type is only supported when @AppManaged@
    -- is specified.
    ProcessingOutput -> Maybe ProcessingFeatureStoreOutput
featureStoreOutput :: Prelude.Maybe ProcessingFeatureStoreOutput,
    -- | Configuration for processing job outputs in Amazon S3.
    ProcessingOutput -> Maybe ProcessingS3Output
s3Output :: Prelude.Maybe ProcessingS3Output,
    -- | The name for the processing job output.
    ProcessingOutput -> Text
outputName :: Prelude.Text
  }
  deriving (ProcessingOutput -> ProcessingOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProcessingOutput -> ProcessingOutput -> Bool
$c/= :: ProcessingOutput -> ProcessingOutput -> Bool
== :: ProcessingOutput -> ProcessingOutput -> Bool
$c== :: ProcessingOutput -> ProcessingOutput -> Bool
Prelude.Eq, ReadPrec [ProcessingOutput]
ReadPrec ProcessingOutput
Int -> ReadS ProcessingOutput
ReadS [ProcessingOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProcessingOutput]
$creadListPrec :: ReadPrec [ProcessingOutput]
readPrec :: ReadPrec ProcessingOutput
$creadPrec :: ReadPrec ProcessingOutput
readList :: ReadS [ProcessingOutput]
$creadList :: ReadS [ProcessingOutput]
readsPrec :: Int -> ReadS ProcessingOutput
$creadsPrec :: Int -> ReadS ProcessingOutput
Prelude.Read, Int -> ProcessingOutput -> ShowS
[ProcessingOutput] -> ShowS
ProcessingOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProcessingOutput] -> ShowS
$cshowList :: [ProcessingOutput] -> ShowS
show :: ProcessingOutput -> String
$cshow :: ProcessingOutput -> String
showsPrec :: Int -> ProcessingOutput -> ShowS
$cshowsPrec :: Int -> ProcessingOutput -> ShowS
Prelude.Show, forall x. Rep ProcessingOutput x -> ProcessingOutput
forall x. ProcessingOutput -> Rep ProcessingOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProcessingOutput x -> ProcessingOutput
$cfrom :: forall x. ProcessingOutput -> Rep ProcessingOutput x
Prelude.Generic)

-- |
-- Create a value of 'ProcessingOutput' 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:
--
-- 'appManaged', 'processingOutput_appManaged' - When @True@, output operations such as data upload are managed natively
-- by the processing job application. When @False@ (default), output
-- operations are managed by Amazon SageMaker.
--
-- 'featureStoreOutput', 'processingOutput_featureStoreOutput' - Configuration for processing job outputs in Amazon SageMaker Feature
-- Store. This processing output type is only supported when @AppManaged@
-- is specified.
--
-- 's3Output', 'processingOutput_s3Output' - Configuration for processing job outputs in Amazon S3.
--
-- 'outputName', 'processingOutput_outputName' - The name for the processing job output.
newProcessingOutput ::
  -- | 'outputName'
  Prelude.Text ->
  ProcessingOutput
newProcessingOutput :: Text -> ProcessingOutput
newProcessingOutput Text
pOutputName_ =
  ProcessingOutput'
    { $sel:appManaged:ProcessingOutput' :: Maybe Bool
appManaged = forall a. Maybe a
Prelude.Nothing,
      $sel:featureStoreOutput:ProcessingOutput' :: Maybe ProcessingFeatureStoreOutput
featureStoreOutput = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Output:ProcessingOutput' :: Maybe ProcessingS3Output
s3Output = forall a. Maybe a
Prelude.Nothing,
      $sel:outputName:ProcessingOutput' :: Text
outputName = Text
pOutputName_
    }

-- | When @True@, output operations such as data upload are managed natively
-- by the processing job application. When @False@ (default), output
-- operations are managed by Amazon SageMaker.
processingOutput_appManaged :: Lens.Lens' ProcessingOutput (Prelude.Maybe Prelude.Bool)
processingOutput_appManaged :: Lens' ProcessingOutput (Maybe Bool)
processingOutput_appManaged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingOutput' {Maybe Bool
appManaged :: Maybe Bool
$sel:appManaged:ProcessingOutput' :: ProcessingOutput -> Maybe Bool
appManaged} -> Maybe Bool
appManaged) (\s :: ProcessingOutput
s@ProcessingOutput' {} Maybe Bool
a -> ProcessingOutput
s {$sel:appManaged:ProcessingOutput' :: Maybe Bool
appManaged = Maybe Bool
a} :: ProcessingOutput)

-- | Configuration for processing job outputs in Amazon SageMaker Feature
-- Store. This processing output type is only supported when @AppManaged@
-- is specified.
processingOutput_featureStoreOutput :: Lens.Lens' ProcessingOutput (Prelude.Maybe ProcessingFeatureStoreOutput)
processingOutput_featureStoreOutput :: Lens' ProcessingOutput (Maybe ProcessingFeatureStoreOutput)
processingOutput_featureStoreOutput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingOutput' {Maybe ProcessingFeatureStoreOutput
featureStoreOutput :: Maybe ProcessingFeatureStoreOutput
$sel:featureStoreOutput:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingFeatureStoreOutput
featureStoreOutput} -> Maybe ProcessingFeatureStoreOutput
featureStoreOutput) (\s :: ProcessingOutput
s@ProcessingOutput' {} Maybe ProcessingFeatureStoreOutput
a -> ProcessingOutput
s {$sel:featureStoreOutput:ProcessingOutput' :: Maybe ProcessingFeatureStoreOutput
featureStoreOutput = Maybe ProcessingFeatureStoreOutput
a} :: ProcessingOutput)

-- | Configuration for processing job outputs in Amazon S3.
processingOutput_s3Output :: Lens.Lens' ProcessingOutput (Prelude.Maybe ProcessingS3Output)
processingOutput_s3Output :: Lens' ProcessingOutput (Maybe ProcessingS3Output)
processingOutput_s3Output = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingOutput' {Maybe ProcessingS3Output
s3Output :: Maybe ProcessingS3Output
$sel:s3Output:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingS3Output
s3Output} -> Maybe ProcessingS3Output
s3Output) (\s :: ProcessingOutput
s@ProcessingOutput' {} Maybe ProcessingS3Output
a -> ProcessingOutput
s {$sel:s3Output:ProcessingOutput' :: Maybe ProcessingS3Output
s3Output = Maybe ProcessingS3Output
a} :: ProcessingOutput)

-- | The name for the processing job output.
processingOutput_outputName :: Lens.Lens' ProcessingOutput Prelude.Text
processingOutput_outputName :: Lens' ProcessingOutput Text
processingOutput_outputName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessingOutput' {Text
outputName :: Text
$sel:outputName:ProcessingOutput' :: ProcessingOutput -> Text
outputName} -> Text
outputName) (\s :: ProcessingOutput
s@ProcessingOutput' {} Text
a -> ProcessingOutput
s {$sel:outputName:ProcessingOutput' :: Text
outputName = Text
a} :: ProcessingOutput)

instance Data.FromJSON ProcessingOutput where
  parseJSON :: Value -> Parser ProcessingOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProcessingOutput"
      ( \Object
x ->
          Maybe Bool
-> Maybe ProcessingFeatureStoreOutput
-> Maybe ProcessingS3Output
-> Text
-> ProcessingOutput
ProcessingOutput'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AppManaged")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FeatureStoreOutput")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3Output")
            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
"OutputName")
      )

instance Prelude.Hashable ProcessingOutput where
  hashWithSalt :: Int -> ProcessingOutput -> Int
hashWithSalt Int
_salt ProcessingOutput' {Maybe Bool
Maybe ProcessingFeatureStoreOutput
Maybe ProcessingS3Output
Text
outputName :: Text
s3Output :: Maybe ProcessingS3Output
featureStoreOutput :: Maybe ProcessingFeatureStoreOutput
appManaged :: Maybe Bool
$sel:outputName:ProcessingOutput' :: ProcessingOutput -> Text
$sel:s3Output:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingS3Output
$sel:featureStoreOutput:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingFeatureStoreOutput
$sel:appManaged:ProcessingOutput' :: ProcessingOutput -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
appManaged
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProcessingFeatureStoreOutput
featureStoreOutput
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProcessingS3Output
s3Output
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
outputName

instance Prelude.NFData ProcessingOutput where
  rnf :: ProcessingOutput -> ()
rnf ProcessingOutput' {Maybe Bool
Maybe ProcessingFeatureStoreOutput
Maybe ProcessingS3Output
Text
outputName :: Text
s3Output :: Maybe ProcessingS3Output
featureStoreOutput :: Maybe ProcessingFeatureStoreOutput
appManaged :: Maybe Bool
$sel:outputName:ProcessingOutput' :: ProcessingOutput -> Text
$sel:s3Output:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingS3Output
$sel:featureStoreOutput:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingFeatureStoreOutput
$sel:appManaged:ProcessingOutput' :: ProcessingOutput -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
appManaged
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProcessingFeatureStoreOutput
featureStoreOutput
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProcessingS3Output
s3Output
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
outputName

instance Data.ToJSON ProcessingOutput where
  toJSON :: ProcessingOutput -> Value
toJSON ProcessingOutput' {Maybe Bool
Maybe ProcessingFeatureStoreOutput
Maybe ProcessingS3Output
Text
outputName :: Text
s3Output :: Maybe ProcessingS3Output
featureStoreOutput :: Maybe ProcessingFeatureStoreOutput
appManaged :: Maybe Bool
$sel:outputName:ProcessingOutput' :: ProcessingOutput -> Text
$sel:s3Output:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingS3Output
$sel:featureStoreOutput:ProcessingOutput' :: ProcessingOutput -> Maybe ProcessingFeatureStoreOutput
$sel:appManaged:ProcessingOutput' :: ProcessingOutput -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AppManaged" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
appManaged,
            (Key
"FeatureStoreOutput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProcessingFeatureStoreOutput
featureStoreOutput,
            (Key
"S3Output" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProcessingS3Output
s3Output,
            forall a. a -> Maybe a
Prelude.Just (Key
"OutputName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
outputName)
          ]
      )