{-# 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.DescribeBatchInferenceJob
-- 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)
--
-- Gets the properties of a batch inference job including name, Amazon
-- Resource Name (ARN), status, input and output configurations, and the
-- ARN of the solution version used to generate the recommendations.
module Amazonka.Personalize.DescribeBatchInferenceJob
  ( -- * Creating a Request
    DescribeBatchInferenceJob (..),
    newDescribeBatchInferenceJob,

    -- * Request Lenses
    describeBatchInferenceJob_batchInferenceJobArn,

    -- * Destructuring the Response
    DescribeBatchInferenceJobResponse (..),
    newDescribeBatchInferenceJobResponse,

    -- * Response Lenses
    describeBatchInferenceJobResponse_batchInferenceJob,
    describeBatchInferenceJobResponse_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:/ 'newDescribeBatchInferenceJob' smart constructor.
data DescribeBatchInferenceJob = DescribeBatchInferenceJob'
  { -- | The ARN of the batch inference job to describe.
    DescribeBatchInferenceJob -> Text
batchInferenceJobArn :: Prelude.Text
  }
  deriving (DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool
(DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool)
-> (DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool)
-> Eq DescribeBatchInferenceJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool
$c/= :: DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool
== :: DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool
$c== :: DescribeBatchInferenceJob -> DescribeBatchInferenceJob -> Bool
Prelude.Eq, ReadPrec [DescribeBatchInferenceJob]
ReadPrec DescribeBatchInferenceJob
Int -> ReadS DescribeBatchInferenceJob
ReadS [DescribeBatchInferenceJob]
(Int -> ReadS DescribeBatchInferenceJob)
-> ReadS [DescribeBatchInferenceJob]
-> ReadPrec DescribeBatchInferenceJob
-> ReadPrec [DescribeBatchInferenceJob]
-> Read DescribeBatchInferenceJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBatchInferenceJob]
$creadListPrec :: ReadPrec [DescribeBatchInferenceJob]
readPrec :: ReadPrec DescribeBatchInferenceJob
$creadPrec :: ReadPrec DescribeBatchInferenceJob
readList :: ReadS [DescribeBatchInferenceJob]
$creadList :: ReadS [DescribeBatchInferenceJob]
readsPrec :: Int -> ReadS DescribeBatchInferenceJob
$creadsPrec :: Int -> ReadS DescribeBatchInferenceJob
Prelude.Read, Int -> DescribeBatchInferenceJob -> ShowS
[DescribeBatchInferenceJob] -> ShowS
DescribeBatchInferenceJob -> String
(Int -> DescribeBatchInferenceJob -> ShowS)
-> (DescribeBatchInferenceJob -> String)
-> ([DescribeBatchInferenceJob] -> ShowS)
-> Show DescribeBatchInferenceJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBatchInferenceJob] -> ShowS
$cshowList :: [DescribeBatchInferenceJob] -> ShowS
show :: DescribeBatchInferenceJob -> String
$cshow :: DescribeBatchInferenceJob -> String
showsPrec :: Int -> DescribeBatchInferenceJob -> ShowS
$cshowsPrec :: Int -> DescribeBatchInferenceJob -> ShowS
Prelude.Show, (forall x.
 DescribeBatchInferenceJob -> Rep DescribeBatchInferenceJob x)
-> (forall x.
    Rep DescribeBatchInferenceJob x -> DescribeBatchInferenceJob)
-> Generic DescribeBatchInferenceJob
forall x.
Rep DescribeBatchInferenceJob x -> DescribeBatchInferenceJob
forall x.
DescribeBatchInferenceJob -> Rep DescribeBatchInferenceJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeBatchInferenceJob x -> DescribeBatchInferenceJob
$cfrom :: forall x.
DescribeBatchInferenceJob -> Rep DescribeBatchInferenceJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeBatchInferenceJob' 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', 'describeBatchInferenceJob_batchInferenceJobArn' - The ARN of the batch inference job to describe.
newDescribeBatchInferenceJob ::
  -- | 'batchInferenceJobArn'
  Prelude.Text ->
  DescribeBatchInferenceJob
newDescribeBatchInferenceJob :: Text -> DescribeBatchInferenceJob
newDescribeBatchInferenceJob Text
pBatchInferenceJobArn_ =
  DescribeBatchInferenceJob' :: Text -> DescribeBatchInferenceJob
