{-# 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.CognitoIdentityProvider.DescribeUserImportJob
-- 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 user import job.
module Amazonka.CognitoIdentityProvider.DescribeUserImportJob
  ( -- * Creating a Request
    DescribeUserImportJob (..),
    newDescribeUserImportJob,

    -- * Request Lenses
    describeUserImportJob_userPoolId,
    describeUserImportJob_jobId,

    -- * Destructuring the Response
    DescribeUserImportJobResponse (..),
    newDescribeUserImportJobResponse,

    -- * Response Lenses
    describeUserImportJobResponse_userImportJob,
    describeUserImportJobResponse_httpStatus,
  )
where

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

-- | Represents the request to describe the user import job.
--
-- /See:/ 'newDescribeUserImportJob' smart constructor.
data DescribeUserImportJob = DescribeUserImportJob'
  { -- | The user pool ID for the user pool that the users are being imported
    -- into.
    DescribeUserImportJob -> Text
userPoolId :: Prelude.Text,
    -- | The job ID for the user import job.
    DescribeUserImportJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeUserImportJob -> DescribeUserImportJob -> Bool
(DescribeUserImportJob -> DescribeUserImportJob -> Bool)
-> (DescribeUserImportJob -> DescribeUserImportJob -> Bool)
-> Eq DescribeUserImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserImportJob -> DescribeUserImportJob -> Bool
$c/= :: DescribeUserImportJob -> DescribeUserImportJob -> Bool
== :: DescribeUserImportJob -> DescribeUserImportJob -> Bool
$c== :: DescribeUserImportJob -> DescribeUserImportJob -> Bool
Prelude.Eq, ReadPrec [DescribeUserImportJob]
ReadPrec DescribeUserImportJob
Int -> ReadS DescribeUserImportJob
ReadS [DescribeUserImportJob]
(Int -> ReadS DescribeUserImportJob)
-> ReadS [DescribeUserImportJob]
-> ReadPrec DescribeUserImportJob
-> ReadPrec [DescribeUserImportJob]
-> Read DescribeUserImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeUserImportJob]
$creadListPrec :: ReadPrec [DescribeUserImportJob]
readPrec :: ReadPrec DescribeUserImportJob
$creadPrec :: ReadPrec DescribeUserImportJob
readList :: ReadS [DescribeUserImportJob]
$creadList :: ReadS [DescribeUserImportJob]
readsPrec :: Int -> ReadS DescribeUserImportJob
$creadsPrec :: Int -> ReadS DescribeUserImportJob
Prelude.Read, Int -> DescribeUserImportJob -> ShowS
[DescribeUserImportJob] -> ShowS
DescribeUserImportJob -> String
(Int -> DescribeUserImportJob -> ShowS)
-> (DescribeUserImportJob -> String)
-> ([DescribeUserImportJob] -> ShowS)
-> Show DescribeUserImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserImportJob] -> ShowS
$cshowList :: [DescribeUserImportJob] -> ShowS
show :: DescribeUserImportJob -> String
$cshow :: DescribeUserImportJob -> String
showsPrec :: Int -> DescribeUserImportJob -> ShowS
$cshowsPrec :: Int -> DescribeUserImportJob -> ShowS
Prelude.Show, (forall x. DescribeUserImportJob -> Rep DescribeUserImportJob x)
-> (forall x. Rep DescribeUserImportJob x -> DescribeUserImportJob)
-> Generic DescribeUserImportJob
forall x. Rep DescribeUserImportJob x -> DescribeUserImportJob
forall x. DescribeUserImportJob -> Rep DescribeUserImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeUserImportJob x -> DescribeUserImportJob
$cfrom :: forall x. DescribeUserImportJob -> Rep DescribeUserImportJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeUserImportJob' 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:
--
-- 'userPoolId', 'describeUserImportJob_userPoolId' - The user pool ID for the user pool that the users are being imported
-- into.
--
-- 'jobId', 'describeUserImportJob_jobId' - The job ID for the user import job.
newDescribeUserImportJob ::
  -- | 'userPoolId'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  DescribeUserImportJob
newDescribeUserImportJob :: Text -> Text -> DescribeUserImportJob
newDescribeUserImportJob Text
pUserPoolId_ Text
pJobId_ =
  DescribeUserImportJob' :: Text -> Text -> DescribeUserImportJob
