{-# 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.Glue.GetCatalogImportStatus
-- 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 the status of a migration operation.
module Amazonka.Glue.GetCatalogImportStatus
  ( -- * Creating a Request
    GetCatalogImportStatus (..),
    newGetCatalogImportStatus,

    -- * Request Lenses
    getCatalogImportStatus_catalogId,

    -- * Destructuring the Response
    GetCatalogImportStatusResponse (..),
    newGetCatalogImportStatusResponse,

    -- * Response Lenses
    getCatalogImportStatusResponse_importStatus,
    getCatalogImportStatusResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetCatalogImportStatus' smart constructor.
data GetCatalogImportStatus = GetCatalogImportStatus'
  { -- | The ID of the catalog to migrate. Currently, this should be the Amazon
    -- Web Services account ID.
    GetCatalogImportStatus -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text
  }
  deriving (GetCatalogImportStatus -> GetCatalogImportStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCatalogImportStatus -> GetCatalogImportStatus -> Bool
$c/= :: GetCatalogImportStatus -> GetCatalogImportStatus -> Bool
== :: GetCatalogImportStatus -> GetCatalogImportStatus -> Bool
$c== :: GetCatalogImportStatus -> GetCatalogImportStatus -> Bool
Prelude.Eq, ReadPrec [GetCatalogImportStatus]
ReadPrec GetCatalogImportStatus
Int -> ReadS GetCatalogImportStatus
ReadS [GetCatalogImportStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCatalogImportStatus]
$creadListPrec :: ReadPrec [GetCatalogImportStatus]
readPrec :: ReadPrec GetCatalogImportStatus
$creadPrec :: ReadPrec GetCatalogImportStatus
readList :: ReadS [GetCatalogImportStatus]
$creadList :: ReadS [GetCatalogImportStatus]
readsPrec :: Int -> ReadS GetCatalogImportStatus
$creadsPrec :: Int -> ReadS GetCatalogImportStatus
Prelude.Read, Int -> GetCatalogImportStatus -> ShowS
[GetCatalogImportStatus] -> ShowS
GetCatalogImportStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCatalogImportStatus] -> ShowS
$cshowList :: [GetCatalogImportStatus] -> ShowS
show :: GetCatalogImportStatus -> String
$cshow :: GetCatalogImportStatus -> String
showsPrec :: Int -> GetCatalogImportStatus -> ShowS
$cshowsPrec :: Int -> GetCatalogImportStatus -> ShowS
Prelude.Show, forall x. Rep GetCatalogImportStatus x -> GetCatalogImportStatus
forall x. GetCatalogImportStatus -> Rep GetCatalogImportStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCatalogImportStatus x -> GetCatalogImportStatus
$cfrom :: forall x. GetCatalogImportStatus -> Rep GetCatalogImportStatus x
Prelude.Generic)

-- |
-- Create a value of 'GetCatalogImportStatus' 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:
--
-- 'catalogId', 'getCatalogImportStatus_catalogId' - The ID of the catalog to migrate. Currently, this should be the Amazon
-- Web Services account ID.
newGetCatalogImportStatus ::
  GetCatalogImportStatus
newGetCatalogImportStatus :: GetCatalogImportStatus
newGetCatalogImportStatus =
  GetCatalogImportStatus'
    { $sel:catalogId:GetCatalogImportStatus' :: Maybe Text
catalogId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the catalog to migrate. Currently, this should be the Amazon
-- Web Services account ID.
getCatalogImportStatus_catalogId :: Lens.Lens' GetCatalogImportStatus (Prelude.Maybe Prelude.Text)
getCatalogImportStatus_catalogId :: Lens' GetCatalogImportStatus (Maybe Text)
getCatalogImportStatus_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCatalogImportStatus' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetCatalogImportStatus' :: GetCatalogImportStatus -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetCatalogImportStatus
s@GetCatalogImportStatus' {} Maybe Text
a -> GetCatalogImportStatus
s {$sel:catalogId:GetCatalogImportStatus' :: Maybe Text
catalogId = Maybe Text
a} :: GetCatalogImportStatus)

instance Core.AWSRequest GetCatalogImportStatus where
  type
    AWSResponse GetCatalogImportStatus =
      GetCatalogImportStatusResponse
  request :: (Service -> Service)
-> GetCatalogImportStatus -> Request GetCatalogImportStatus
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 GetCatalogImportStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCatalogImportStatus)))
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 CatalogImportStatus -> Int -> GetCatalogImportStatusResponse
GetCatalogImportStatusResponse'
            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
"ImportStatus")
            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 GetCatalogImportStatus where
  hashWithSalt :: Int -> GetCatalogImportStatus -> Int
hashWithSalt Int
_salt GetCatalogImportStatus' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetCatalogImportStatus' :: GetCatalogImportStatus -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId

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

instance Data.ToHeaders GetCatalogImportStatus where
  toHeaders :: GetCatalogImportStatus -> 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
"AWSGlue.GetCatalogImportStatus" ::
                          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 GetCatalogImportStatus where
  toJSON :: GetCatalogImportStatus -> Value
toJSON GetCatalogImportStatus' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetCatalogImportStatus' :: GetCatalogImportStatus -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId]
      )

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

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

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

-- |
-- Create a value of 'GetCatalogImportStatusResponse' 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:
--
-- 'importStatus', 'getCatalogImportStatusResponse_importStatus' - The status of the specified catalog migration.
--
-- 'httpStatus', 'getCatalogImportStatusResponse_httpStatus' - The response's http status code.
newGetCatalogImportStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCatalogImportStatusResponse
newGetCatalogImportStatusResponse :: Int -> GetCatalogImportStatusResponse
newGetCatalogImportStatusResponse Int
pHttpStatus_ =
  GetCatalogImportStatusResponse'
    { $sel:importStatus:GetCatalogImportStatusResponse' :: Maybe CatalogImportStatus
importStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCatalogImportStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the specified catalog migration.
getCatalogImportStatusResponse_importStatus :: Lens.Lens' GetCatalogImportStatusResponse (Prelude.Maybe CatalogImportStatus)
getCatalogImportStatusResponse_importStatus :: Lens' GetCatalogImportStatusResponse (Maybe CatalogImportStatus)
getCatalogImportStatusResponse_importStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCatalogImportStatusResponse' {Maybe CatalogImportStatus
importStatus :: Maybe CatalogImportStatus
$sel:importStatus:GetCatalogImportStatusResponse' :: GetCatalogImportStatusResponse -> Maybe CatalogImportStatus
importStatus} -> Maybe CatalogImportStatus
importStatus) (\s :: GetCatalogImportStatusResponse
s@GetCatalogImportStatusResponse' {} Maybe CatalogImportStatus
a -> GetCatalogImportStatusResponse
s {$sel:importStatus:GetCatalogImportStatusResponse' :: Maybe CatalogImportStatus
importStatus = Maybe CatalogImportStatus
a} :: GetCatalogImportStatusResponse)

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

instance
  Prelude.NFData
    GetCatalogImportStatusResponse
  where
  rnf :: GetCatalogImportStatusResponse -> ()
rnf GetCatalogImportStatusResponse' {Int
Maybe CatalogImportStatus
httpStatus :: Int
importStatus :: Maybe CatalogImportStatus
$sel:httpStatus:GetCatalogImportStatusResponse' :: GetCatalogImportStatusResponse -> Int
$sel:importStatus:GetCatalogImportStatusResponse' :: GetCatalogImportStatusResponse -> Maybe CatalogImportStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CatalogImportStatus
importStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus