{-# 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.SMS.ImportServerCatalog
-- 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)
--
-- Gathers a complete list of on-premises servers. Connectors must be
-- installed and monitoring all servers to import.
--
-- This call returns immediately, but might take additional time to
-- retrieve all the servers.
module Amazonka.SMS.ImportServerCatalog
  ( -- * Creating a Request
    ImportServerCatalog (..),
    newImportServerCatalog,

    -- * Destructuring the Response
    ImportServerCatalogResponse (..),
    newImportServerCatalogResponse,

    -- * Response Lenses
    importServerCatalogResponse_httpStatus,
  )
where

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
import Amazonka.SMS.Types

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

-- |
-- Create a value of 'ImportServerCatalog' 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.
newImportServerCatalog ::
  ImportServerCatalog
newImportServerCatalog :: ImportServerCatalog
newImportServerCatalog = ImportServerCatalog
ImportServerCatalog'

instance Core.AWSRequest ImportServerCatalog where
  type
    AWSResponse ImportServerCatalog =
      ImportServerCatalogResponse
  request :: ImportServerCatalog -> Request ImportServerCatalog
request = Service -> ImportServerCatalog -> Request ImportServerCatalog
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ImportServerCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ImportServerCatalog)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ImportServerCatalog))
-> Logger
-> Service
-> Proxy ImportServerCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ImportServerCatalog)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> ImportServerCatalogResponse
ImportServerCatalogResponse'
            (Int -> ImportServerCatalogResponse)
-> Either String Int -> Either String ImportServerCatalogResponse
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))
      )

instance Prelude.Hashable ImportServerCatalog

instance Prelude.NFData ImportServerCatalog

instance Core.ToHeaders ImportServerCatalog where
  toHeaders :: ImportServerCatalog -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ImportServerCatalog -> 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
"AWSServerMigrationService_V2016_10_24.ImportServerCatalog" ::
                          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 ImportServerCatalog where
  toJSON :: ImportServerCatalog -> Value
toJSON = Value -> ImportServerCatalog -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

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

instance Prelude.NFData ImportServerCatalogResponse