{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
    { $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 :: Lens' DescribeBatchInferenceJob Text
describeBatchInferenceJob_batchInferenceJobArn = 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 :: (Service -> Service)
-> DescribeBatchInferenceJob -> Request DescribeBatchInferenceJob
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeBatchInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeBatchInferenceJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe BatchInferenceJob -> Int -> DescribeBatchInferenceJobResponse
DescribeBatchInferenceJobResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"batchInferenceJob")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeBatchInferenceJob where
  hashWithSalt :: Int -> DescribeBatchInferenceJob -> Int
hashWithSalt Int
_salt DescribeBatchInferenceJob' {Text
batchInferenceJobArn :: Text
$sel:batchInferenceJobArn:DescribeBatchInferenceJob' :: DescribeBatchInferenceJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
batchInferenceJobArn

instance Prelude.NFData DescribeBatchInferenceJob where
  rnf :: DescribeBatchInferenceJob -> ()
rnf DescribeBatchInferenceJob' {Text
batchInferenceJobArn :: Text
$sel:batchInferenceJobArn:DescribeBatchInferenceJob' :: DescribeBatchInferenceJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
batchInferenceJobArn

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

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

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

instance Data.ToQuery DescribeBatchInferenceJob where
  toQuery :: DescribeBatchInferenceJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:batchInferenceJob:DescribeBatchInferenceJobResponse' :: Maybe BatchInferenceJob
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 :: Lens' DescribeBatchInferenceJobResponse (Maybe BatchInferenceJob)
describeBatchInferenceJobResponse_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 :: Lens' DescribeBatchInferenceJobResponse Int
describeBatchInferenceJobResponse_httpStatus = 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
  where
  rnf :: DescribeBatchInferenceJobResponse -> ()
rnf DescribeBatchInferenceJobResponse' {Int
Maybe BatchInferenceJob
httpStatus :: Int
batchInferenceJob :: Maybe BatchInferenceJob
$sel:httpStatus:DescribeBatchInferenceJobResponse' :: DescribeBatchInferenceJobResponse -> Int
$sel:batchInferenceJob:DescribeBatchInferenceJobResponse' :: DescribeBatchInferenceJobResponse -> Maybe BatchInferenceJob
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchInferenceJob
batchInferenceJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus