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

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

-- | Describes the results of a transform job.
--
-- /See:/ 'newTransformOutput' smart constructor.
data TransformOutput = TransformOutput'
  { -- | Defines how to assemble the results of the transform job as a single S3
    -- object. Choose a format that is most convenient to you. To concatenate
    -- the results in binary format, specify @None@. To add a newline character
    -- at the end of every transformed record, specify @Line@.
    TransformOutput -> Maybe AssemblyType
assembleWith :: Prelude.Maybe AssemblyType,
    -- | The MIME type used to specify the output data. Amazon SageMaker uses the
    -- MIME type with each http call to transfer data from the transform job.
    TransformOutput -> Maybe Text
accept :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
    -- key that Amazon SageMaker uses to encrypt the model artifacts at rest
    -- using Amazon S3 server-side encryption. The @KmsKeyId@ can be any of the
    -- following formats:
    --
    -- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Key ARN:
    --     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Alias name: @alias\/ExampleAlias@
    --
    -- -   Alias name ARN:
    --     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
    --
    -- If you don\'t provide a KMS key ID, Amazon SageMaker uses the default
    -- KMS key for Amazon S3 for your role\'s account. For more information,
    -- see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html KMS-Managed Encryption Keys>
    -- in the /Amazon Simple Storage Service Developer Guide./
    --
    -- The KMS key policy must grant permission to the IAM role that you
    -- specify in your CreateModel request. For more information, see
    -- <http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
    -- in the /Amazon Web Services Key Management Service Developer Guide/.
    TransformOutput -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 path where you want Amazon SageMaker to store the results
    -- of the transform job. For example,
    -- @s3:\/\/bucket-name\/key-name-prefix@.
    --
    -- For every S3 object used as input for the transform job, batch transform
    -- stores the transformed data with an .@out@ suffix in a corresponding
    -- subfolder in the location in the output prefix. For example, for the
    -- input data stored at
    -- @s3:\/\/bucket-name\/input-name-prefix\/dataset01\/data.csv@, batch
    -- transform stores the transformed data at
    -- @s3:\/\/bucket-name\/output-name-prefix\/input-name-prefix\/data.csv.out@.
    -- Batch transform doesn\'t upload partially processed objects. For an
    -- input S3 object that contains multiple records, it creates an .@out@
    -- file only if the transform job succeeds on the entire file. When the
    -- input contains multiple S3 objects, the batch transform job processes
    -- the listed S3 objects and uploads only the output for successfully
    -- processed objects. If any object fails in the transform job batch
    -- transform marks the job as failed to prompt investigation.
    TransformOutput -> Text
s3OutputPath :: Prelude.Text
  }
  deriving (TransformOutput -> TransformOutput -> Bool
(TransformOutput -> TransformOutput -> Bool)
-> (TransformOutput -> TransformOutput -> Bool)
-> Eq TransformOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransformOutput -> TransformOutput -> Bool
$c/= :: TransformOutput -> TransformOutput -> Bool
== :: TransformOutput -> TransformOutput -> Bool
$c== :: TransformOutput -> TransformOutput -> Bool
Prelude.Eq, ReadPrec [TransformOutput]
ReadPrec TransformOutput
Int -> ReadS TransformOutput
ReadS [TransformOutput]
(Int -> ReadS TransformOutput)
-> ReadS [TransformOutput]
-> ReadPrec TransformOutput
-> ReadPrec [TransformOutput]
-> Read TransformOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransformOutput]
$creadListPrec :: ReadPrec [TransformOutput]
readPrec :: ReadPrec TransformOutput
$creadPrec :: ReadPrec TransformOutput
readList :: ReadS [TransformOutput]
$creadList :: ReadS [TransformOutput]
readsPrec :: Int -> ReadS TransformOutput
$creadsPrec :: Int -> ReadS TransformOutput
Prelude.Read, Int -> TransformOutput -> ShowS
[TransformOutput] -> ShowS
TransformOutput -> String
(Int -> TransformOutput -> ShowS)
-> (TransformOutput -> String)
-> ([TransformOutput] -> ShowS)
-> Show TransformOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransformOutput] -> ShowS
$cshowList :: [TransformOutput] -> ShowS
show :: TransformOutput -> String
$cshow :: TransformOutput -> String
showsPrec :: Int -> TransformOutput -> ShowS
$cshowsPrec :: Int -> TransformOutput -> ShowS
Prelude.Show, (forall x. TransformOutput -> Rep TransformOutput x)
-> (forall x. Rep TransformOutput x -> TransformOutput)
-> Generic TransformOutput
forall x. Rep TransformOutput x -> TransformOutput
forall x. TransformOutput -> Rep TransformOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransformOutput x -> TransformOutput
$cfrom :: forall x. TransformOutput -> Rep TransformOutput x
Prelude.Generic)

