{-# 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.MGN.InitializeService
-- 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)
--
-- Initialize Application Migration Service.
module Amazonka.MGN.InitializeService
  ( -- * Creating a Request
    InitializeService (..),
    newInitializeService,

    -- * Destructuring the Response
    InitializeServiceResponse (..),
    newInitializeServiceResponse,

    -- * Response Lenses
    initializeServiceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

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

instance Core.AWSRequest InitializeService where
  type
    AWSResponse InitializeService =
      InitializeServiceResponse
  request :: InitializeService -> Request InitializeService
request = Service -> InitializeService -> Request InitializeService
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy InitializeService
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse InitializeService)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse InitializeService))
-> Logger
-> Service
-> Proxy InitializeService
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse InitializeService)))
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 -> InitializeServiceResponse
InitializeServiceResponse'
            (Int -> InitializeServiceResponse)
-> Either String Int -> Either String InitializeServiceResponse
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 InitializeService

instance Prelude.NFData InitializeService

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

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

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

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

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

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

instance Prelude.NFData InitializeServiceResponse