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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(OutputConfig -> OutputConfig -> Bool)
-> (OutputConfig -> OutputConfig -> Bool) -> Eq OutputConfig
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]
(Int -> ReadS OutputConfig)
-> ReadS [OutputConfig]
-> ReadPrec OutputConfig
-> ReadPrec [OutputConfig]
-> Read 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
(Int -> OutputConfig -> ShowS)
-> (OutputConfig -> String)
-> ([OutputConfig] -> ShowS)
-> Show OutputConfig
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. OutputConfig -> Rep OutputConfig x)
-> (forall x. Rep OutputConfig x -> OutputConfig)
-> Generic OutputConfig
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' :: S3Location -> OutputConfig
OutputConfig' {$sel:s3Location:OutputConfig' :: S3Location
s3Location = S3Location
pS3Location_}

-- | The S3 location for the output.
outputConfig_s3Location :: Lens.Lens' OutputConfig S3Location
outputConfig_s3Location :: (S3Location -> f S3Location) -> OutputConfig -> f OutputConfig
outputConfig_s3Location = (OutputConfig -> S3Location)
-> (OutputConfig -> S3Location -> OutputConfig)
-> Lens OutputConfig OutputConfig S3Location 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 Core.FromJSON OutputConfig where
  parseJSON :: Value -> Parser OutputConfig
parseJSON =
    String
-> (Object -> Parser OutputConfig) -> Value -> Parser OutputConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputConfig"
      ( \Object
x ->
          S3Location -> OutputConfig
OutputConfig' (S3Location -> OutputConfig)
-> Parser S3Location -> Parser OutputConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser S3Location
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Location")
      )

instance Prelude.Hashable OutputConfig

instance Prelude.NFData OutputConfig

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