{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateBatchInferenceJob
-- 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)
--
-- Creates a batch inference job. The operation can handle up to 50 million
-- records and the input file must be in JSON format. For more information,
-- see recommendations-batch.
module Amazonka.Personalize.CreateBatchInferenceJob
  ( -- * Creating a Request
    CreateBatchInferenceJob (..),
    newCreateBatchInferenceJob,

    -- * Request Lenses
    createBatchInferenceJob_numResults,
    createBatchInferenceJob_batchInferenceJobConfig,
    createBatchInferenceJob_filterArn,
    createBatchInferenceJob_jobName,
    createBatchInferenceJob_solutionVersionArn,
    createBatchInferenceJob_jobInput,
    createBatchInferenceJob_jobOutput,
    createBatchInferenceJob_roleArn,

    -- * Destructuring the Response
    CreateBatchInferenceJobResponse (..),
    newCreateBatchInferenceJobResponse,

    -- * Response Lenses
    createBatchInferenceJobResponse_batchInferenceJobArn,
    createBatchInferenceJobResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateBatchInferenceJob' smart constructor.
data CreateBatchInferenceJob = CreateBatchInferenceJob'
  { -- | The number of recommendations to retreive.
    CreateBatchInferenceJob -> Maybe Int
numResults :: Prelude.Maybe Prelude.Int,
    -- | The configuration details of a batch inference job.
    CreateBatchInferenceJob -> Maybe BatchInferenceJobConfig
batchInferenceJobConfig :: Prelude.Maybe BatchInferenceJobConfig,
    -- | The ARN of the filter to apply to the batch inference job. For more
    -- information on using filters, see
    -- <https://docs.aws.amazon.com/personalize/latest/dg/filter-batch.html Filtering Batch Recommendations>..
    CreateBatchInferenceJob -> Maybe Text
filterArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the batch inference job to create.
    CreateBatchInferenceJob -> Text
jobName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the solution version that will be used
    -- to generate the batch inference recommendations.
    CreateBatchInferenceJob -> Text
solutionVersionArn :: Prelude.Text,
    -- | The Amazon S3 path that leads to the input file to base your
    -- recommendations on. The input material must be in JSON format.
    CreateBatchInferenceJob -> BatchInferenceJobInput
jobInput :: BatchInferenceJobInput,
    -- | The path to the Amazon S3 bucket where the job\'s output will be stored.
    CreateBatchInferenceJob -> BatchInferenceJobOutput
jobOutput :: BatchInferenceJobOutput,
    -- | The ARN of the Amazon Identity and Access Management role that has
    -- permissions to read and write to your input and output Amazon S3 buckets
    -- respectively.
    CreateBatchInferenceJob -> Text
roleArn :: Prelude.Text
  }
  deriving (CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool
(CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool)
-> (CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool)
-> Eq CreateBatchInferenceJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool
$c/= :: CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool
== :: CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool
$c== :: CreateBatchInferenceJob -> CreateBatchInferenceJob -> Bool
Prelude.Eq, ReadPrec [CreateBatchInferenceJob]
ReadPrec CreateBatchInferenceJob
Int -> ReadS CreateBatchInferenceJob
ReadS [CreateBatchInferenceJob]
(Int -> ReadS CreateBatchInferenceJob)
-> ReadS [CreateBatchInferenceJob]
-> ReadPrec CreateBatchInferenceJob
-> ReadPrec [CreateBatchInferenceJob]
-> Read CreateBatchInferenceJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBatchInferenceJob]
$creadListPrec :: ReadPrec [CreateBatchInferenceJob]
readPrec :: ReadPrec CreateBatchInferenceJob
$creadPrec :: ReadPrec CreateBatchInferenceJob
readList :: ReadS [CreateBatchInferenceJob]
$creadList :: ReadS [CreateBatchInferenceJob]
readsPrec :: Int -> ReadS CreateBatchInferenceJob
$creadsPrec :: Int -> ReadS CreateBatchInferenceJob
Prelude.Read, Int -> CreateBatchInferenceJob -> ShowS
[CreateBatchInferenceJob] -> ShowS
CreateBatchInferenceJob -> String
(Int -> CreateBatchInferenceJob -> ShowS)
-> (CreateBatchInferenceJob -> String)
-> ([CreateBatchInferenceJob] -> ShowS)
-> Show CreateBatchInferenceJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBatchInferenceJob] -> ShowS
$cshowList :: [CreateBatchInferenceJob] -> ShowS
show :: CreateBatchInferenceJob -> String
$cshow :: CreateBatchInferenceJob -> String
showsPrec :: Int -> CreateBatchInferenceJob -> ShowS
$cshowsPrec :: Int -> CreateBatchInferenceJob -> ShowS
Prelude.Show, (forall x.
 CreateBatchInferenceJob -> Rep CreateBatchInferenceJob x)
