{-# 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-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)
--
-- 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.Lens as Lens
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
(RestartSimulationJob -> RestartSimulationJob -> Bool)
-> (RestartSimulationJob -> RestartSimulationJob -> Bool)
-> Eq RestartSimulationJob
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]
(Int -> ReadS RestartSimulationJob)
-> ReadS [RestartSimulationJob]
-> ReadPrec RestartSimulationJob
-> ReadPrec [RestartSimulationJob]
-> Read 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
(Int -> RestartSimulationJob -> ShowS)
-> (RestartSimulationJob -> String)
-> ([RestartSimulationJob] -> ShowS)
-> Show RestartSimulationJob
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. RestartSimulationJob -> Rep RestartSimulationJob x)
-> (forall x. Rep RestartSimulationJob x -> RestartSimulationJob)
-> Generic RestartSimulationJob
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' :: Text -> RestartSimulationJob
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 :: (Text -> f Text) -> RestartSimulationJob -> f RestartSimulationJob
restartSimulationJob_job = (RestartSimulationJob -> Text)
-> (RestartSimulationJob -> Text -> RestartSimulationJob)
-> Lens RestartSimulationJob RestartSimulationJob Text Text
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 :: RestartSimulationJob -> Request RestartSimulationJob
request = Service -> RestartSimulationJob -> Request RestartSimulationJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RestartSimulationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RestartSimulationJob)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse RestartSimulationJob))
-> Logger
-> Service
-> Proxy RestartSimulationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RestartSimulationJob)))
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 -> RestartSimulationJobResponse
RestartSimulationJobResponse'
            (Int -> RestartSimulationJobResponse)
-> Either String Int -> Either String RestartSimulationJobResponse
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 RestartSimulationJob

instance Prelude.NFData RestartSimulationJob

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

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

instance Core.ToQuery RestartSimulationJob where
  toQuery :: RestartSimulationJob -> QueryString
toQuery = QueryString -> RestartSimulationJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(RestartSimulationJobResponse
 -> RestartSimulationJobResponse -> Bool)
-> (RestartSimulationJobResponse
    -> RestartSimulationJobResponse -> Bool)
-> Eq RestartSimulationJobResponse
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]
(Int -> ReadS RestartSimulationJobResponse)
-> ReadS [RestartSimulationJobResponse]
-> ReadPrec RestartSimulationJobResponse
-> ReadPrec [RestartSimulationJobResponse]
-> Read 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
(Int -> RestartSimulationJobResponse -> ShowS)
-> (RestartSimulationJobResponse -> String)
-> ([RestartSimulationJobResponse] -> ShowS)
-> Show RestartSimulationJobResponse
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.
 RestartSimulationJobResponse -> Rep RestartSimulationJobResponse x)
-> (forall x.
    Rep RestartSimulationJobResponse x -> RestartSimulationJobResponse)
-> Generic RestartSimulationJobResponse
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' :: Int -> RestartSimulationJobResponse
RestartSimulationJobResponse'
    { $sel:httpStatus:RestartSimulationJobResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
restartSimulationJobResponse_httpStatus :: Lens.Lens' RestartSimulationJobResponse Prelude.Int
restartSimulationJobResponse_httpStatus :: (Int -> f Int)
-> RestartSimulationJobResponse -> f RestartSimulationJobResponse
restartSimulationJobResponse_httpStatus = (RestartSimulationJobResponse -> Int)
-> (RestartSimulationJobResponse
    -> Int -> RestartSimulationJobResponse)
-> Lens
     RestartSimulationJobResponse RestartSimulationJobResponse Int Int
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