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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutVision.Types.S3Location
import qualified Amazonka.Prelude as Prelude

-- | The S3 location where Amazon Lookout for Vision saves model training
-- files.
--
-- /See:/ 'newOutputConfig' smart constructor.
data OutputConfig = OutputConfig'
  { -- | The S3 location for the output.
    OutputConfig -> S3Location
s3Location :: S3Location
  }
  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:
--
-- 's3Location', 'outputConfig_s3Location' - The S3 location for the output.
newOutputConfig ::
  -- | 's3Location'
  S3Location ->
  OutputConfig
newOutputConfig :: S3Location -> OutputConfig
newOutputConfig S3Location
pS3Location_ =
  OutputConfig' {$sel:s3Location:OutputConfig' :: S3Location
s3Location = S3Location
pS3Location_}

-- | The S3 location for the output.
outputConfig_s3Location :: Lens.Lens' OutputConfig S3Location
outputConfig_s3Location :: Lens' OutputConfig S3Location
outputConfig_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:OutputConfig' :: OutputConfig -> S3Location
s3Location} -> S3Location
s3Location) (\s :: OutputConfig
s@OutputConfig' {} S3Location
a -> OutputConfig
s {$sel:s3Location:OutputConfig' :: S3Location
s3Location = S3Location
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 ->
          S3Location -> OutputConfig
OutputConfig' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3Location")
      )

instance Prelude.Hashable OutputConfig where
  hashWithSalt :: Int -> OutputConfig -> Int
hashWithSalt Int
_salt OutputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:OutputConfig' :: OutputConfig -> S3Location
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3Location
s3Location

instance Prelude.NFData OutputConfig where
  rnf :: OutputConfig -> ()
rnf OutputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:OutputConfig' :: OutputConfig -> S3Location
..} = forall a. NFData a => a -> ()
Prelude.rnf S3Location
s3Location

instance Data.ToJSON OutputConfig where
  toJSON :: OutputConfig -> Value
toJSON OutputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:OutputConfig' :: OutputConfig -> S3Location
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"S3Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3Location
s3Location)]
      )