-> (forall x.
    Rep CreateBatchInferenceJob x -> CreateBatchInferenceJob)
-> Generic CreateBatchInferenceJob
forall x. Rep CreateBatchInferenceJob x -> CreateBatchInferenceJob
forall x. CreateBatchInferenceJob -> Rep CreateBatchInferenceJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBatchInferenceJob x -> CreateBatchInferenceJob
$cfrom :: forall x. CreateBatchInferenceJob -> Rep CreateBatchInferenceJob x
Prelude.Generic)

-- |
-- Create a value of 'CreateBatchInferenceJob' 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:
--
-- 'numResults', 'createBatchInferenceJob_numResults' - The number of recommendations to retreive.
--
-- 'batchInferenceJobConfig', 'createBatchInferenceJob_batchInferenceJobConfig' - The configuration details of a batch inference job.
--
-- 'filterArn', 'createBatchInferenceJob_filterArn' - The ARN of the filter to apply to the batch inference job. For more
-- information on using filters, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/filter-batch.html Filtering Batch Recommendations>..
--
-- 'jobName', 'createBatchInferenceJob_jobName' - The name of the batch inference job to create.
--
-- 'solutionVersionArn', 'createBatchInferenceJob_solutionVersionArn' - The Amazon Resource Name (ARN) of the solution version that will be used
-- to generate the batch inference recommendations.
--
-- 'jobInput', 'createBatchInferenceJob_jobInput' - The Amazon S3 path that leads to the input file to base your
-- recommendations on. The input material must be in JSON format.
--
-- 'jobOutput', 'createBatchInferenceJob_jobOutput' - The path to the Amazon S3 bucket where the job\'s output will be stored.
--
-- 'roleArn', 'createBatchInferenceJob_roleArn' - The ARN of the Amazon Identity and Access Management role that has
-- permissions to read and write to your input and output Amazon S3 buckets
-- respectively.
newCreateBatchInferenceJob ::
  -- | 'jobName'
  Prelude.Text ->
  -- | 'solutionVersionArn'
  Prelude.Text ->
  -- | 'jobInput'
  BatchInferenceJobInput ->
  -- | 'jobOutput'
  BatchInferenceJobOutput ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateBatchInferenceJob
newCreateBatchInferenceJob :: Text
-> Text
-> BatchInferenceJobInput
-> BatchInferenceJobOutput
-> Text
-> CreateBatchInferenceJob
newCreateBatchInferenceJob
  Text
pJobName_
  Text
pSolutionVersionArn_
  BatchInferenceJobInput
pJobInput_
  BatchInferenceJobOutput
pJobOutput_
  Text
pRoleArn_ =
    CreateBatchInferenceJob' :: Maybe Int
-> Maybe BatchInferenceJobConfig
-> Maybe Text
-> Text
-> Text
-> BatchInferenceJobInput
-> BatchInferenceJobOutput
-> Text
-> CreateBatchInferenceJob
CreateBatchInferenceJob'
      { $sel:numResults:CreateBatchInferenceJob' :: Maybe Int
numResults =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:batchInferenceJobConfig:CreateBatchInferenceJob' :: Maybe BatchInferenceJobConfig
batchInferenceJobConfig = Maybe BatchInferenceJobConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:filterArn:CreateBatchInferenceJob' :: Maybe Text
filterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:jobName:CreateBatchInferenceJob' :: Text
jobName = Text
pJobName_,
        $sel:solutionVersionArn:CreateBatchInferenceJob' :: Text
solutionVersionArn = Text
pSolutionVersionArn_,
        $sel:jobInput:CreateBatchInferenceJob' :: BatchInferenceJobInput
jobInput = BatchInferenceJobInput
pJobInput_,
        $sel:jobOutput:CreateBatchInferenceJob' :: BatchInferenceJobOutput
jobOutput = BatchInferenceJobOutput
pJobOutput_,
        $sel:roleArn:CreateBatchInferenceJob' :: Text
roleArn = Text
pRoleArn_
      }

