{-# 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.ImportCatalogToGlue
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Imports an existing Amazon Athena Data Catalog to Glue.
module Amazonka.Glue.ImportCatalogToGlue
  ( -- * Creating a Request
    ImportCatalogToGlue (..),
    newImportCatalogToGlue,

    -- * Request Lenses
    importCatalogToGlue_catalogId,

    -- * Destructuring the Response
    ImportCatalogToGlueResponse (..),
    newImportCatalogToGlueResponse,

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

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

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

instance Core.AWSRequest ImportCatalogToGlue where
  type
    AWSResponse ImportCatalogToGlue =
      ImportCatalogToGlueResponse
  request :: (Service -> Service)
-> ImportCatalogToGlue -> Request ImportCatalogToGlue
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 ImportCatalogToGlue
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ImportCatalogToGlue)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> ImportCatalogToGlueResponse
ImportCatalogToGlueResponse'
            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))
      )

instance Prelude.Hashable ImportCatalogToGlue where
  hashWithSalt :: Int -> ImportCatalogToGlue -> Int
hashWithSalt Int
_salt ImportCatalogToGlue' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:ImportCatalogToGlue' :: ImportCatalogToGlue -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId

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

instance Data.ToHeaders ImportCatalogToGlue where
  toHeaders :: ImportCatalogToGlue -> 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.ImportCatalogToGlue" ::
                          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 ImportCatalogToGlue where
  toJSON :: ImportCatalogToGlue -> Value
toJSON ImportCatalogToGlue' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:ImportCatalogToGlue' :: ImportCatalogToGlue -> 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 ImportCatalogToGlue where
  toPath :: ImportCatalogToGlue -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ImportCatalogToGlueResponse' 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', 'importCatalogToGlueResponse_httpStatus' - The response's http status code.
newImportCatalogToGlueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ImportCatalogToGlueResponse
newImportCatalogToGlueResponse :: Int -> ImportCatalogToGlueResponse
newImportCatalogToGlueResponse Int
pHttpStatus_ =
  ImportCatalogToGlueResponse'
    { $sel:httpStatus:ImportCatalogToGlueResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData ImportCatalogToGlueResponse where
  rnf :: ImportCatalogToGlueResponse -> ()
rnf ImportCatalogToGlueResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportCatalogToGlueResponse' :: ImportCatalogToGlueResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus