{-# 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.RobOMaker.RestartSimulationJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Restarts a running simulation job.
module Amazonka.RobOMaker.RestartSimulationJob
  ( -- * Creating a Request
    RestartSimulationJob (..),
    newRestartSimulationJob,

    -- * Request Lenses
    restartSimulationJob_job,

    -- * Destructuring the Response
    RestartSimulationJobResponse (..),
    newRestartSimulationJobResponse,

    -- * Response Lenses
    restartSimulationJobResponse_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.RobOMaker.Types

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

-- |
-- Create a value of 'RestartSimulationJob' 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:
--
-- 'job', 'restartSimulationJob_job' - The Amazon Resource Name (ARN) of the simulation job.
newRestartSimulationJob ::
  -- | 'job'
  Prelude.Text ->
  RestartSimulationJob
newRestartSimulationJob :: Text -> RestartSimulationJob
newRestartSimulationJob Text
pJob_ =
  RestartSimulationJob' {$sel:job:RestartSimulationJob' :: Text
job = Text
pJob_}

-- | The Amazon Resource Name (ARN) of the simulation job.
restartSimulationJob_job :: Lens.Lens' RestartSimulationJob Prelude.Text
restartSimulationJob_job :: Lens' RestartSimulationJob Text
restartSimulationJob_job = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestartSimulationJob' {Text
job :: Text
$sel:job:RestartSimulationJob' :: RestartSimulationJob -> Text
job} -> Text
job) (\s :: RestartSimulationJob
s@RestartSimulationJob' {} Text
a -> RestartSimulationJob
s {$sel:job:RestartSimulationJob' :: Text
job = Text
a} :: RestartSimulationJob)

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

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

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

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

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

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

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

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

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