{-# 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.SimSpaceWeaver.StopSimulation
-- 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 given simulation.
--
-- You can\'t restart a simulation after you stop it. If you need to
-- restart a simulation, you must stop it, delete it, and start a new
-- instance of it.
module Amazonka.SimSpaceWeaver.StopSimulation
  ( -- * Creating a Request
    StopSimulation (..),
    newStopSimulation,

    -- * Request Lenses
    stopSimulation_simulation,

    -- * Destructuring the Response
    StopSimulationResponse (..),
    newStopSimulationResponse,

    -- * Response Lenses
    stopSimulationResponse_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.SimSpaceWeaver.Types

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

-- |
-- Create a value of 'StopSimulation' 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:
--
-- 'simulation', 'stopSimulation_simulation' - The name of the simulation.
newStopSimulation ::
  -- | 'simulation'
  Prelude.Text ->
  StopSimulation
newStopSimulation :: Text -> StopSimulation
newStopSimulation Text
pSimulation_ =
  StopSimulation' {$sel:simulation:StopSimulation' :: Text
simulation = Text
pSimulation_}

-- | The name of the simulation.
stopSimulation_simulation :: Lens.Lens' StopSimulation Prelude.Text
stopSimulation_simulation :: Lens' StopSimulation Text
stopSimulation_simulation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopSimulation' {Text
simulation :: Text
$sel:simulation:StopSimulation' :: StopSimulation -> Text
simulation} -> Text
simulation) (\s :: StopSimulation
s@StopSimulation' {} Text
a -> StopSimulation
s {$sel:simulation:StopSimulation' :: Text
simulation = Text
a} :: StopSimulation)

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

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

instance Data.ToHeaders StopSimulation where
  toHeaders :: StopSimulation -> 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 StopSimulation where
  toJSON :: StopSimulation -> Value
toJSON StopSimulation' {Text
simulation :: Text
$sel:simulation:StopSimulation' :: StopSimulation -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Simulation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
simulation)]
      )

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

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

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

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

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

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