{-# 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.Personalize.Types.BatchInferenceJobInput
-- 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.Personalize.Types.BatchInferenceJobInput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types.S3DataConfig
import qualified Amazonka.Prelude as Prelude

-- | The input configuration of a batch inference job.
--
-- /See:/ 'newBatchInferenceJobInput' smart constructor.
data BatchInferenceJobInput = BatchInferenceJobInput'
  { -- | The URI of the Amazon S3 location that contains your input data. The
    -- Amazon S3 bucket must be in the same region as the API endpoint you are
    -- calling.
    BatchInferenceJobInput -> S3DataConfig
s3DataSource :: S3DataConfig
  }
  deriving (BatchInferenceJobInput -> BatchInferenceJobInput -> Bool
(BatchInferenceJobInput -> BatchInferenceJobInput -> Bool)
-> (BatchInferenceJobInput -> BatchInferenceJobInput -> Bool)
-> Eq BatchInferenceJobInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchInferenceJobInput -> BatchInferenceJobInput -> Bool
$c/= :: BatchInferenceJobInput -> BatchInferenceJobInput -> Bool
== :: BatchInferenceJobInput -> BatchInferenceJobInput -> Bool
$c== :: BatchInferenceJobInput -> BatchInferenceJobInput -> Bool
Prelude.Eq, ReadPrec [BatchInferenceJobInput]
ReadPrec BatchInferenceJobInput
Int -> ReadS BatchInferenceJobInput
ReadS [BatchInferenceJobInput]
(Int -> ReadS BatchInferenceJobInput)
-> ReadS [BatchInferenceJobInput]
-> ReadPrec BatchInferenceJobInput
-> ReadPrec [BatchInferenceJobInput]
-> Read BatchInferenceJobInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchInferenceJobInput]
$creadListPrec :: ReadPrec [BatchInferenceJobInput]
readPrec :: ReadPrec BatchInferenceJobInput
$creadPrec :: ReadPrec BatchInferenceJobInput
readList :: ReadS [BatchInferenceJobInput]
$creadList :: ReadS [BatchInferenceJobInput]
readsPrec :: Int -> ReadS BatchInferenceJobInput
$creadsPrec :: Int -> ReadS BatchInferenceJobInput
Prelude.Read, Int -> BatchInferenceJobInput -> ShowS
[BatchInferenceJobInput] -> ShowS
BatchInferenceJobInput -> String
(Int -> BatchInferenceJobInput -> ShowS)
-> (BatchInferenceJobInput -> String)
-> ([BatchInferenceJobInput] -> ShowS)
-> Show BatchInferenceJobInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchInferenceJobInput] -> ShowS
$cshowList :: [BatchInferenceJobInput] -> ShowS
show :: BatchInferenceJobInput -> String
$cshow :: BatchInferenceJobInput -> String
showsPrec :: Int -> BatchInferenceJobInput -> ShowS
$cshowsPrec :: Int -> BatchInferenceJobInput -> ShowS
Prelude.Show, (forall x. BatchInferenceJobInput -> Rep BatchInferenceJobInput x)
-> (forall x.
    Rep BatchInferenceJobInput x -> BatchInferenceJobInput)
-> Generic BatchInferenceJobInput
forall x. Rep BatchInferenceJobInput x -> BatchInferenceJobInput
forall x. BatchInferenceJobInput -> Rep BatchInferenceJobInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchInferenceJobInput x -> BatchInferenceJobInput
$cfrom :: forall x. BatchInferenceJobInput -> Rep BatchInferenceJobInput x
Prelude.Generic)

-- |
-- Create a value of 'BatchInferenceJobInput' 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:
--
-- 's3DataSource', 'batchInferenceJobInput_s3DataSource' - The URI of the Amazon S3 location that contains your input data. The
-- Amazon S3 bucket must be in the same region as the API endpoint you are
-- calling.
newBatchInferenceJobInput ::
  -- | 's3DataSource'
  S3DataConfig ->
  BatchInferenceJobInput
newBatchInferenceJobInput :: S3DataConfig -> BatchInferenceJobInput
newBatchInferenceJobInput S3DataConfig
pS3DataSource_ =
  BatchInferenceJobInput' :: S3DataConfig -> BatchInferenceJobInput
BatchInferenceJobInput'
    { $sel:s3DataSource:BatchInferenceJobInput' :: S3DataConfig
s3DataSource =
        S3DataConfig
pS3DataSource_
    }

-- | The URI of the Amazon S3 location that contains your input data. The
-- Amazon S3 bucket must be in the same region as the API endpoint you are
-- calling.
batchInferenceJobInput_s3DataSource :: Lens.Lens' BatchInferenceJobInput S3DataConfig
batchInferenceJobInput_s3DataSource :: (S3DataConfig -> f S3DataConfig)
-> BatchInferenceJobInput -> f BatchInferenceJobInput
batchInferenceJobInput_s3DataSource = (BatchInferenceJobInput -> S3DataConfig)
-> (BatchInferenceJobInput
    -> S3DataConfig -> BatchInferenceJobInput)
-> Lens
     BatchInferenceJobInput
     BatchInferenceJobInput
     S3DataConfig
     S3DataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchInferenceJobInput' {S3DataConfig
s3DataSource :: S3DataConfig
$sel:s3DataSource:BatchInferenceJobInput' :: BatchInferenceJobInput -> S3DataConfig
s3DataSource} -> S3DataConfig
s3DataSource) (\s :: BatchInferenceJobInput
s@BatchInferenceJobInput' {} S3DataConfig
a -> BatchInferenceJobInput
s {$sel:s3DataSource:BatchInferenceJobInput' :: S3DataConfig
s3DataSource = S3DataConfig
a} :: BatchInferenceJobInput)

instance Core.FromJSON BatchInferenceJobInput where
  parseJSON :: Value -> Parser BatchInferenceJobInput
parseJSON =
    String
-> (Object -> Parser BatchInferenceJobInput)
-> Value
-> Parser BatchInferenceJobInput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchInferenceJobInput"
      ( \Object
x ->
          S3DataConfig -> BatchInferenceJobInput
BatchInferenceJobInput'
            (S3DataConfig -> BatchInferenceJobInput)
-> Parser S3DataConfig -> Parser BatchInferenceJobInput
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser S3DataConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"s3DataSource")
      )

instance Prelude.Hashable BatchInferenceJobInput

instance Prelude.NFData BatchInferenceJobInput

instance Core.ToJSON BatchInferenceJobInput where
  toJSON :: BatchInferenceJobInput -> Value
toJSON BatchInferenceJobInput' {S3DataConfig
s3DataSource :: S3DataConfig
$sel:s3DataSource:BatchInferenceJobInput' :: BatchInferenceJobInput -> S3DataConfig
..} =
    [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
"s3DataSource" Text -> S3DataConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3DataConfig
s3DataSource)]
      )