{-# 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.DescribeDatasetImportJob
-- 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)
--
-- Describes the dataset import job created by CreateDatasetImportJob,
-- including the import job status.
module Amazonka.Personalize.DescribeDatasetImportJob
  ( -- * Creating a Request
    DescribeDatasetImportJob (..),
    newDescribeDatasetImportJob,

    -- * Request Lenses
    describeDatasetImportJob_datasetImportJobArn,

    -- * Destructuring the Response
    DescribeDatasetImportJobResponse (..),
    newDescribeDatasetImportJobResponse,

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

-- |
-- Create a value of 'DescribeDatasetImportJob' 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:
--
-- 'datasetImportJobArn', 'describeDatasetImportJob_datasetImportJobArn' - The Amazon Resource Name (ARN) of the dataset import job to describe.
newDescribeDatasetImportJob ::
  -- | 'datasetImportJobArn'
  Prelude.Text ->
  DescribeDatasetImportJob
newDescribeDatasetImportJob :: Text -> DescribeDatasetImportJob
newDescribeDatasetImportJob Text
pDatasetImportJobArn_ =
  DescribeDatasetImportJob' :: Text -> DescribeDatasetImportJob
DescribeDatasetImportJob'
    { $sel:datasetImportJobArn:DescribeDatasetImportJob' :: Text
datasetImportJobArn =
        Text
pDatasetImportJobArn_
    }

-- | The Amazon Resource Name (ARN) of the dataset import job to describe.
describeDatasetImportJob_datasetImportJobArn :: Lens.Lens' DescribeDatasetImportJob Prelude.Text
describeDatasetImportJob_datasetImportJobArn :: (Text -> f Text)
-> DescribeDatasetImportJob -> f DescribeDatasetImportJob
describeDatasetImportJob_datasetImportJobArn = (DescribeDatasetImportJob -> Text)
-> (DescribeDatasetImportJob -> Text -> DescribeDatasetImportJob)
-> Lens DescribeDatasetImportJob DescribeDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDatasetImportJob' {Text
datasetImportJobArn :: Text
$sel:datasetImportJobArn:DescribeDatasetImportJob' :: DescribeDatasetImportJob -> Text
datasetImportJobArn} -> Text
datasetImportJobArn) (\s :: DescribeDatasetImportJob
s@DescribeDatasetImportJob' {} Text
a -> DescribeDatasetImportJob
s {$sel:datasetImportJobArn:DescribeDatasetImportJob' :: Text
datasetImportJobArn = Text
a} :: DescribeDatasetImportJob)

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

instance Prelude.NFData DescribeDatasetImportJob

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

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

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

-- | /See:/ 'newDescribeDatasetImportJobResponse' smart constructor.
data DescribeDatasetImportJobResponse = DescribeDatasetImportJobResponse'
  { -- | Information about the dataset import job, including the status.
    --
    -- The status is one of the following values:
    --
    -- -   CREATE PENDING
    --
    -- -   CREATE IN_PROGRESS
    --
    -- -   ACTIVE
    --
    -- -   CREATE FAILED
    DescribeDatasetImportJobResponse -> Maybe DatasetImportJob
datasetImportJob :: Prelude.Maybe DatasetImportJob,
    -- | The response's http status code.
    DescribeDatasetImportJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDatasetImportJobResponse
-> DescribeDatasetImportJobResponse -> Bool
(DescribeDatasetImportJobResponse
 -> DescribeDatasetImportJobResponse -> Bool)
-> (DescribeDatasetImportJobResponse
    -> DescribeDatasetImportJobResponse -> Bool)
-> Eq DescribeDatasetImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDatasetImportJobResponse
-> DescribeDatasetImportJobResponse -> Bool
$c/= :: DescribeDatasetImportJobResponse
-> DescribeDatasetImportJobResponse -> Bool
== :: DescribeDatasetImportJobResponse
-> DescribeDatasetImportJobResponse -> Bool
$c== :: DescribeDatasetImportJobResponse
-> DescribeDatasetImportJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDatasetImportJobResponse]
ReadPrec DescribeDatasetImportJobResponse
Int -> ReadS DescribeDatasetImportJobResponse
ReadS [DescribeDatasetImportJobResponse]
(Int -> ReadS DescribeDatasetImportJobResponse)
-> ReadS [DescribeDatasetImportJobResponse]
-> ReadPrec DescribeDatasetImportJobResponse
-> ReadPrec [DescribeDatasetImportJobResponse]
-> Read DescribeDatasetImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDatasetImportJobResponse]
$creadListPrec :: ReadPrec [DescribeDatasetImportJobResponse]
readPrec :: ReadPrec DescribeDatasetImportJobResponse
$creadPrec :: ReadPrec DescribeDatasetImportJobResponse
readList :: ReadS [DescribeDatasetImportJobResponse]
$creadList :: ReadS [DescribeDatasetImportJobResponse]
readsPrec :: Int -> ReadS DescribeDatasetImportJobResponse
$creadsPrec :: Int -> ReadS DescribeDatasetImportJobResponse
Prelude.Read, Int -> DescribeDatasetImportJobResponse -> ShowS
[DescribeDatasetImportJobResponse] -> ShowS
DescribeDatasetImportJobResponse -> String
(Int -> DescribeDatasetImportJobResponse -> ShowS)
-> (DescribeDatasetImportJobResponse -> String)
-> ([DescribeDatasetImportJobResponse] -> ShowS)
-> Show DescribeDatasetImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDatasetImportJobResponse] -> ShowS
$cshowList :: [DescribeDatasetImportJobResponse] -> ShowS
show :: DescribeDatasetImportJobResponse -> String
$cshow :: DescribeDatasetImportJobResponse -> String
showsPrec :: Int -> DescribeDatasetImportJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeDatasetImportJobResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDatasetImportJobResponse
 -> Rep DescribeDatasetImportJobResponse x)
