{-# 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.ImportAppCatalog
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Allows application import from Migration Hub.
module Amazonka.SMS.ImportAppCatalog
  ( -- * Creating a Request
    ImportAppCatalog (..),
    newImportAppCatalog,

    -- * Request Lenses
    importAppCatalog_roleName,

    -- * Destructuring the Response
    ImportAppCatalogResponse (..),
    newImportAppCatalogResponse,

    -- * Response Lenses
    importAppCatalogResponse_httpStatus,
  )
where

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

-- | /See:/ 'newImportAppCatalog' smart constructor.
data ImportAppCatalog = ImportAppCatalog'
  { -- | The name of the service role. If you omit this parameter, we create a
    -- service-linked role for Migration Hub in your account. Otherwise, the
    -- role that you provide must have the
    -- <https://docs.aws.amazon.com/migrationhub/latest/ug/new-customer-setup.html#sms-managed policy and trust policy>
    -- described in the /Migration Hub User Guide/.
    ImportAppCatalog -> Maybe Text
roleName :: Prelude.Maybe Prelude.Text
  }
  deriving (ImportAppCatalog -> ImportAppCatalog -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportAppCatalog -> ImportAppCatalog -> Bool
$c/= :: ImportAppCatalog -> ImportAppCatalog -> Bool
== :: ImportAppCatalog -> ImportAppCatalog -> Bool
$c== :: ImportAppCatalog -> ImportAppCatalog -> Bool
Prelude.Eq, ReadPrec [ImportAppCatalog]
ReadPrec ImportAppCatalog
Int -> ReadS ImportAppCatalog
ReadS [ImportAppCatalog]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportAppCatalog]
$creadListPrec :: ReadPrec [ImportAppCatalog]
readPrec :: ReadPrec ImportAppCatalog
$creadPrec :: ReadPrec ImportAppCatalog
readList :: ReadS [ImportAppCatalog]
$creadList :: ReadS [ImportAppCatalog]
readsPrec :: Int -> ReadS ImportAppCatalog
$creadsPrec :: Int -> ReadS ImportAppCatalog
Prelude.Read, Int -> ImportAppCatalog -> ShowS
[ImportAppCatalog] -> ShowS
ImportAppCatalog -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportAppCatalog] -> ShowS
$cshowList :: [ImportAppCatalog] -> ShowS
show :: ImportAppCatalog -> String
$cshow :: ImportAppCatalog -> String
showsPrec :: Int -> ImportAppCatalog -> ShowS
$cshowsPrec :: Int -> ImportAppCatalog -> ShowS
Prelude.Show, forall x. Rep ImportAppCatalog x -> ImportAppCatalog
forall x. ImportAppCatalog -> Rep ImportAppCatalog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportAppCatalog x -> ImportAppCatalog
$cfrom :: forall x. ImportAppCatalog -> Rep ImportAppCatalog x
Prelude.Generic)

-- |
-- Create a value of 'ImportAppCatalog' 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:
--
-- 'roleName', 'importAppCatalog_roleName' - The name of the service role. If you omit this parameter, we create a
-- service-linked role for Migration Hub in your account. Otherwise, the
-- role that you provide must have the
-- <https://docs.aws.amazon.com/migrationhub/latest/ug/new-customer-setup.html#sms-managed policy and trust policy>
-- described in the /Migration Hub User Guide/.
newImportAppCatalog ::
  ImportAppCatalog
newImportAppCatalog :: ImportAppCatalog
newImportAppCatalog =
  ImportAppCatalog' {$sel:roleName:ImportAppCatalog' :: Maybe Text
roleName = forall a. Maybe a
Prelude.Nothing}

-- | The name of the service role. If you omit this parameter, we create a
-- service-linked role for Migration Hub in your account. Otherwise, the
-- role that you provide must have the
-- <https://docs.aws.amazon.com/migrationhub/latest/ug/new-customer-setup.html#sms-managed policy and trust policy>
-- described in the /Migration Hub User Guide/.
importAppCatalog_roleName :: Lens.Lens' ImportAppCatalog (Prelude.Maybe Prelude.Text)
importAppCatalog_roleName :: Lens' ImportAppCatalog (Maybe Text)
importAppCatalog_roleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportAppCatalog' {Maybe Text
roleName :: Maybe Text
$sel:roleName:ImportAppCatalog' :: ImportAppCatalog -> Maybe Text
roleName} -> Maybe Text
roleName) (\s :: ImportAppCatalog
s@ImportAppCatalog' {} Maybe Text
a -> ImportAppCatalog
s {$sel:roleName:ImportAppCatalog' :: Maybe Text
roleName = Maybe Text
a} :: ImportAppCatalog)

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

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

instance Data.ToHeaders ImportAppCatalog where
  toHeaders :: ImportAppCatalog -> 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
"AWSServerMigrationService_V2016_10_24.ImportAppCatalog" ::
                          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 ImportAppCatalog where
  toJSON :: ImportAppCatalog -> Value
toJSON ImportAppCatalog' {Maybe Text
roleName :: Maybe Text
$sel:roleName:ImportAppCatalog' :: ImportAppCatalog -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"roleName" 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
roleName]
      )

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

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

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

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

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

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