{-# 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.MigrationHubStrategy.StopAssessment
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops the assessment of an on-premises environment.
module Amazonka.MigrationHubStrategy.StopAssessment
  ( -- * Creating a Request
    StopAssessment (..),
    newStopAssessment,

    -- * Request Lenses
    stopAssessment_assessmentId,

    -- * Destructuring the Response
    StopAssessmentResponse (..),
    newStopAssessmentResponse,

    -- * Response Lenses
    stopAssessmentResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'StopAssessment' 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:
--
-- 'assessmentId', 'stopAssessment_assessmentId' - The @assessmentId@ returned by StartAssessment.
newStopAssessment ::
  -- | 'assessmentId'
  Prelude.Text ->
  StopAssessment
newStopAssessment :: Text -> StopAssessment
newStopAssessment Text
pAssessmentId_ =
  StopAssessment' {$sel:assessmentId:StopAssessment' :: Text
assessmentId = Text
pAssessmentId_}

-- | The @assessmentId@ returned by StartAssessment.
stopAssessment_assessmentId :: Lens.Lens' StopAssessment Prelude.Text
stopAssessment_assessmentId :: Lens' StopAssessment Text
stopAssessment_assessmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopAssessment' {Text
assessmentId :: Text
$sel:assessmentId:StopAssessment' :: StopAssessment -> Text
assessmentId} -> Text
assessmentId) (\s :: StopAssessment
s@StopAssessment' {} Text
a -> StopAssessment
s {$sel:assessmentId:StopAssessment' :: Text
assessmentId = Text
a} :: StopAssessment)

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

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

instance Data.ToHeaders StopAssessment where
  toHeaders :: StopAssessment -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StopAssessment where
  toJSON :: StopAssessment -> Value
toJSON StopAssessment' {Text
assessmentId :: Text
$sel:assessmentId:StopAssessment' :: StopAssessment -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"assessmentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
assessmentId)]
      )

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

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

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

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

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

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