{-# 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.BatchDataCaptureConfig
-- 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.BatchDataCaptureConfig 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

-- | Configuration to control how SageMaker captures inference data for batch
-- transform jobs.
--
-- /See:/ 'newBatchDataCaptureConfig' smart constructor.
data BatchDataCaptureConfig = BatchDataCaptureConfig'
  { -- | Flag that indicates whether to append inference id to the output.
    BatchDataCaptureConfig -> Maybe Bool
generateInferenceId :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
    -- Service key that SageMaker uses to encrypt data on the storage volume
    -- attached to the ML compute instance that hosts the batch transform job.
    --
    -- 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@
    BatchDataCaptureConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 location being used to capture the data.
    BatchDataCaptureConfig -> Text
destinationS3Uri :: Prelude.Text
  }
  deriving (BatchDataCaptureConfig -> BatchDataCaptureConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDataCaptureConfig -> BatchDataCaptureConfig -> Bool
$c/= :: BatchDataCaptureConfig -> BatchDataCaptureConfig -> Bool
== :: BatchDataCaptureConfig -> BatchDataCaptureConfig -> Bool
$c== :: BatchDataCaptureConfig -> BatchDataCaptureConfig -> Bool
Prelude.Eq, ReadPrec [BatchDataCaptureConfig]
ReadPrec BatchDataCaptureConfig
Int -> ReadS BatchDataCaptureConfig
ReadS [BatchDataCaptureConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDataCaptureConfig]
$creadListPrec :: ReadPrec [BatchDataCaptureConfig]
readPrec :: ReadPrec BatchDataCaptureConfig
$creadPrec :: ReadPrec BatchDataCaptureConfig
readList :: ReadS [BatchDataCaptureConfig]
$creadList :: ReadS [BatchDataCaptureConfig]
readsPrec :: Int -> ReadS BatchDataCaptureConfig
$creadsPrec :: Int -> ReadS BatchDataCaptureConfig
Prelude.Read, Int -> BatchDataCaptureConfig -> ShowS
[BatchDataCaptureConfig] -> ShowS
BatchDataCaptureConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDataCaptureConfig] -> ShowS
$cshowList :: [BatchDataCaptureConfig] -> ShowS
show :: BatchDataCaptureConfig -> String
$cshow :: BatchDataCaptureConfig -> String
showsPrec :: Int -> BatchDataCaptureConfig -> ShowS
$cshowsPrec :: Int -> BatchDataCaptureConfig -> ShowS
Prelude.Show, forall x. Rep BatchDataCaptureConfig x -> BatchDataCaptureConfig
forall x. BatchDataCaptureConfig -> Rep BatchDataCaptureConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDataCaptureConfig x -> BatchDataCaptureConfig
$cfrom :: forall x. BatchDataCaptureConfig -> Rep BatchDataCaptureConfig x
Prelude.Generic)

-- |
-- Create a value of 'BatchDataCaptureConfig' 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:
--
-- 'generateInferenceId', 'batchDataCaptureConfig_generateInferenceId' - Flag that indicates whether to append inference id to the output.
--
-- 'kmsKeyId', 'batchDataCaptureConfig_kmsKeyId' - The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
-- Service key that SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance that hosts the batch transform job.
--
-- 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@
--
-- 'destinationS3Uri', 'batchDataCaptureConfig_destinationS3Uri' - The Amazon S3 location being used to capture the data.
newBatchDataCaptureConfig ::
  -- | 'destinationS3Uri'
  Prelude.Text ->
  BatchDataCaptureConfig
newBatchDataCaptureConfig :: Text -> BatchDataCaptureConfig
newBatchDataCaptureConfig Text
pDestinationS3Uri_ =
  BatchDataCaptureConfig'
    { $sel:generateInferenceId:BatchDataCaptureConfig' :: Maybe Bool
generateInferenceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:BatchDataCaptureConfig' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationS3Uri:BatchDataCaptureConfig' :: Text
destinationS3Uri = Text
pDestinationS3Uri_
    }

