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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The output data configuration.
--
-- /See:/ 'newAutoMLOutputDataConfig' smart constructor.
data AutoMLOutputDataConfig = AutoMLOutputDataConfig'
  { -- | The Amazon Web Services KMS encryption key ID.
    AutoMLOutputDataConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 output path. Must be 128 characters or less.
    AutoMLOutputDataConfig -> Text
s3OutputPath :: Prelude.Text
  }
  deriving (AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool
(AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool)
-> (AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool)
-> Eq AutoMLOutputDataConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool
$c/= :: AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool
== :: AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool
$c== :: AutoMLOutputDataConfig -> AutoMLOutputDataConfig -> Bool
Prelude.Eq, ReadPrec [AutoMLOutputDataConfig]
ReadPrec AutoMLOutputDataConfig
Int -> ReadS AutoMLOutputDataConfig
ReadS [AutoMLOutputDataConfig]
(Int -> ReadS AutoMLOutputDataConfig)
-> ReadS [AutoMLOutputDataConfig]
-> ReadPrec AutoMLOutputDataConfig
-> ReadPrec [AutoMLOutputDataConfig]
-> Read AutoMLOutputDataConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLOutputDataConfig]
$creadListPrec :: ReadPrec [AutoMLOutputDataConfig]
readPrec :: ReadPrec AutoMLOutputDataConfig
$creadPrec :: ReadPrec AutoMLOutputDataConfig
readList :: ReadS [AutoMLOutputDataConfig]
$creadList :: ReadS [AutoMLOutputDataConfig]
readsPrec :: Int -> ReadS AutoMLOutputDataConfig
$creadsPrec :: Int -> ReadS AutoMLOutputDataConfig
Prelude.Read, Int -> AutoMLOutputDataConfig -> ShowS
[AutoMLOutputDataConfig] -> ShowS
AutoMLOutputDataConfig -> String
(Int -> AutoMLOutputDataConfig -> ShowS)
-> (AutoMLOutputDataConfig -> String)
-> ([AutoMLOutputDataConfig] -> ShowS)
-> Show AutoMLOutputDataConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLOutputDataConfig] -> ShowS
$cshowList :: [AutoMLOutputDataConfig] -> ShowS
show :: AutoMLOutputDataConfig -> String
$cshow :: AutoMLOutputDataConfig -> String
showsPrec :: Int -> AutoMLOutputDataConfig -> ShowS
$cshowsPrec :: Int -> AutoMLOutputDataConfig -> ShowS
Prelude.Show, (forall x. AutoMLOutputDataConfig -> Rep AutoMLOutputDataConfig x)
-> (forall x.
    Rep AutoMLOutputDataConfig x -> AutoMLOutputDataConfig)
-> Generic AutoMLOutputDataConfig
forall x. Rep AutoMLOutputDataConfig x -> AutoMLOutputDataConfig
forall x. AutoMLOutputDataConfig -> Rep AutoMLOutputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLOutputDataConfig x -> AutoMLOutputDataConfig
$cfrom :: forall x. AutoMLOutputDataConfig -> Rep AutoMLOutputDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLOutputDataConfig' 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:
--
-- 'kmsKeyId', 'autoMLOutputDataConfig_kmsKeyId' - The Amazon Web Services KMS encryption key ID.
--
-- 's3OutputPath', 'autoMLOutputDataConfig_s3OutputPath' - The Amazon S3 output path. Must be 128 characters or less.
newAutoMLOutputDataConfig ::
  -- | 's3OutputPath'
  Prelude.Text ->
  AutoMLOutputDataConfig
newAutoMLOutputDataConfig :: Text -> AutoMLOutputDataConfig
newAutoMLOutputDataConfig Text
pS3OutputPath_ =
  AutoMLOutputDataConfig' :: Maybe Text -> Text -> AutoMLOutputDataConfig
AutoMLOutputDataConfig'
    { $sel:kmsKeyId:AutoMLOutputDataConfig' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3OutputPath:AutoMLOutputDataConfig' :: Text
s3OutputPath = Text
pS3OutputPath_
    }

-- | The Amazon Web Services KMS encryption key ID.
autoMLOutputDataConfig_kmsKeyId :: Lens.Lens' AutoMLOutputDataConfig (Prelude.Maybe Prelude.Text)
autoMLOutputDataConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> AutoMLOutputDataConfig -> f AutoMLOutputDataConfig
autoMLOutputDataConfig_kmsKeyId = (AutoMLOutputDataConfig -> Maybe Text)
-> (AutoMLOutputDataConfig -> Maybe Text -> AutoMLOutputDataConfig)
-> Lens
     AutoMLOutputDataConfig
     AutoMLOutputDataConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLOutputDataConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:AutoMLOutputDataConfig' :: AutoMLOutputDataConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: AutoMLOutputDataConfig
s@AutoMLOutputDataConfig' {} Maybe Text
a -> AutoMLOutputDataConfig
s {$sel:kmsKeyId:AutoMLOutputDataConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: AutoMLOutputDataConfig)

-- | The Amazon S3 output path. Must be 128 characters or less.
autoMLOutputDataConfig_s3OutputPath :: Lens.Lens' AutoMLOutputDataConfig Prelude.Text
autoMLOutputDataConfig_s3OutputPath :: (Text -> f Text)
-> AutoMLOutputDataConfig -> f AutoMLOutputDataConfig
autoMLOutputDataConfig_s3OutputPath = (AutoMLOutputDataConfig -> Text)
-> (AutoMLOutputDataConfig -> Text -> AutoMLOutputDataConfig)
-> Lens AutoMLOutputDataConfig AutoMLOutputDataConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLOutputDataConfig' {Text
s3OutputPath :: Text
$sel:s3OutputPath:AutoMLOutputDataConfig' :: AutoMLOutputDataConfig -> Text
s3OutputPath} -> Text
s3OutputPath) (\s :: AutoMLOutputDataConfig
s@AutoMLOutputDataConfig' {} Text
a -> AutoMLOutputDataConfig
s {$sel:s3OutputPath:AutoMLOutputDataConfig' :: Text
s3OutputPath = Text
a} :: AutoMLOutputDataConfig)

instance Core.FromJSON AutoMLOutputDataConfig where
  parseJSON :: Value -> Parser AutoMLOutputDataConfig
parseJSON =
    String
-> (Object -> Parser AutoMLOutputDataConfig)
-> Value
-> Parser AutoMLOutputDataConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoMLOutputDataConfig"
      ( \Object
x ->
          Maybe Text -> Text -> AutoMLOutputDataConfig
AutoMLOutputDataConfig'
            (Maybe Text -> Text -> AutoMLOutputDataConfig)
-> Parser (Maybe Text) -> Parser (Text -> AutoMLOutputDataConfig)
forall (f :: * -> *) a b. Functor 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 -> AutoMLOutputDataConfig)
-> Parser Text -> Parser AutoMLOutputDataConfig
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 AutoMLOutputDataConfig

instance Prelude.NFData AutoMLOutputDataConfig

instance Core.ToJSON AutoMLOutputDataConfig where
  toJSON :: AutoMLOutputDataConfig -> Value
toJSON AutoMLOutputDataConfig' {Maybe Text
Text
s3OutputPath :: Text
kmsKeyId :: Maybe Text
$sel:s3OutputPath:AutoMLOutputDataConfig' :: AutoMLOutputDataConfig -> Text
$sel:kmsKeyId:AutoMLOutputDataConfig' :: AutoMLOutputDataConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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)
          ]
      )