-- | The number of recommendations to retreive.
createBatchInferenceJob_numResults :: Lens.Lens' CreateBatchInferenceJob (Prelude.Maybe Prelude.Int)
createBatchInferenceJob_numResults :: (Maybe Int -> f (Maybe Int))
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_numResults = (CreateBatchInferenceJob -> Maybe Int)
-> (CreateBatchInferenceJob
    -> Maybe Int -> CreateBatchInferenceJob)
-> Lens
     CreateBatchInferenceJob
     CreateBatchInferenceJob
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Maybe Int
numResults :: Maybe Int
$sel:numResults:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe Int
numResults} -> Maybe Int
numResults) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Maybe Int
a -> CreateBatchInferenceJob
s {$sel:numResults:CreateBatchInferenceJob' :: Maybe Int
numResults = Maybe Int
a} :: CreateBatchInferenceJob)

-- | The configuration details of a batch inference job.
createBatchInferenceJob_batchInferenceJobConfig :: Lens.Lens' CreateBatchInferenceJob (Prelude.Maybe BatchInferenceJobConfig)
createBatchInferenceJob_batchInferenceJobConfig :: (Maybe BatchInferenceJobConfig
 -> f (Maybe BatchInferenceJobConfig))
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_batchInferenceJobConfig = (CreateBatchInferenceJob -> Maybe BatchInferenceJobConfig)
-> (CreateBatchInferenceJob
    -> Maybe BatchInferenceJobConfig -> CreateBatchInferenceJob)
-> Lens
     CreateBatchInferenceJob
     CreateBatchInferenceJob
     (Maybe BatchInferenceJobConfig)
     (Maybe BatchInferenceJobConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Maybe BatchInferenceJobConfig
batchInferenceJobConfig :: Maybe BatchInferenceJobConfig
$sel:batchInferenceJobConfig:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe BatchInferenceJobConfig
batchInferenceJobConfig} -> Maybe BatchInferenceJobConfig
batchInferenceJobConfig) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Maybe BatchInferenceJobConfig
a -> CreateBatchInferenceJob
s {$sel:batchInferenceJobConfig:CreateBatchInferenceJob' :: Maybe BatchInferenceJobConfig
batchInferenceJobConfig = Maybe BatchInferenceJobConfig
a} :: CreateBatchInferenceJob)

-- | The ARN of the filter to apply to the batch inference job. For more
-- information on using filters, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/filter-batch.html Filtering Batch Recommendations>..
createBatchInferenceJob_filterArn :: Lens.Lens' CreateBatchInferenceJob (Prelude.Maybe Prelude.Text)
createBatchInferenceJob_filterArn :: (Maybe Text -> f (Maybe Text))
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_filterArn = (CreateBatchInferenceJob -> Maybe Text)
-> (CreateBatchInferenceJob
    -> Maybe Text -> CreateBatchInferenceJob)
-> Lens
     CreateBatchInferenceJob
     CreateBatchInferenceJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Maybe Text
filterArn :: Maybe Text
$sel:filterArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe Text
filterArn} -> Maybe Text
filterArn) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Maybe Text
a -> CreateBatchInferenceJob
s {$sel:filterArn:CreateBatchInferenceJob' :: Maybe Text
filterArn = Maybe Text
a} :: CreateBatchInferenceJob)

-- | The name of the batch inference job to create.
createBatchInferenceJob_jobName :: Lens.Lens' CreateBatchInferenceJob Prelude.Text
createBatchInferenceJob_jobName :: (Text -> f Text)
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_jobName = (CreateBatchInferenceJob -> Text)
-> (CreateBatchInferenceJob -> Text -> CreateBatchInferenceJob)
-> Lens CreateBatchInferenceJob CreateBatchInferenceJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Text
jobName :: Text
$sel:jobName:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
jobName} -> Text
jobName) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Text
a -> CreateBatchInferenceJob
s {$sel:jobName:CreateBatchInferenceJob' :: Text
jobName = Text
a} :: CreateBatchInferenceJob)

-- | The Amazon Resource Name (ARN) of the solution version that will be used
-- to generate the batch inference recommendations.
createBatchInferenceJob_solutionVersionArn :: Lens.Lens' CreateBatchInferenceJob Prelude.Text
createBatchInferenceJob_solutionVersionArn :: (Text -> f Text)
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_solutionVersionArn = (CreateBatchInferenceJob -> Text)
-> (CreateBatchInferenceJob -> Text -> CreateBatchInferenceJob)
-> Lens CreateBatchInferenceJob CreateBatchInferenceJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
solutionVersionArn} -> Text
solutionVersionArn) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Text
a -> CreateBatchInferenceJob
s {$sel:solutionVersionArn:CreateBatchInferenceJob' :: Text
solutionVersionArn = Text
a} :: CreateBatchInferenceJob)

