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

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

-- | Contains information about where human output will be stored.
--
-- /See:/ 'newFlowDefinitionOutputConfig' smart constructor.
data FlowDefinitionOutputConfig = FlowDefinitionOutputConfig'
  { -- | The Amazon Key Management Service (KMS) key ID for server-side
    -- encryption.
    FlowDefinitionOutputConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 path where the object containing human output will be made
    -- available.
    --
    -- To learn more about the format of Amazon A2I output data, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-output-data.html Amazon A2I Output Data>.
    FlowDefinitionOutputConfig -> Text
s3OutputPath :: Prelude.Text
  }
  deriving (FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool
(FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool)
-> (FlowDefinitionOutputConfig
    -> FlowDefinitionOutputConfig -> Bool)
-> Eq FlowDefinitionOutputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool
$c/= :: FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool
== :: FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool
$c== :: FlowDefinitionOutputConfig -> FlowDefinitionOutputConfig -> Bool
Prelude.Eq, ReadPrec [FlowDefinitionOutputConfig]
ReadPrec FlowDefinitionOutputConfig
Int -> ReadS FlowDefinitionOutputConfig
ReadS [FlowDefinitionOutputConfig]
(Int -> ReadS FlowDefinitionOutputConfig)
-> ReadS [FlowDefinitionOutputConfig]
-> ReadPrec FlowDefinitionOutputConfig
-> ReadPrec [FlowDefinitionOutputConfig]
-> Read FlowDefinitionOutputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowDefinitionOutputConfig]
$creadListPrec :: ReadPrec [FlowDefinitionOutputConfig]
readPrec :: ReadPrec FlowDefinitionOutputConfig
$creadPrec :: ReadPrec FlowDefinitionOutputConfig
readList :: ReadS [FlowDefinitionOutputConfig]
$creadList :: ReadS [FlowDefinitionOutputConfig]
readsPrec :: Int -> ReadS FlowDefinitionOutputConfig
$creadsPrec :: Int -> ReadS FlowDefinitionOutputConfig
Prelude.Read, Int -> FlowDefinitionOutputConfig -> ShowS
[FlowDefinitionOutputConfig] -> ShowS
FlowDefinitionOutputConfig -> String
(Int -> FlowDefinitionOutputConfig -> ShowS)
-> (FlowDefinitionOutputConfig -> String)
-> ([FlowDefinitionOutputConfig] -> ShowS)
-> Show FlowDefinitionOutputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowDefinitionOutputConfig] -> ShowS
$cshowList :: [FlowDefinitionOutputConfig] -> ShowS
show :: FlowDefinitionOutputConfig -> String
$cshow :: FlowDefinitionOutputConfig -> String
showsPrec :: Int -> FlowDefinitionOutputConfig -> ShowS
$cshowsPrec :: Int -> FlowDefinitionOutputConfig -> ShowS
Prelude.Show, (forall x.
 FlowDefinitionOutputConfig -> Rep FlowDefinitionOutputConfig x)
-> (forall x.
    Rep FlowDefinitionOutputConfig x -> FlowDefinitionOutputConfig)
-> Generic FlowDefinitionOutputConfig
forall x.
Rep FlowDefinitionOutputConfig x -> FlowDefinitionOutputConfig
forall x.
FlowDefinitionOutputConfig -> Rep FlowDefinitionOutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FlowDefinitionOutputConfig x -> FlowDefinitionOutputConfig
$cfrom :: forall x.
FlowDefinitionOutputConfig -> Rep FlowDefinitionOutputConfig x
Prelude.Generic)

-- |
-- Create a value of 'FlowDefinitionOutputConfig' 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', 'flowDefinitionOutputConfig_kmsKeyId' - The Amazon Key Management Service (KMS) key ID for server-side
-- encryption.
--
-- 's3OutputPath', 'flowDefinitionOutputConfig_s3OutputPath' - The Amazon S3 path where the object containing human output will be made
-- available.
--
-- To learn more about the format of Amazon A2I output data, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-output-data.html Amazon A2I Output Data>.
newFlowDefinitionOutputConfig ::
  -- | 's3OutputPath'
  Prelude.Text ->
  FlowDefinitionOutputConfig
newFlowDefinitionOutputConfig :: Text -> FlowDefinitionOutputConfig
newFlowDefinitionOutputConfig Text
pS3OutputPath_ =
  FlowDefinitionOutputConfig' :: Maybe Text -> Text -> FlowDefinitionOutputConfig
FlowDefinitionOutputConfig'
    { $sel:kmsKeyId:FlowDefinitionOutputConfig' :: Maybe Text
kmsKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3OutputPath:FlowDefinitionOutputConfig' :: Text
s3OutputPath = Text
pS3OutputPath_
    }

-- | The Amazon Key Management Service (KMS) key ID for server-side
-- encryption.
flowDefinitionOutputConfig_kmsKeyId :: Lens.Lens' FlowDefinitionOutputConfig (Prelude.Maybe Prelude.Text)
flowDefinitionOutputConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> FlowDefinitionOutputConfig -> f FlowDefinitionOutputConfig
flowDefinitionOutputConfig_kmsKeyId = (FlowDefinitionOutputConfig -> Maybe Text)
-> (FlowDefinitionOutputConfig
    -> Maybe Text -> FlowDefinitionOutputConfig)
-> Lens
     FlowDefinitionOutputConfig
     FlowDefinitionOutputConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionOutputConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:FlowDefinitionOutputConfig' :: FlowDefinitionOutputConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: FlowDefinitionOutputConfig
s@FlowDefinitionOutputConfig' {} Maybe Text
a -> FlowDefinitionOutputConfig
s {$sel:kmsKeyId:FlowDefinitionOutputConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: FlowDefinitionOutputConfig)

-- | The Amazon S3 path where the object containing human output will be made
-- available.
--
-- To learn more about the format of Amazon A2I output data, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-output-data.html Amazon A2I Output Data>.
flowDefinitionOutputConfig_s3OutputPath :: Lens.Lens' FlowDefinitionOutputConfig Prelude.Text
flowDefinitionOutputConfig_s3OutputPath :: (Text -> f Text)
-> FlowDefinitionOutputConfig -> f FlowDefinitionOutputConfig
flowDefinitionOutputConfig_s3OutputPath = (FlowDefinitionOutputConfig -> Text)
-> (FlowDefinitionOutputConfig
    -> Text -> FlowDefinitionOutputConfig)
-> Lens
     FlowDefinitionOutputConfig FlowDefinitionOutputConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionOutputConfig' {Text
s3OutputPath :: Text
$sel:s3OutputPath:FlowDefinitionOutputConfig' :: FlowDefinitionOutputConfig -> Text
s3OutputPath} -> Text
s3OutputPath) (\s :: FlowDefinitionOutputConfig
s@FlowDefinitionOutputConfig' {} Text
a -> FlowDefinitionOutputConfig
s {$sel:s3OutputPath:FlowDefinitionOutputConfig' :: Text
s3OutputPath = Text
a} :: FlowDefinitionOutputConfig)

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

instance Prelude.NFData FlowDefinitionOutputConfig

instance Core.ToJSON FlowDefinitionOutputConfig where
  toJSON :: FlowDefinitionOutputConfig -> Value
toJSON FlowDefinitionOutputConfig' {Maybe Text
Text
s3OutputPath :: Text
kmsKeyId :: Maybe Text
$sel:s3OutputPath:FlowDefinitionOutputConfig' :: FlowDefinitionOutputConfig -> Text
$sel:kmsKeyId:FlowDefinitionOutputConfig' :: FlowDefinitionOutputConfig -> 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)
          ]
      )