{-# 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-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)
--
-- 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.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:/ 'newCancelSimulationJob' smart constructor.
data CancelSimulationJob = CancelSimulationJob'
  { -- | The simulation job ARN to cancel.
    CancelSimulationJob -> Text
job :: Prelude.Text
  }
  deriving (CancelSimulationJob -> CancelSimulationJob -> Bool
(CancelSimulationJob -> CancelSimulationJob -> Bool)
-> (CancelSimulationJob -> CancelSimulationJob -> Bool)
-> Eq CancelSimulationJob
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]
(Int -> ReadS CancelSimulationJob)
-> ReadS [CancelSimulationJob]
-> ReadPrec CancelSimulationJob
-> ReadPrec [CancelSimulationJob]
-> Read 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
(Int -> CancelSimulationJob -> ShowS)
-> (CancelSimulationJob -> String)
-> ([CancelSimulationJob] -> ShowS)
-> Show CancelSimulationJob
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. CancelSimulationJob -> Rep CancelSimulationJob x)
-> (forall x. Rep CancelSimulationJob x -> CancelSimulationJob)
-> Generic CancelSimulationJob
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' :: Text -> CancelSimulationJob
CancelSimulationJob' {$sel:job:CancelSimulationJob' :: Text
job = Text
pJob_}

-- | The simulation job ARN to cancel.
cancelSimulationJob_job :: Lens.Lens' CancelSimulationJob Prelude.Text
cancelSimulationJob_job :: (Text -> f Text) -> CancelSimulationJob -> f CancelSimulationJob
cancelSimulationJob_job = (CancelSimulationJob -> Text)
-> (CancelSimulationJob -> Text -> CancelSimulationJob)
-> Lens CancelSimulationJob CancelSimulationJob Text Text
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 :: CancelSimulationJob -> Request CancelSimulationJob
request = Service -> CancelSimulationJob -> Request CancelSimulationJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CancelSimulationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelSimulationJob)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CancelSimulationJob))
-> Logger
-> Service
-> Proxy CancelSimulationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelSimulationJob)))
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 -> CancelSimulationJobResponse
CancelSimulationJobResponse'
            (Int -> CancelSimulationJobResponse)
-> Either String Int -> Either String CancelSimulationJobResponse
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 CancelSimulationJob

instance Prelude.NFData CancelSimulationJob

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

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

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