{-# 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.Pinpoint.GetImportJob
-- 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)
--
-- Retrieves information about the status and settings of a specific import
-- job for an application.
module Amazonka.Pinpoint.GetImportJob
  ( -- * Creating a Request
    GetImportJob (..),
    newGetImportJob,

    -- * Request Lenses
    getImportJob_applicationId,
    getImportJob_jobId,

    -- * Destructuring the Response
    GetImportJobResponse (..),
    newGetImportJobResponse,

    -- * Response Lenses
    getImportJobResponse_httpStatus,
    getImportJobResponse_importJobResponse,
  )
where

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

-- | /See:/ 'newGetImportJob' smart constructor.
data GetImportJob = GetImportJob'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetImportJob -> Text
applicationId :: Prelude.Text,
    -- | The unique identifier for the job.
    GetImportJob -> Text
jobId :: Prelude.Text
  }
  deriving (GetImportJob -> GetImportJob -> Bool
(GetImportJob -> GetImportJob -> Bool)
-> (GetImportJob -> GetImportJob -> Bool) -> Eq GetImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetImportJob -> GetImportJob -> Bool
$c/= :: GetImportJob -> GetImportJob -> Bool
== :: GetImportJob -> GetImportJob -> Bool
$c== :: GetImportJob -> GetImportJob -> Bool
Prelude.Eq, ReadPrec [GetImportJob]
ReadPrec GetImportJob
Int -> ReadS GetImportJob
ReadS [GetImportJob]
(Int -> ReadS GetImportJob)
-> ReadS [GetImportJob]
-> ReadPrec GetImportJob
-> ReadPrec [GetImportJob]
-> Read GetImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetImportJob]
$creadListPrec :: ReadPrec [GetImportJob]
readPrec :: ReadPrec GetImportJob
$creadPrec :: ReadPrec GetImportJob
readList :: ReadS [GetImportJob]
$creadList :: ReadS [GetImportJob]
readsPrec :: Int -> ReadS GetImportJob
$creadsPrec :: Int -> ReadS GetImportJob
Prelude.Read, Int -> GetImportJob -> ShowS
[GetImportJob] -> ShowS
GetImportJob -> String
(Int -> GetImportJob -> ShowS)
-> (GetImportJob -> String)
-> ([GetImportJob] -> ShowS)
-> Show GetImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetImportJob] -> ShowS
$cshowList :: [GetImportJob] -> ShowS
show :: GetImportJob -> String
$cshow :: GetImportJob -> String
showsPrec :: Int -> GetImportJob -> ShowS
$cshowsPrec :: Int -> GetImportJob -> ShowS
Prelude.Show, (forall x. GetImportJob -> Rep GetImportJob x)
-> (forall x. Rep GetImportJob x -> GetImportJob)
-> Generic GetImportJob
forall x. Rep GetImportJob x -> GetImportJob
forall x. GetImportJob -> Rep GetImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetImportJob x -> GetImportJob
$cfrom :: forall x. GetImportJob -> Rep GetImportJob x
Prelude.Generic)

-- |
-- Create a value of 'GetImportJob' 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:
--
-- 'applicationId', 'getImportJob_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'jobId', 'getImportJob_jobId' - The unique identifier for the job.
newGetImportJob ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  GetImportJob
newGetImportJob :: Text -> Text -> GetImportJob
newGetImportJob Text
pApplicationId_ Text
pJobId_ =
  GetImportJob' :: Text -> Text -> GetImportJob
GetImportJob'
    { $sel:applicationId:GetImportJob' :: Text
applicationId = Text
pApplicationId_,
      $sel:jobId:GetImportJob' :: Text
jobId = Text
pJobId_
    }

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getImportJob_applicationId :: Lens.Lens' GetImportJob Prelude.Text
getImportJob_applicationId :: (Text -> f Text) -> GetImportJob -> f GetImportJob
getImportJob_applicationId = (GetImportJob -> Text)
-> (GetImportJob -> Text -> GetImportJob)
-> Lens GetImportJob GetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJob' {Text
applicationId :: Text
$sel:applicationId:GetImportJob' :: GetImportJob -> Text
applicationId} -> Text
applicationId) (\s :: GetImportJob
s@GetImportJob' {} Text
a -> GetImportJob
s {$sel:applicationId:GetImportJob' :: Text
applicationId = Text
a} :: GetImportJob)

