{-# 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.Rekognition.Types.OutputConfig
-- 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.Rekognition.Types.OutputConfig 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

-- | The S3 bucket and folder location where training output is placed.
--
-- /See:/ 'newOutputConfig' smart constructor.
data OutputConfig = OutputConfig'
  { -- | The S3 bucket where training output is placed.
    OutputConfig -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The prefix applied to the training output files.
    OutputConfig -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputConfig -> OutputConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputConfig -> OutputConfig -> Bool
$c/= :: OutputConfig -> OutputConfig -> Bool
== :: OutputConfig -> OutputConfig -> Bool
$c== :: OutputConfig -> OutputConfig -> Bool
Prelude.Eq, ReadPrec [OutputConfig]
ReadPrec OutputConfig
Int -> ReadS OutputConfig
ReadS [OutputConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputConfig]
$creadListPrec :: ReadPrec [OutputConfig]
readPrec :: ReadPrec OutputConfig
$creadPrec :: ReadPrec OutputConfig
readList :: ReadS [OutputConfig]
$creadList :: ReadS [OutputConfig]
readsPrec :: Int -> ReadS OutputConfig
$creadsPrec :: Int -> ReadS OutputConfig
Prelude.Read, Int -> OutputConfig -> ShowS
[OutputConfig] -> ShowS
OutputConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputConfig] -> ShowS
$cshowList :: [OutputConfig] -> ShowS
show :: OutputConfig -> String
$cshow :: OutputConfig -> String
showsPrec :: Int -> OutputConfig -> ShowS
$cshowsPrec :: Int -> OutputConfig -> ShowS
Prelude.Show, forall x. Rep OutputConfig x -> OutputConfig
forall x. OutputConfig -> Rep OutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputConfig x -> OutputConfig
$cfrom :: forall x. OutputConfig -> Rep OutputConfig x
Prelude.Generic)

-- |
-- Create a value of 'OutputConfig' 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:
--
-- 's3Bucket', 'outputConfig_s3Bucket' - The S3 bucket where training output is placed.
--
-- 's3KeyPrefix', 'outputConfig_s3KeyPrefix' - The prefix applied to the training output files.
newOutputConfig ::
  OutputConfig
newOutputConfig :: OutputConfig
newOutputConfig =
  OutputConfig'
    { $sel:s3Bucket:OutputConfig' :: Maybe Text
s3Bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:OutputConfig' :: Maybe Text
s3KeyPrefix = forall a. Maybe a
Prelude.Nothing
    }

-- | The S3 bucket where training output is placed.
outputConfig_s3Bucket :: Lens.Lens' OutputConfig (Prelude.Maybe Prelude.Text)
outputConfig_s3Bucket :: Lens' OutputConfig (Maybe Text)
outputConfig_s3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputConfig' {Maybe Text
s3Bucket :: Maybe Text
$sel:s3Bucket:OutputConfig' :: OutputConfig -> Maybe Text
s3Bucket} -> Maybe Text
s3Bucket) (\s :: OutputConfig
s@OutputConfig' {} Maybe Text
a -> OutputConfig
s {$sel:s3Bucket:OutputConfig' :: Maybe Text
s3Bucket = Maybe Text
a} :: OutputConfig)

-- | The prefix applied to the training output files.
outputConfig_s3KeyPrefix :: Lens.Lens' OutputConfig (Prelude.Maybe Prelude.Text)
outputConfig_s3KeyPrefix :: Lens' OutputConfig (Maybe Text)
outputConfig_s3KeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputConfig' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:OutputConfig' :: OutputConfig -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: OutputConfig
s@OutputConfig' {} Maybe Text
a -> OutputConfig
s {$sel:s3KeyPrefix:OutputConfig' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: OutputConfig)

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

instance Prelude.Hashable OutputConfig where
  hashWithSalt :: Int -> OutputConfig -> Int
hashWithSalt Int
_salt OutputConfig' {Maybe Text
s3KeyPrefix :: Maybe Text
s3Bucket :: Maybe Text
$sel:s3KeyPrefix:OutputConfig' :: OutputConfig -> Maybe Text
$sel:s3Bucket:OutputConfig' :: OutputConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3KeyPrefix

instance Prelude.NFData OutputConfig where
  rnf :: OutputConfig -> ()
rnf OutputConfig' {Maybe Text
s3KeyPrefix :: Maybe Text
s3Bucket :: Maybe Text
$sel:s3KeyPrefix:OutputConfig' :: OutputConfig -> Maybe Text
$sel:s3Bucket:OutputConfig' :: OutputConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3KeyPrefix

instance Data.ToJSON OutputConfig where
  toJSON :: OutputConfig -> Value
toJSON OutputConfig' {Maybe Text
s3KeyPrefix :: Maybe Text
s3Bucket :: Maybe Text
$sel:s3KeyPrefix:OutputConfig' :: OutputConfig -> Maybe Text
$sel:s3Bucket:OutputConfig' :: OutputConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3Bucket" 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
s3Bucket,
            (Key
"S3KeyPrefix" 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
s3KeyPrefix
          ]
      )