-- | The Amazon S3 path that leads to the input file to base your
-- recommendations on. The input material must be in JSON format.
createBatchInferenceJob_jobInput :: Lens.Lens' CreateBatchInferenceJob BatchInferenceJobInput
createBatchInferenceJob_jobInput :: (BatchInferenceJobInput -> f BatchInferenceJobInput)
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_jobInput = (CreateBatchInferenceJob -> BatchInferenceJobInput)
-> (CreateBatchInferenceJob
    -> BatchInferenceJobInput -> CreateBatchInferenceJob)
-> Lens
     CreateBatchInferenceJob
     CreateBatchInferenceJob
     BatchInferenceJobInput
     BatchInferenceJobInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {BatchInferenceJobInput
jobInput :: BatchInferenceJobInput
$sel:jobInput:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> BatchInferenceJobInput
jobInput} -> BatchInferenceJobInput
jobInput) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} BatchInferenceJobInput
a -> CreateBatchInferenceJob
s {$sel:jobInput:CreateBatchInferenceJob' :: BatchInferenceJobInput
jobInput = BatchInferenceJobInput
a} :: CreateBatchInferenceJob)

-- | The path to the Amazon S3 bucket where the job\'s output will be stored.
createBatchInferenceJob_jobOutput :: Lens.Lens' CreateBatchInferenceJob BatchInferenceJobOutput
createBatchInferenceJob_jobOutput :: (BatchInferenceJobOutput -> f BatchInferenceJobOutput)
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_jobOutput = (CreateBatchInferenceJob -> BatchInferenceJobOutput)
-> (CreateBatchInferenceJob
    -> BatchInferenceJobOutput -> CreateBatchInferenceJob)
-> Lens
     CreateBatchInferenceJob
     CreateBatchInferenceJob
     BatchInferenceJobOutput
     BatchInferenceJobOutput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {BatchInferenceJobOutput
jobOutput :: BatchInferenceJobOutput
$sel:jobOutput:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> BatchInferenceJobOutput
jobOutput} -> BatchInferenceJobOutput
jobOutput) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} BatchInferenceJobOutput
a -> CreateBatchInferenceJob
s {$sel:jobOutput:CreateBatchInferenceJob' :: BatchInferenceJobOutput
jobOutput = BatchInferenceJobOutput
a} :: CreateBatchInferenceJob)

-- | The ARN of the Amazon Identity and Access Management role that has
-- permissions to read and write to your input and output Amazon S3 buckets
-- respectively.
createBatchInferenceJob_roleArn :: Lens.Lens' CreateBatchInferenceJob Prelude.Text
createBatchInferenceJob_roleArn :: (Text -> f Text)
-> CreateBatchInferenceJob -> f CreateBatchInferenceJob
createBatchInferenceJob_roleArn = (CreateBatchInferenceJob -> Text)
-> (CreateBatchInferenceJob -> Text -> CreateBatchInferenceJob)
-> Lens CreateBatchInferenceJob CreateBatchInferenceJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJob' {Text
roleArn :: Text
$sel:roleArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
roleArn} -> Text
roleArn) (\s :: CreateBatchInferenceJob
s@CreateBatchInferenceJob' {} Text
a -> CreateBatchInferenceJob
s {$sel:roleArn:CreateBatchInferenceJob' :: Text
roleArn = Text
a} :: CreateBatchInferenceJob)

instance Core.AWSRequest CreateBatchInferenceJob where
  type
    AWSResponse CreateBatchInferenceJob =
      CreateBatchInferenceJobResponse
  request :: CreateBatchInferenceJob -> Request CreateBatchInferenceJob
request = Service
-> CreateBatchInferenceJob -> Request CreateBatchInferenceJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBatchInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBatchInferenceJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBatchInferenceJob))
-> Logger
-> Service
-> Proxy CreateBatchInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBatchInferenceJob)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateBatchInferenceJobResponse
CreateBatchInferenceJobResponse'
            (Maybe Text -> Int -> CreateBatchInferenceJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateBatchInferenceJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"batchInferenceJobArn")
            Either String (Int -> CreateBatchInferenceJobResponse)
-> Either String Int
-> Either String CreateBatchInferenceJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateBatchInferenceJob

instance Prelude.NFData CreateBatchInferenceJob