-> (forall x.
    Rep DescribeDatasetImportJobResponse x
    -> DescribeDatasetImportJobResponse)
-> Generic DescribeDatasetImportJobResponse
forall x.
Rep DescribeDatasetImportJobResponse x
-> DescribeDatasetImportJobResponse
forall x.
DescribeDatasetImportJobResponse
-> Rep DescribeDatasetImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDatasetImportJobResponse x
-> DescribeDatasetImportJobResponse
$cfrom :: forall x.
DescribeDatasetImportJobResponse
-> Rep DescribeDatasetImportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDatasetImportJobResponse' 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:
--
-- 'datasetImportJob', 'describeDatasetImportJobResponse_datasetImportJob' - Information about the dataset import job, including the status.
--
-- The status is one of the following values:
--
-- -   CREATE PENDING
--
-- -   CREATE IN_PROGRESS
--
-- -   ACTIVE
--
-- -   CREATE FAILED
--
-- 'httpStatus', 'describeDatasetImportJobResponse_httpStatus' - The response's http status code.
newDescribeDatasetImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDatasetImportJobResponse
newDescribeDatasetImportJobResponse :: Int -> DescribeDatasetImportJobResponse
newDescribeDatasetImportJobResponse Int
pHttpStatus_ =
  DescribeDatasetImportJobResponse' :: Maybe DatasetImportJob -> Int -> DescribeDatasetImportJobResponse
DescribeDatasetImportJobResponse'
    { $sel:datasetImportJob:DescribeDatasetImportJobResponse' :: Maybe DatasetImportJob
datasetImportJob =
        Maybe DatasetImportJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDatasetImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the dataset import job, including the status.
--
-- The status is one of the following values:
--
-- -   CREATE PENDING
--
-- -   CREATE IN_PROGRESS
--
-- -   ACTIVE
--
-- -   CREATE FAILED
describeDatasetImportJobResponse_datasetImportJob :: Lens.Lens' DescribeDatasetImportJobResponse (Prelude.Maybe DatasetImportJob)
describeDatasetImportJobResponse_datasetImportJob :: (Maybe DatasetImportJob -> f (Maybe DatasetImportJob))
-> DescribeDatasetImportJobResponse
-> f DescribeDatasetImportJobResponse
describeDatasetImportJobResponse_datasetImportJob = (DescribeDatasetImportJobResponse -> Maybe DatasetImportJob)
-> (DescribeDatasetImportJobResponse
    -> Maybe DatasetImportJob -> DescribeDatasetImportJobResponse)
-> Lens
     DescribeDatasetImportJobResponse
     DescribeDatasetImportJobResponse
     (Maybe DatasetImportJob)
     (Maybe DatasetImportJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDatasetImportJobResponse' {Maybe DatasetImportJob
datasetImportJob :: Maybe DatasetImportJob
$sel:datasetImportJob:DescribeDatasetImportJobResponse' :: DescribeDatasetImportJobResponse -> Maybe DatasetImportJob
datasetImportJob} -> Maybe DatasetImportJob
datasetImportJob) (\s :: DescribeDatasetImportJobResponse
s@DescribeDatasetImportJobResponse' {} Maybe DatasetImportJob
a -> DescribeDatasetImportJobResponse
s {$sel:datasetImportJob:DescribeDatasetImportJobResponse' :: Maybe DatasetImportJob
datasetImportJob = Maybe DatasetImportJob
a} :: DescribeDatasetImportJobResponse)

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

instance
  Prelude.NFData
    DescribeDatasetImportJobResponse