{-# 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.CancelDeploymentJob
-- 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 deployment job.
module Amazonka.RobOMaker.CancelDeploymentJob
  ( -- * Creating a Request
    CancelDeploymentJob (..),
    newCancelDeploymentJob,

    -- * Request Lenses
    cancelDeploymentJob_job,

    -- * Destructuring the Response
    CancelDeploymentJobResponse (..),
    newCancelDeploymentJobResponse,

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

-- |
-- Create a value of 'CancelDeploymentJob' 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', 'cancelDeploymentJob_job' - The deployment job ARN to cancel.
newCancelDeploymentJob ::
  -- | 'job'
  Prelude.Text ->
  CancelDeploymentJob
newCancelDeploymentJob :: Text -> CancelDeploymentJob
newCancelDeploymentJob Text
pJob_ =
  CancelDeploymentJob' :: Text -> CancelDeploymentJob
CancelDeploymentJob' {$sel:job:CancelDeploymentJob' :: Text
job = Text
pJob_}

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

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

instance Prelude.NFData CancelDeploymentJob

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

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

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

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

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

instance Prelude.NFData CancelDeploymentJobResponse