instance Core.ToHeaders CreateBatchInferenceJob where
  toHeaders :: CreateBatchInferenceJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBatchInferenceJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonPersonalize.CreateBatchInferenceJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateBatchInferenceJob where
  toJSON :: CreateBatchInferenceJob -> Value
toJSON CreateBatchInferenceJob' {Maybe Int
Maybe Text
Maybe BatchInferenceJobConfig
Text
BatchInferenceJobOutput
BatchInferenceJobInput
roleArn :: Text
jobOutput :: BatchInferenceJobOutput
jobInput :: BatchInferenceJobInput
solutionVersionArn :: Text
jobName :: Text
filterArn :: Maybe Text
batchInferenceJobConfig :: Maybe BatchInferenceJobConfig
numResults :: Maybe Int
$sel:roleArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
$sel:jobOutput:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> BatchInferenceJobOutput
$sel:jobInput:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> BatchInferenceJobInput
$sel:solutionVersionArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
$sel:jobName:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Text
$sel:filterArn:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe Text
$sel:batchInferenceJobConfig:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe BatchInferenceJobConfig
$sel:numResults:CreateBatchInferenceJob' :: CreateBatchInferenceJob -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"numResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
numResults,
            (Text
"batchInferenceJobConfig" Text -> BatchInferenceJobConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BatchInferenceJobConfig -> Pair)
-> Maybe BatchInferenceJobConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BatchInferenceJobConfig
batchInferenceJobConfig,
            (Text
"filterArn" 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
filterArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"solutionVersionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
solutionVersionArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobInput" Text -> BatchInferenceJobInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BatchInferenceJobInput
jobInput),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobOutput" Text -> BatchInferenceJobOutput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BatchInferenceJobOutput
jobOutput),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )

instance Core.ToPath CreateBatchInferenceJob where
  toPath :: CreateBatchInferenceJob -> ByteString
toPath = ByteString -> CreateBatchInferenceJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateBatchInferenceJob where
  toQuery :: CreateBatchInferenceJob -> QueryString
toQuery = QueryString -> CreateBatchInferenceJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateBatchInferenceJobResponse' smart constructor.
data CreateBatchInferenceJobResponse = CreateBatchInferenceJobResponse'
  { -- | The ARN of the batch inference job.
    CreateBatchInferenceJobResponse -> Maybe Text
batchInferenceJobArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateBatchInferenceJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBatchInferenceJobResponse
-> CreateBatchInferenceJobResponse -> Bool
(CreateBatchInferenceJobResponse
 -> CreateBatchInferenceJobResponse -> Bool)
-> (CreateBatchInferenceJobResponse
    -> CreateBatchInferenceJobResponse -> Bool)
-> Eq CreateBatchInferenceJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBatchInferenceJobResponse
-> CreateBatchInferenceJobResponse -> Bool
$c/= :: CreateBatchInferenceJobResponse
-> CreateBatchInferenceJobResponse -> Bool
== :: CreateBatchInferenceJobResponse
-> CreateBatchInferenceJobResponse -> Bool
$c== :: CreateBatchInferenceJobResponse
-> CreateBatchInferenceJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateBatchInferenceJobResponse]
ReadPrec CreateBatchInferenceJobResponse
Int -> ReadS CreateBatchInferenceJobResponse
ReadS [CreateBatchInferenceJobResponse]
(Int -> ReadS CreateBatchInferenceJobResponse)
-> ReadS [CreateBatchInferenceJobResponse]
-> ReadPrec CreateBatchInferenceJobResponse
-> ReadPrec [CreateBatchInferenceJobResponse]
-> Read CreateBatchInferenceJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBatchInferenceJobResponse]
$creadListPrec :: ReadPrec [CreateBatchInferenceJobResponse]
readPrec :: ReadPrec CreateBatchInferenceJobResponse
$creadPrec :: ReadPrec CreateBatchInferenceJobResponse
readList :: ReadS [CreateBatchInferenceJobResponse]
$creadList :: ReadS [CreateBatchInferenceJobResponse]
readsPrec :: Int -> ReadS CreateBatchInferenceJobResponse
$creadsPrec :: Int -> ReadS CreateBatchInferenceJobResponse
Prelude.Read, Int -> CreateBatchInferenceJobResponse -> ShowS
[CreateBatchInferenceJobResponse] -> ShowS
CreateBatchInferenceJobResponse -> String
(Int -> CreateBatchInferenceJobResponse -> ShowS)
-> (CreateBatchInferenceJobResponse -> String)
-> ([CreateBatchInferenceJobResponse] -> ShowS)
-> Show CreateBatchInferenceJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBatchInferenceJobResponse] -> ShowS
$cshowList :: [CreateBatchInferenceJobResponse] -> ShowS
show :: CreateBatchInferenceJobResponse -> String
$cshow :: CreateBatchInferenceJobResponse -> String
showsPrec :: Int -> CreateBatchInferenceJobResponse -> ShowS
$cshowsPrec :: Int -> CreateBatchInferenceJobResponse -> ShowS
Prelude.Show, (forall x.
 CreateBatchInferenceJobResponse
 -> Rep CreateBatchInferenceJobResponse x)