-- | Flag that indicates whether to append inference id to the output.
batchDataCaptureConfig_generateInferenceId :: Lens.Lens' BatchDataCaptureConfig (Prelude.Maybe Prelude.Bool)
batchDataCaptureConfig_generateInferenceId :: Lens' BatchDataCaptureConfig (Maybe Bool)
batchDataCaptureConfig_generateInferenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDataCaptureConfig' {Maybe Bool
generateInferenceId :: Maybe Bool
$sel:generateInferenceId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Bool
generateInferenceId} -> Maybe Bool
generateInferenceId) (\s :: BatchDataCaptureConfig
s@BatchDataCaptureConfig' {} Maybe Bool
a -> BatchDataCaptureConfig
s {$sel:generateInferenceId:BatchDataCaptureConfig' :: Maybe Bool
generateInferenceId = Maybe Bool
a} :: BatchDataCaptureConfig)

-- | The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
-- Service key that SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance that hosts the batch transform job.
--
-- 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@
batchDataCaptureConfig_kmsKeyId :: Lens.Lens' BatchDataCaptureConfig (Prelude.Maybe Prelude.Text)
batchDataCaptureConfig_kmsKeyId :: Lens' BatchDataCaptureConfig (Maybe Text)
batchDataCaptureConfig_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDataCaptureConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: BatchDataCaptureConfig
s@BatchDataCaptureConfig' {} Maybe Text
a -> BatchDataCaptureConfig
s {$sel:kmsKeyId:BatchDataCaptureConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: BatchDataCaptureConfig)

-- | The Amazon S3 location being used to capture the data.
batchDataCaptureConfig_destinationS3Uri :: Lens.Lens' BatchDataCaptureConfig Prelude.Text
batchDataCaptureConfig_destinationS3Uri :: Lens' BatchDataCaptureConfig Text
batchDataCaptureConfig_destinationS3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDataCaptureConfig' {Text
destinationS3Uri :: Text
$sel:destinationS3Uri:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Text
destinationS3Uri} -> Text
destinationS3Uri) (\s :: BatchDataCaptureConfig
s@BatchDataCaptureConfig' {} Text
a -> BatchDataCaptureConfig
s {$sel:destinationS3Uri:BatchDataCaptureConfig' :: Text
destinationS3Uri = Text
a} :: BatchDataCaptureConfig)

instance Data.FromJSON BatchDataCaptureConfig where
  parseJSON :: Value -> Parser BatchDataCaptureConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchDataCaptureConfig"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Text -> BatchDataCaptureConfig
BatchDataCaptureConfig'
            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
"GenerateInferenceId")
            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
"KmsKeyId")
            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
"DestinationS3Uri")
      )

instance Prelude.Hashable BatchDataCaptureConfig where
  hashWithSalt :: Int -> BatchDataCaptureConfig -> Int
hashWithSalt Int
_salt BatchDataCaptureConfig' {Maybe Bool
Maybe Text
Text
destinationS3Uri :: Text
kmsKeyId :: Maybe Text
generateInferenceId :: Maybe Bool
$sel:destinationS3Uri:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Text
$sel:kmsKeyId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Text
$sel:generateInferenceId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
generateInferenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationS3Uri

instance Prelude.NFData BatchDataCaptureConfig where
  rnf :: BatchDataCaptureConfig -> ()
rnf BatchDataCaptureConfig' {Maybe Bool
Maybe Text
Text
destinationS3Uri :: Text
kmsKeyId :: Maybe Text
generateInferenceId :: Maybe Bool
$sel:destinationS3Uri:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Text
$sel:kmsKeyId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Text
$sel:generateInferenceId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
generateInferenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationS3Uri

instance Data.ToJSON BatchDataCaptureConfig where
  toJSON :: BatchDataCaptureConfig -> Value
toJSON BatchDataCaptureConfig' {Maybe Bool
Maybe Text
Text
destinationS3Uri :: Text
kmsKeyId :: Maybe Text
generateInferenceId :: Maybe Bool
$sel:destinationS3Uri:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Text
$sel:kmsKeyId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Text
$sel:generateInferenceId:BatchDataCaptureConfig' :: BatchDataCaptureConfig -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"GenerateInferenceId" 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
generateInferenceId,
            (Key
"KmsKeyId" 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 Text
kmsKeyId,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DestinationS3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationS3Uri)
          ]
      )