-- | The unique identifier for the job.
getImportJob_jobId :: Lens.Lens' GetImportJob Prelude.Text
getImportJob_jobId :: (Text -> f Text) -> GetImportJob -> f GetImportJob
getImportJob_jobId = (GetImportJob -> Text)
-> (GetImportJob -> Text -> GetImportJob)
-> Lens GetImportJob GetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJob' {Text
jobId :: Text
$sel:jobId:GetImportJob' :: GetImportJob -> Text
jobId} -> Text
jobId) (\s :: GetImportJob
s@GetImportJob' {} Text
a -> GetImportJob
s {$sel:jobId:GetImportJob' :: Text
jobId = Text
a} :: GetImportJob)

instance Core.AWSRequest GetImportJob where
  type AWSResponse GetImportJob = GetImportJobResponse
  request :: GetImportJob -> Request GetImportJob
request = Service -> GetImportJob -> Request GetImportJob
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetImportJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImportJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetImportJob))
-> Logger
-> Service
-> Proxy GetImportJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImportJob)))
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 ->
          Int -> ImportJobResponse -> GetImportJobResponse
GetImportJobResponse'
            (Int -> ImportJobResponse -> GetImportJobResponse)
-> Either String Int
-> Either String (ImportJobResponse -> GetImportJobResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (ImportJobResponse -> GetImportJobResponse)
-> Either String ImportJobResponse
-> Either String GetImportJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ImportJobResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetImportJob

instance Prelude.NFData GetImportJob

instance Core.ToHeaders GetImportJob where
  toHeaders :: GetImportJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetImportJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetImportJob where
  toPath :: GetImportJob -> ByteString
toPath GetImportJob' {Text
jobId :: Text
applicationId :: Text
$sel:jobId:GetImportJob' :: GetImportJob -> Text
$sel:applicationId:GetImportJob' :: GetImportJob -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/jobs/import/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId
      ]

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

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

-- |
-- Create a value of 'GetImportJobResponse' 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:
--
-- 'httpStatus', 'getImportJobResponse_httpStatus' - The response's http status code.
--
-- 'importJobResponse', 'getImportJobResponse_importJobResponse' - Undocumented member.
newGetImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'importJobResponse'
  ImportJobResponse ->
  GetImportJobResponse
newGetImportJobResponse :: Int -> ImportJobResponse -> GetImportJobResponse
newGetImportJobResponse
  Int
pHttpStatus_
  ImportJobResponse
pImportJobResponse_ =
    GetImportJobResponse' :: Int -> ImportJobResponse -> GetImportJobResponse
GetImportJobResponse'
      { $sel:httpStatus:GetImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:importJobResponse:GetImportJobResponse' :: ImportJobResponse
importJobResponse = ImportJobResponse
pImportJobResponse_
      }

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

-- | Undocumented member.
getImportJobResponse_importJobResponse :: Lens.Lens' GetImportJobResponse ImportJobResponse
getImportJobResponse_importJobResponse :: (ImportJobResponse -> f ImportJobResponse)
-> GetImportJobResponse -> f GetImportJobResponse
getImportJobResponse_importJobResponse = (GetImportJobResponse -> ImportJobResponse)
-> (GetImportJobResponse
    -> ImportJobResponse -> GetImportJobResponse)
-> Lens
     GetImportJobResponse
     GetImportJobResponse
     ImportJobResponse
     ImportJobResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetImportJobResponse' {ImportJobResponse
importJobResponse :: ImportJobResponse
$sel:importJobResponse:GetImportJobResponse' :: GetImportJobResponse -> ImportJobResponse
importJobResponse} -> ImportJobResponse
importJobResponse) (\s :: GetImportJobResponse
s@GetImportJobResponse' {} ImportJobResponse
a -> GetImportJobResponse
s {$sel:importJobResponse:GetImportJobResponse' :: ImportJobResponse
importJobResponse = ImportJobResponse
a} :: GetImportJobResponse)

instance Prelude.NFData GetImportJobResponse