DescribeUserImportJob'
    { $sel:userPoolId:DescribeUserImportJob' :: Text
userPoolId = Text
pUserPoolId_,
      $sel:jobId:DescribeUserImportJob' :: Text
jobId = Text
pJobId_
    }

-- | The user pool ID for the user pool that the users are being imported
-- into.
describeUserImportJob_userPoolId :: Lens.Lens' DescribeUserImportJob Prelude.Text
describeUserImportJob_userPoolId :: (Text -> f Text)
-> DescribeUserImportJob -> f DescribeUserImportJob
describeUserImportJob_userPoolId = (DescribeUserImportJob -> Text)
-> (DescribeUserImportJob -> Text -> DescribeUserImportJob)
-> Lens DescribeUserImportJob DescribeUserImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserImportJob' {Text
userPoolId :: Text
$sel:userPoolId:DescribeUserImportJob' :: DescribeUserImportJob -> Text
userPoolId} -> Text
userPoolId) (\s :: DescribeUserImportJob
s@DescribeUserImportJob' {} Text
a -> DescribeUserImportJob
s {$sel:userPoolId:DescribeUserImportJob' :: Text
userPoolId = Text
a} :: DescribeUserImportJob)

-- | The job ID for the user import job.
describeUserImportJob_jobId :: Lens.Lens' DescribeUserImportJob Prelude.Text
describeUserImportJob_jobId :: (Text -> f Text)
-> DescribeUserImportJob -> f DescribeUserImportJob
describeUserImportJob_jobId = (DescribeUserImportJob -> Text)
-> (DescribeUserImportJob -> Text -> DescribeUserImportJob)
-> Lens DescribeUserImportJob DescribeUserImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserImportJob' {Text
jobId :: Text
$sel:jobId:DescribeUserImportJob' :: DescribeUserImportJob -> Text
jobId} -> Text
jobId) (\s :: DescribeUserImportJob
s@DescribeUserImportJob' {} Text
a -> DescribeUserImportJob
s {$sel:jobId:DescribeUserImportJob' :: Text
jobId = Text
a} :: DescribeUserImportJob)

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

instance Prelude.NFData DescribeUserImportJob

instance Core.ToHeaders DescribeUserImportJob where
  toHeaders :: DescribeUserImportJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeUserImportJob -> 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
"AWSCognitoIdentityProviderService.DescribeUserImportJob" ::
                          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 DescribeUserImportJob where
  toJSON :: DescribeUserImportJob -> Value
toJSON DescribeUserImportJob' {Text
jobId :: Text
userPoolId :: Text
$sel:jobId:DescribeUserImportJob' :: DescribeUserImportJob -> Text
$sel:userPoolId:DescribeUserImportJob' :: DescribeUserImportJob -> 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
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)
          ]
      )

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

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

