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

    -- * Request Lenses
    cancelSimulationJob_job,

    -- * Destructuring the Response
    CancelSimulationJobResponse (..),
    newCancelSimulationJobResponse,

    -- * Response Lenses
    cancelSimulationJobResponse_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:/ 'newCancelSimulationJob' smart constructor.
data CancelSimulationJob = CancelSimulationJob'
  { -- | The simulation job ARN to cancel.
    CancelSimulationJob -> Text
job :: Prelude.Text
  }
  deriving (CancelSimulationJob -> CancelSimulationJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelSimulationJob -> CancelSimulationJob -> Bool
$c/= :: CancelSimulationJob -> CancelSimulationJob -> Bool
== :: CancelSimulationJob -> CancelSimulationJob -> Bool
$c== :: CancelSimulationJob -> CancelSimulationJob -> Bool
Prelude.Eq, ReadPrec [CancelSimulationJob]
ReadPrec CancelSimulationJob
Int -> ReadS CancelSimulationJob
ReadS [CancelSimulationJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelSimulationJob]
$creadListPrec :: ReadPrec [CancelSimulationJob]
readPrec :: ReadPrec CancelSimulationJob
$creadPrec :: ReadPrec CancelSimulationJob
readList :: ReadS [CancelSimulationJob]
$creadList :: ReadS [CancelSimulationJob]
readsPrec :: Int -> ReadS CancelSimulationJob
$creadsPrec :: Int -> ReadS CancelSimulationJob
Prelude.Read, Int -> CancelSimulationJob -> ShowS
[CancelSimulationJob] -> ShowS
CancelSimulationJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelSimulationJob] -> ShowS
$cshowList :: [CancelSimulationJob] -> ShowS
show :: CancelSimulationJob -> String
$cshow :: CancelSimulationJob -> String
showsPrec :: Int -> CancelSimulationJob -> ShowS
$cshowsPrec :: Int -> CancelSimulationJob -> ShowS
Prelude.Show, forall x. Rep CancelSimulationJob x -> CancelSimulationJob
forall x. CancelSimulationJob -> Rep CancelSimulationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelSimulationJob x -> CancelSimulationJob
$cfrom :: forall x. CancelSimulationJob -> Rep CancelSimulationJob x
Prelude.Generic)

-- |
-- Create a value of 'CancelSimulationJob' 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', 'cancelSimulationJob_job' - The simulation job ARN to cancel.
newCancelSimulationJob ::
  -- | 'job'
  Prelude.Text ->
  CancelSimulationJob
newCancelSimulationJob :: Text -> CancelSimulationJob
newCancelSimulationJob Text
pJob_ =
  CancelSimulationJob' {$sel:job:CancelSimulationJob' :: Text
job = Text
pJob_}

-- | The simulation job ARN to cancel.
cancelSimulationJob_job :: Lens.Lens' CancelSimulationJob Prelude.Text
cancelSimulationJob_job :: Lens' CancelSimulationJob Text
cancelSimulationJob_job = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelSimulationJob' {Text
job :: Text
$sel:job:CancelSimulationJob' :: CancelSimulationJob -> Text
job} -> Text
job) (\s :: CancelSimulationJob
s@CancelSimulationJob' {} Text
a -> CancelSimulationJob
s {$sel:job:CancelSimulationJob' :: Text
job = Text
a} :: CancelSimulationJob)

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

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

instance Data.ToHeaders CancelSimulationJob where
  toHeaders :: CancelSimulationJob -> 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 CancelSimulationJob where
  toJSON :: CancelSimulationJob -> Value
toJSON CancelSimulationJob' {Text
job :: Text
$sel:job:CancelSimulationJob' :: CancelSimulationJob -> 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 CancelSimulationJob where
  toPath :: CancelSimulationJob -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/cancelSimulationJob"

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

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

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

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

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