{-# 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.CancelWorldGenerationJob
-- 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 world generator job.
module Amazonka.RobOMaker.CancelWorldGenerationJob
  ( -- * Creating a Request
    CancelWorldGenerationJob (..),
    newCancelWorldGenerationJob,

    -- * Request Lenses
    cancelWorldGenerationJob_job,

    -- * Destructuring the Response
    CancelWorldGenerationJobResponse (..),
    newCancelWorldGenerationJobResponse,

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

-- |
-- Create a value of 'CancelWorldGenerationJob' 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', 'cancelWorldGenerationJob_job' - The Amazon Resource Name (arn) of the world generator job to cancel.
newCancelWorldGenerationJob ::
  -- | 'job'
  Prelude.Text ->
  CancelWorldGenerationJob
newCancelWorldGenerationJob :: Text -> CancelWorldGenerationJob
newCancelWorldGenerationJob Text
pJob_ =
  CancelWorldGenerationJob' :: Text -> CancelWorldGenerationJob
CancelWorldGenerationJob' {$sel:job:CancelWorldGenerationJob' :: Text
job = Text
pJob_}

-- | The Amazon Resource Name (arn) of the world generator job to cancel.
cancelWorldGenerationJob_job :: Lens.Lens' CancelWorldGenerationJob Prelude.Text
cancelWorldGenerationJob_job :: (Text -> f Text)
-> CancelWorldGenerationJob -> f CancelWorldGenerationJob
cancelWorldGenerationJob_job = (CancelWorldGenerationJob -> Text)
-> (CancelWorldGenerationJob -> Text -> CancelWorldGenerationJob)
-> Lens CancelWorldGenerationJob CancelWorldGenerationJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelWorldGenerationJob' {Text
job :: Text
$sel:job:CancelWorldGenerationJob' :: CancelWorldGenerationJob -> Text
job} -> Text
job) (\s :: CancelWorldGenerationJob
s@CancelWorldGenerationJob' {} Text
a -> CancelWorldGenerationJob
s {$sel:job:CancelWorldGenerationJob' :: Text
job = Text
a} :: CancelWorldGenerationJob)

instance Core.AWSRequest CancelWorldGenerationJob where
  type
    AWSResponse CancelWorldGenerationJob =
      CancelWorldGenerationJobResponse
  request :: CancelWorldGenerationJob -> Request CancelWorldGenerationJob
request = Service
-> CancelWorldGenerationJob -> Request CancelWorldGenerationJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CancelWorldGenerationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelWorldGenerationJob)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CancelWorldGenerationJob))
-> Logger
-> Service
-> Proxy CancelWorldGenerationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelWorldGenerationJob)))
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 -> CancelWorldGenerationJobResponse
CancelWorldGenerationJobResponse'
            (Int -> CancelWorldGenerationJobResponse)
-> Either String Int
-> Either String CancelWorldGenerationJobResponse
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 CancelWorldGenerationJob

instance Prelude.NFData CancelWorldGenerationJob

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

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

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

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

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

instance
  Prelude.NFData
    CancelWorldGenerationJobResponse