-> (forall x.
    Rep CreateBatchInferenceJobResponse x
    -> CreateBatchInferenceJobResponse)
-> Generic CreateBatchInferenceJobResponse
forall x.
Rep CreateBatchInferenceJobResponse x
-> CreateBatchInferenceJobResponse
forall x.
CreateBatchInferenceJobResponse
-> Rep CreateBatchInferenceJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBatchInferenceJobResponse x
-> CreateBatchInferenceJobResponse
$cfrom :: forall x.
CreateBatchInferenceJobResponse
-> Rep CreateBatchInferenceJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBatchInferenceJobResponse' 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:
--
-- 'batchInferenceJobArn', 'createBatchInferenceJobResponse_batchInferenceJobArn' - The ARN of the batch inference job.
--
-- 'httpStatus', 'createBatchInferenceJobResponse_httpStatus' - The response's http status code.
newCreateBatchInferenceJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBatchInferenceJobResponse
newCreateBatchInferenceJobResponse :: Int -> CreateBatchInferenceJobResponse
newCreateBatchInferenceJobResponse Int
pHttpStatus_ =
  CreateBatchInferenceJobResponse' :: Maybe Text -> Int -> CreateBatchInferenceJobResponse
CreateBatchInferenceJobResponse'
    { $sel:batchInferenceJobArn:CreateBatchInferenceJobResponse' :: Maybe Text
batchInferenceJobArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBatchInferenceJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the batch inference job.
createBatchInferenceJobResponse_batchInferenceJobArn :: Lens.Lens' CreateBatchInferenceJobResponse (Prelude.Maybe Prelude.Text)
createBatchInferenceJobResponse_batchInferenceJobArn :: (Maybe Text -> f (Maybe Text))
-> CreateBatchInferenceJobResponse
-> f CreateBatchInferenceJobResponse
createBatchInferenceJobResponse_batchInferenceJobArn = (CreateBatchInferenceJobResponse -> Maybe Text)
-> (CreateBatchInferenceJobResponse
    -> Maybe Text -> CreateBatchInferenceJobResponse)
-> Lens
     CreateBatchInferenceJobResponse
     CreateBatchInferenceJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJobResponse' {Maybe Text
batchInferenceJobArn :: Maybe Text
$sel:batchInferenceJobArn:CreateBatchInferenceJobResponse' :: CreateBatchInferenceJobResponse -> Maybe Text
batchInferenceJobArn} -> Maybe Text
batchInferenceJobArn) (\s :: CreateBatchInferenceJobResponse
s@CreateBatchInferenceJobResponse' {} Maybe Text
a -> CreateBatchInferenceJobResponse
s {$sel:batchInferenceJobArn:CreateBatchInferenceJobResponse' :: Maybe Text
batchInferenceJobArn = Maybe Text
a} :: CreateBatchInferenceJobResponse)

-- | The response's http status code.
createBatchInferenceJobResponse_httpStatus :: Lens.Lens' CreateBatchInferenceJobResponse Prelude.Int
createBatchInferenceJobResponse_httpStatus :: (Int -> f Int)
-> CreateBatchInferenceJobResponse
-> f CreateBatchInferenceJobResponse
createBatchInferenceJobResponse_httpStatus = (CreateBatchInferenceJobResponse -> Int)
-> (CreateBatchInferenceJobResponse
    -> Int -> CreateBatchInferenceJobResponse)
-> Lens
     CreateBatchInferenceJobResponse
     CreateBatchInferenceJobResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBatchInferenceJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBatchInferenceJobResponse' :: CreateBatchInferenceJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBatchInferenceJobResponse
s@CreateBatchInferenceJobResponse' {} Int
a -> CreateBatchInferenceJobResponse
s {$sel:httpStatus:CreateBatchInferenceJobResponse' :: Int
httpStatus = Int
a} :: CreateBatchInferenceJobResponse)

instance
  Prelude.NFData
    CreateBatchInferenceJobResponse