{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $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 :: Lens' GetImportJob Text
getImportJob_applicationId = 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 :: Lens' GetImportJob Text
getImportJob_jobId = 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 :: (Service -> Service) -> GetImportJob -> Request GetImportJob
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetImportJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetImportJob)))
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 ->
          Int -> ImportJobResponse -> GetImportJobResponse
GetImportJobResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

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

instance Prelude.NFData GetImportJob where
  rnf :: GetImportJob -> ()
rnf GetImportJob' {Text
jobId :: Text
applicationId :: Text
$sel:jobId:GetImportJob' :: GetImportJob -> Text
$sel:applicationId:GetImportJob' :: GetImportJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobId

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

instance Data.ToPath GetImportJob where
  toPath :: GetImportJob -> ByteString
toPath GetImportJob' {Text
jobId :: Text
applicationId :: Text
$sel:jobId:GetImportJob' :: GetImportJob -> Text
$sel:applicationId:GetImportJob' :: GetImportJob -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
        ByteString
"/jobs/import/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
jobId
      ]

instance Data.ToQuery GetImportJob where
  toQuery :: GetImportJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
      { $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 :: Lens' GetImportJobResponse Int
getImportJobResponse_httpStatus = 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 :: Lens' GetImportJobResponse ImportJobResponse
getImportJobResponse_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 where
  rnf :: GetImportJobResponse -> ()
rnf GetImportJobResponse' {Int
ImportJobResponse
importJobResponse :: ImportJobResponse
httpStatus :: Int
$sel:importJobResponse:GetImportJobResponse' :: GetImportJobResponse -> ImportJobResponse
$sel:httpStatus:GetImportJobResponse' :: GetImportJobResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ImportJobResponse
importJobResponse