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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | 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,
    -- | The name for the processing job output.
    ProcessingOutput -> Text
outputName :: Prelude.Text
  }
  deriving (ProcessingOutput -> ProcessingOutput -> Bool
(ProcessingOutput -> ProcessingOutput -> Bool)
-> (ProcessingOutput -> ProcessingOutput -> Bool)
-> Eq ProcessingOutput
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]
(Int -> ReadS ProcessingOutput)
-> ReadS [ProcessingOutput]
-> ReadPrec ProcessingOutput
-> ReadPrec [ProcessingOutput]
-> Read 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
(Int -> ProcessingOutput -> ShowS)
-> (ProcessingOutput -> String)
-> ([ProcessingOutput] -> ShowS)
-> Show ProcessingOutput
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. ProcessingOutput -> Rep ProcessingOutput x)
-> (forall x. Rep ProcessingOutput x -> ProcessingOutput)
-> Generic ProcessingOutput
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:
--
-- '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.
--
-- '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.
--
-- 'outputName', 'processingOutput_outputName' - The name for the processing job output.
newProcessingOutput ::
  -- | 'outputName'
  Prelude.Text ->
  ProcessingOutput
newProcessingOutput :: Text -> ProcessingOutput
newProcessingOutput Text
pOutputName_ =
  ProcessingOutput' :: Maybe ProcessingFeatureStoreOutput
-> Maybe ProcessingS3Output
-> Maybe Bool
-> Text
-> ProcessingOutput
ProcessingOutput'
    { $sel:featureStoreOutput:ProcessingOutput' :: Maybe ProcessingFeatureStoreOutput
featureStoreOutput =
        Maybe ProcessingFeatureStoreOutput
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Output:ProcessingOutput' :: Maybe ProcessingS3Output
s3Output = Maybe ProcessingS3Output
forall a. Maybe a
Prelude.Nothing,
      $sel:appManaged:ProcessingOutput' :: Maybe Bool
appManaged = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:outputName:ProcessingOutput' :: Text
outputName = Text
pOutputName_
    }

-- | 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 :: (Maybe ProcessingFeatureStoreOutput
 -> f (Maybe ProcessingFeatureStoreOutput))
-> ProcessingOutput -> f ProcessingOutput
processingOutput_featureStoreOutput = (ProcessingOutput -> Maybe ProcessingFeatureStoreOutput)
-> (ProcessingOutput
    -> Maybe ProcessingFeatureStoreOutput -> ProcessingOutput)
-> Lens
     ProcessingOutput
     ProcessingOutput
     (Maybe ProcessingFeatureStoreOutput)
     (Maybe ProcessingFeatureStoreOutput)
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 :: (Maybe ProcessingS3Output -> f (Maybe ProcessingS3Output))
-> ProcessingOutput -> f ProcessingOutput
processingOutput_s3Output = (ProcessingOutput -> Maybe ProcessingS3Output)
-> (ProcessingOutput
    -> Maybe ProcessingS3Output -> ProcessingOutput)
-> Lens
     ProcessingOutput
     ProcessingOutput
     (Maybe ProcessingS3Output)
     (Maybe ProcessingS3Output)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> ProcessingOutput -> f ProcessingOutput
processingOutput_appManaged = (ProcessingOutput -> Maybe Bool)
-> (ProcessingOutput -> Maybe Bool -> ProcessingOutput)
-> Lens ProcessingOutput ProcessingOutput (Maybe Bool) (Maybe Bool)
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)

-- | The name for the processing job output.
processingOutput_outputName :: Lens.Lens' ProcessingOutput Prelude.Text
processingOutput_outputName :: (Text -> f Text) -> ProcessingOutput -> f ProcessingOutput
processingOutput_outputName = (ProcessingOutput -> Text)
-> (ProcessingOutput -> Text -> ProcessingOutput)
-> Lens ProcessingOutput ProcessingOutput Text Text
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 Core.FromJSON ProcessingOutput where
  parseJSON :: Value -> Parser ProcessingOutput
parseJSON =
    String
-> (Object -> Parser ProcessingOutput)
-> Value
-> Parser ProcessingOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProcessingOutput"
      ( \Object
x ->
          Maybe ProcessingFeatureStoreOutput
-> Maybe ProcessingS3Output
-> Maybe Bool
-> Text
-> ProcessingOutput
ProcessingOutput'
            (Maybe ProcessingFeatureStoreOutput
 -> Maybe ProcessingS3Output
 -> Maybe Bool
 -> Text
 -> ProcessingOutput)
-> Parser (Maybe ProcessingFeatureStoreOutput)
-> Parser
     (Maybe ProcessingS3Output
      -> Maybe Bool -> Text -> ProcessingOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProcessingFeatureStoreOutput)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FeatureStoreOutput")
            Parser
  (Maybe ProcessingS3Output
   -> Maybe Bool -> Text -> ProcessingOutput)
-> Parser (Maybe ProcessingS3Output)
-> Parser (Maybe Bool -> Text -> ProcessingOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProcessingS3Output)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Output")
            Parser (Maybe Bool -> Text -> ProcessingOutput)
-> Parser (Maybe Bool) -> Parser (Text -> ProcessingOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AppManaged")
            Parser (Text -> ProcessingOutput)
-> Parser Text -> Parser ProcessingOutput
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
"OutputName")
      )

instance Prelude.Hashable ProcessingOutput

instance Prelude.NFData ProcessingOutput

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