-- | Represents the response from the server to the request to describe the
-- user import job.
--
-- /See:/ 'newDescribeUserImportJobResponse' smart constructor.
data DescribeUserImportJobResponse = DescribeUserImportJobResponse'
  { -- | The job object that represents the user import job.
    DescribeUserImportJobResponse -> Maybe UserImportJobType
userImportJob :: Prelude.Maybe UserImportJobType,
    -- | The response's http status code.
    DescribeUserImportJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeUserImportJobResponse
-> DescribeUserImportJobResponse -> Bool
(DescribeUserImportJobResponse
 -> DescribeUserImportJobResponse -> Bool)
-> (DescribeUserImportJobResponse
    -> DescribeUserImportJobResponse -> Bool)
-> Eq DescribeUserImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserImportJobResponse
-> DescribeUserImportJobResponse -> Bool
$c/= :: DescribeUserImportJobResponse
-> DescribeUserImportJobResponse -> Bool
== :: DescribeUserImportJobResponse
-> DescribeUserImportJobResponse -> Bool
$c== :: DescribeUserImportJobResponse
-> DescribeUserImportJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeUserImportJobResponse]
ReadPrec DescribeUserImportJobResponse
Int -> ReadS DescribeUserImportJobResponse
ReadS [DescribeUserImportJobResponse]
(Int -> ReadS DescribeUserImportJobResponse)
-> ReadS [DescribeUserImportJobResponse]
-> ReadPrec DescribeUserImportJobResponse
-> ReadPrec [DescribeUserImportJobResponse]
-> Read DescribeUserImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeUserImportJobResponse]
$creadListPrec :: ReadPrec [DescribeUserImportJobResponse]
readPrec :: ReadPrec DescribeUserImportJobResponse
$creadPrec :: ReadPrec DescribeUserImportJobResponse
readList :: ReadS [DescribeUserImportJobResponse]
$creadList :: ReadS [DescribeUserImportJobResponse]
readsPrec :: Int -> ReadS DescribeUserImportJobResponse
$creadsPrec :: Int -> ReadS DescribeUserImportJobResponse
Prelude.Read, Int -> DescribeUserImportJobResponse -> ShowS
[DescribeUserImportJobResponse] -> ShowS
DescribeUserImportJobResponse -> String
(Int -> DescribeUserImportJobResponse -> ShowS)
-> (DescribeUserImportJobResponse -> String)
-> ([DescribeUserImportJobResponse] -> ShowS)
-> Show DescribeUserImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserImportJobResponse] -> ShowS
$cshowList :: [DescribeUserImportJobResponse] -> ShowS
show :: DescribeUserImportJobResponse -> String
$cshow :: DescribeUserImportJobResponse -> String
showsPrec :: Int -> DescribeUserImportJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeUserImportJobResponse -> ShowS
Prelude.Show, (forall x.
 DescribeUserImportJobResponse
 -> Rep DescribeUserImportJobResponse x)
-> (forall x.
    Rep DescribeUserImportJobResponse x
    -> DescribeUserImportJobResponse)
-> Generic DescribeUserImportJobResponse
forall x.
Rep DescribeUserImportJobResponse x
-> DescribeUserImportJobResponse
forall x.
DescribeUserImportJobResponse
-> Rep DescribeUserImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeUserImportJobResponse x
-> DescribeUserImportJobResponse
$cfrom :: forall x.
DescribeUserImportJobResponse
-> Rep DescribeUserImportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeUserImportJobResponse' 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:
--
-- 'userImportJob', 'describeUserImportJobResponse_userImportJob' - The job object that represents the user import job.
--
-- 'httpStatus', 'describeUserImportJobResponse_httpStatus' - The response's http status code.
newDescribeUserImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeUserImportJobResponse
newDescribeUserImportJobResponse :: Int -> DescribeUserImportJobResponse
newDescribeUserImportJobResponse Int
pHttpStatus_ =
  DescribeUserImportJobResponse' :: Maybe UserImportJobType -> Int -> DescribeUserImportJobResponse
DescribeUserImportJobResponse'
    { $sel:userImportJob:DescribeUserImportJobResponse' :: Maybe UserImportJobType
userImportJob =
        Maybe UserImportJobType
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeUserImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The job object that represents the user import job.
describeUserImportJobResponse_userImportJob :: Lens.Lens' DescribeUserImportJobResponse (Prelude.Maybe UserImportJobType)
describeUserImportJobResponse_userImportJob :: (Maybe UserImportJobType -> f (Maybe UserImportJobType))
-> DescribeUserImportJobResponse -> f DescribeUserImportJobResponse
describeUserImportJobResponse_userImportJob = (DescribeUserImportJobResponse -> Maybe UserImportJobType)
-> (DescribeUserImportJobResponse
    -> Maybe UserImportJobType -> DescribeUserImportJobResponse)
-> Lens
     DescribeUserImportJobResponse
     DescribeUserImportJobResponse
     (Maybe UserImportJobType)
     (Maybe UserImportJobType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserImportJobResponse' {Maybe UserImportJobType
userImportJob :: Maybe UserImportJobType
$sel:userImportJob:DescribeUserImportJobResponse' :: DescribeUserImportJobResponse -> Maybe UserImportJobType
userImportJob} -> Maybe UserImportJobType
userImportJob) (\s :: DescribeUserImportJobResponse
s@DescribeUserImportJobResponse' {} Maybe UserImportJobType
a -> DescribeUserImportJobResponse
s {$sel:userImportJob:DescribeUserImportJobResponse' :: Maybe UserImportJobType
userImportJob = Maybe UserImportJobType
a} :: DescribeUserImportJobResponse)

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

instance Prelude.NFData DescribeUserImportJobResponse