-- |
-- Create a value of 'TransformOutput' 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:
--
-- 'assembleWith', 'transformOutput_assembleWith' - Defines how to assemble the results of the transform job as a single S3
-- object. Choose a format that is most convenient to you. To concatenate
-- the results in binary format, specify @None@. To add a newline character
-- at the end of every transformed record, specify @Line@.
--
-- 'accept', 'transformOutput_accept' - The MIME type used to specify the output data. Amazon SageMaker uses the
-- MIME type with each http call to transfer data from the transform job.
--
-- 'kmsKeyId', 'transformOutput_kmsKeyId' - The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt the model artifacts at rest
-- using Amazon S3 server-side encryption. The @KmsKeyId@ can be any of the
-- following formats:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias name ARN:
--     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
--
-- If you don\'t provide a KMS key ID, Amazon SageMaker uses the default
-- KMS key for Amazon S3 for your role\'s account. For more information,
-- see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html KMS-Managed Encryption Keys>
-- in the /Amazon Simple Storage Service Developer Guide./
--
-- The KMS key policy must grant permission to the IAM role that you
-- specify in your CreateModel request. For more information, see
-- <http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
-- in the /Amazon Web Services Key Management Service Developer Guide/.
--
-- 's3OutputPath', 'transformOutput_s3OutputPath' - The Amazon S3 path where you want Amazon SageMaker to store the results
-- of the transform job. For example,
-- @s3:\/\/bucket-name\/key-name-prefix@.
--
-- For every S3 object used as input for the transform job, batch transform
-- stores the transformed data with an .@out@ suffix in a corresponding
-- subfolder in the location in the output prefix. For example, for the
-- input data stored at
-- @s3:\/\/bucket-name\/input-name-prefix\/dataset01\/data.csv@, batch
-- transform stores the transformed data at
-- @s3:\/\/bucket-name\/output-name-prefix\/input-name-prefix\/data.csv.out@.
-- Batch transform doesn\'t upload partially processed objects. For an
-- input S3 object that contains multiple records, it creates an .@out@
-- file only if the transform job succeeds on the entire file. When the
-- input contains multiple S3 objects, the batch transform job processes
-- the listed S3 objects and uploads only the output for successfully
-- processed objects. If any object fails in the transform job batch
-- transform marks the job as failed to prompt investigation.
newTransformOutput ::
  -- | 's3OutputPath'
  Prelude.Text ->
  TransformOutput
newTransformOutput :: Text -> TransformOutput
newTransformOutput Text
pS3OutputPath_ =
  TransformOutput' :: Maybe AssemblyType
-> Maybe Text -> Maybe Text -> Text -> TransformOutput
TransformOutput'
    { $sel:assembleWith:TransformOutput' :: Maybe AssemblyType
assembleWith = Maybe AssemblyType
forall a. Maybe a
Prelude.Nothing,
      $sel:accept:TransformOutput' :: Maybe Text
accept = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:TransformOutput' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3OutputPath:TransformOutput' :: Text
s3OutputPath = Text
pS3OutputPath_
    }

-- | Defines how to assemble the results of the transform job as a single S3
-- object. Choose a format that is most convenient to you. To concatenate
-- the results in binary format, specify @None@. To add a newline character
-- at the end of every transformed record, specify @Line@.
transformOutput_assembleWith :: Lens.Lens' TransformOutput (Prelude.Maybe AssemblyType)
transformOutput_assembleWith :: (Maybe AssemblyType -> f (Maybe AssemblyType))
-> TransformOutput -> f TransformOutput
transformOutput_assembleWith = (TransformOutput -> Maybe AssemblyType)
-> (TransformOutput -> Maybe AssemblyType -> TransformOutput)
-> Lens
     TransformOutput
     TransformOutput
     (Maybe AssemblyType)
     (Maybe AssemblyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformOutput' {Maybe AssemblyType
assembleWith :: Maybe AssemblyType
$sel:assembleWith:TransformOutput' :: TransformOutput -> Maybe AssemblyType
assembleWith} -> Maybe AssemblyType
assembleWith) (\s :: TransformOutput
s@TransformOutput' {} Maybe AssemblyType
a -> TransformOutput
s {$sel:assembleWith:TransformOutput' :: Maybe AssemblyType
assembleWith = Maybe AssemblyType
a} :: TransformOutput)

-- | The MIME type used to specify the output data. Amazon SageMaker uses the
-- MIME type with each http call to transfer data from the transform job.
transformOutput_accept :: Lens.Lens' TransformOutput (Prelude.Maybe Prelude.Text)
transformOutput_accept :: (Maybe Text -> f (Maybe Text))
-> TransformOutput -> f TransformOutput
transformOutput_accept = (TransformOutput -> Maybe Text)
-> (TransformOutput -> Maybe Text -> TransformOutput)
-> Lens TransformOutput TransformOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformOutput' {Maybe Text
accept :: Maybe Text
$sel:accept:TransformOutput' :: TransformOutput -> Maybe Text
accept} -> Maybe Text
accept) (\s :: TransformOutput
s@TransformOutput' {} Maybe Text
a -> TransformOutput
s {$sel:accept:TransformOutput' :: Maybe Text
accept = Maybe Text
a} :: TransformOutput)

-- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt the model artifacts at rest
-- using Amazon S3 server-side encryption. The @KmsKeyId@ can be any of the
-- following formats:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias name ARN:
--     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
--
-- If you don\'t provide a KMS key ID, Amazon SageMaker uses the default
-- KMS key for Amazon S3 for your role\'s account. For more information,
-- see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html KMS-Managed Encryption Keys>
-- in the /Amazon Simple Storage Service Developer Guide./
--
-- The KMS key policy must grant permission to the IAM role that you
-- specify in your CreateModel request. For more information, see
-- <http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
-- in the /Amazon Web Services Key Management Service Developer Guide/.
transformOutput_kmsKeyId :: Lens.Lens' TransformOutput (Prelude.Maybe Prelude.Text)
transformOutput_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> TransformOutput -> f TransformOutput
transformOutput_kmsKeyId = (TransformOutput -> Maybe Text)
-> (TransformOutput -> Maybe Text -> TransformOutput)
-> Lens TransformOutput TransformOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformOutput' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:TransformOutput' :: TransformOutput -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: TransformOutput
s@TransformOutput' {} Maybe Text
a -> TransformOutput
s {$sel:kmsKeyId:TransformOutput' :: Maybe Text
kmsKeyId = Maybe Text
a} :: TransformOutput)

-- | The Amazon S3 path where you want Amazon SageMaker to store the results
-- of the transform job. For example,
-- @s3:\/\/bucket-name\/key-name-prefix@.
--
-- For every S3 object used as input for the transform job, batch transform
-- stores the transformed data with an .@out@ suffix in a corresponding
-- subfolder in the location in the output prefix. For example, for the
-- input data stored at
-- @s3:\/\/bucket-name\/input-name-prefix\/dataset01\/data.csv@, batch
-- transform stores the transformed data at
-- @s3:\/\/bucket-name\/output-name-prefix\/input-name-prefix\/data.csv.out@.
-- Batch transform doesn\'t upload partially processed objects. For an
-- input S3 object that contains multiple records, it creates an .@out@
-- file only if the transform job succeeds on the entire file. When the
-- input contains multiple S3 objects, the batch transform job processes
-- the listed S3 objects and uploads only the output for successfully
-- processed objects. If any object fails in the transform job batch
-- transform marks the job as failed to prompt investigation.
transformOutput_s3OutputPath :: Lens.Lens' TransformOutput Prelude.Text
transformOutput_s3OutputPath :: (Text -> f Text) -> TransformOutput -> f TransformOutput
transformOutput_s3OutputPath = (TransformOutput -> Text)
-> (TransformOutput -> Text -> TransformOutput)
-> Lens TransformOutput TransformOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransformOutput' {Text
s3OutputPath :: Text
$sel:s3OutputPath:TransformOutput' :: TransformOutput -> Text
s3OutputPath} -> Text
s3OutputPath) (\s :: TransformOutput
s@TransformOutput' {} Text
a -> TransformOutput
s {$sel:s3OutputPath:TransformOutput' :: Text
s3OutputPath = Text
a} :: TransformOutput)

instance Core.FromJSON TransformOutput where
  parseJSON :: Value -> Parser TransformOutput
parseJSON =
    String
-> (Object -> Parser TransformOutput)
-> Value
-> Parser TransformOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TransformOutput"
      ( \Object
x ->
          Maybe AssemblyType
-> Maybe Text -> Maybe Text -> Text -> TransformOutput
TransformOutput'
            (Maybe AssemblyType
 -> Maybe Text -> Maybe Text -> Text -> TransformOutput)
-> Parser (Maybe AssemblyType)
-> Parser (Maybe Text -> Maybe Text -> Text -> TransformOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AssemblyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssembleWith")
            Parser (Maybe Text -> Maybe Text -> Text -> TransformOutput)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> TransformOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Accept")
            Parser (Maybe Text -> Text -> TransformOutput)
-> Parser (Maybe Text) -> Parser (Text -> TransformOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsKeyId")
            Parser (Text -> TransformOutput)
-> Parser Text -> Parser TransformOutput
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
"S3OutputPath")
      )

instance Prelude.Hashable TransformOutput

instance Prelude.NFData TransformOutput

instance Core.ToJSON TransformOutput where
  toJSON :: TransformOutput -> Value
toJSON TransformOutput' {Maybe Text
Maybe AssemblyType
Text
s3OutputPath :: Text
kmsKeyId :: Maybe Text
accept :: Maybe Text
assembleWith :: Maybe AssemblyType
$sel:s3OutputPath:TransformOutput' :: TransformOutput -> Text
$sel:kmsKeyId:TransformOutput' :: TransformOutput -> Maybe Text
$sel:accept:TransformOutput' :: TransformOutput -> Maybe Text
$sel:assembleWith:TransformOutput' :: TransformOutput -> Maybe AssemblyType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AssembleWith" Text -> AssemblyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AssemblyType -> Pair) -> Maybe AssemblyType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssemblyType
assembleWith,
            (Text
"Accept" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accept,
            (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3OutputPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3OutputPath)
          ]
      )