DescribeBatchInferenceJob'
    { $sel:batchInferenceJobArn:DescribeBatchInferenceJob' :: Text
batchInferenceJobArn =
        Text
pBatchInferenceJobArn_
    }

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

instance Core.AWSRequest DescribeBatchInferenceJob where
  type
    AWSResponse DescribeBatchInferenceJob =
      DescribeBatchInferenceJobResponse
  request :: DescribeBatchInferenceJob -> Request DescribeBatchInferenceJob
request = Service
-> DescribeBatchInferenceJob -> Request DescribeBatchInferenceJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeBatchInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeBatchInferenceJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeBatchInferenceJob))
-> Logger
-> Service
-> Proxy DescribeBatchInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeBatchInferenceJob)))
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 BatchInferenceJob -> Int -> DescribeBatchInferenceJobResponse
DescribeBatchInferenceJobResponse'
            (Maybe BatchInferenceJob
 -> Int -> DescribeBatchInferenceJobResponse)
-> Either String (Maybe BatchInferenceJob)
-> Either String (Int -> DescribeBatchInferenceJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BatchInferenceJob)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"batchInferenceJob")
            Either String (Int -> DescribeBatchInferenceJobResponse)
-> Either String Int
-> Either String DescribeBatchInferenceJobResponse
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 DescribeBatchInferenceJob

instance Prelude.NFData DescribeBatchInferenceJob

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

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

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

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

-- |
-- Create a value of 'DescribeBatchInferenceJobResponse' 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:
--
-- 'batchInferenceJob', 'describeBatchInferenceJobResponse_batchInferenceJob' - Information on the specified batch inference job.
--
-- 'httpStatus', 'describeBatchInferenceJobResponse_httpStatus' - The response's http status code.
newDescribeBatchInferenceJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeBatchInferenceJobResponse
newDescribeBatchInferenceJobResponse :: Int -> DescribeBatchInferenceJobResponse
newDescribeBatchInferenceJobResponse Int
pHttpStatus_ =
  DescribeBatchInferenceJobResponse' :: Maybe BatchInferenceJob -> Int -> DescribeBatchInferenceJobResponse
DescribeBatchInferenceJobResponse'
    { $sel:batchInferenceJob:DescribeBatchInferenceJobResponse' :: Maybe BatchInferenceJob
batchInferenceJob =
        Maybe BatchInferenceJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeBatchInferenceJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information on the specified batch inference job.
describeBatchInferenceJobResponse_batchInferenceJob :: Lens.Lens' DescribeBatchInferenceJobResponse (Prelude.Maybe BatchInferenceJob)
describeBatchInferenceJobResponse_batchInferenceJob :: (Maybe BatchInferenceJob -> f (Maybe BatchInferenceJob))
-> DescribeBatchInferenceJobResponse
-> f DescribeBatchInferenceJobResponse
describeBatchInferenceJobResponse_batchInferenceJob = (DescribeBatchInferenceJobResponse -> Maybe BatchInferenceJob)
-> (DescribeBatchInferenceJobResponse
    -> Maybe BatchInferenceJob -> DescribeBatchInferenceJobResponse)
-> Lens
     DescribeBatchInferenceJobResponse
     DescribeBatchInferenceJobResponse
     (Maybe BatchInferenceJob)
     (Maybe BatchInferenceJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBatchInferenceJobResponse' {Maybe BatchInferenceJob
batchInferenceJob :: Maybe BatchInferenceJob
$sel:batchInferenceJob:DescribeBatchInferenceJobResponse' :: DescribeBatchInferenceJobResponse -> Maybe BatchInferenceJob
batchInferenceJob} -> Maybe BatchInferenceJob
batchInferenceJob) (\s :: DescribeBatchInferenceJobResponse
s@DescribeBatchInferenceJobResponse' {} Maybe BatchInferenceJob
a -> DescribeBatchInferenceJobResponse
s {$sel:batchInferenceJob:DescribeBatchInferenceJobResponse' :: Maybe BatchInferenceJob
batchInferenceJob = Maybe BatchInferenceJob
a} :: DescribeBatchInferenceJobResponse)

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

instance
  Prelude.NFData
    DescribeBatchInferenceJobResponse