{-# 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.Omics.CancelRun
-- 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 a run.
module Amazonka.Omics.CancelRun
  ( -- * Creating a Request
    CancelRun (..),
    newCancelRun,

    -- * Request Lenses
    cancelRun_id,

    -- * Destructuring the Response
    CancelRunResponse (..),
    newCancelRunResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Omics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCancelRun' smart constructor.
data CancelRun = CancelRun'
  { -- | The run\'s ID.
    CancelRun -> Text
id :: Prelude.Text
  }
  deriving (CancelRun -> CancelRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelRun -> CancelRun -> Bool
$c/= :: CancelRun -> CancelRun -> Bool
== :: CancelRun -> CancelRun -> Bool
$c== :: CancelRun -> CancelRun -> Bool
Prelude.Eq, ReadPrec [CancelRun]
ReadPrec CancelRun
Int -> ReadS CancelRun
ReadS [CancelRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelRun]
$creadListPrec :: ReadPrec [CancelRun]
readPrec :: ReadPrec CancelRun
$creadPrec :: ReadPrec CancelRun
readList :: ReadS [CancelRun]
$creadList :: ReadS [CancelRun]
readsPrec :: Int -> ReadS CancelRun
$creadsPrec :: Int -> ReadS CancelRun
Prelude.Read, Int -> CancelRun -> ShowS
[CancelRun] -> ShowS
CancelRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelRun] -> ShowS
$cshowList :: [CancelRun] -> ShowS
show :: CancelRun -> String
$cshow :: CancelRun -> String
showsPrec :: Int -> CancelRun -> ShowS
$cshowsPrec :: Int -> CancelRun -> ShowS
Prelude.Show, forall x. Rep CancelRun x -> CancelRun
forall x. CancelRun -> Rep CancelRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelRun x -> CancelRun
$cfrom :: forall x. CancelRun -> Rep CancelRun x
Prelude.Generic)

-- |
-- Create a value of 'CancelRun' 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:
--
-- 'id', 'cancelRun_id' - The run\'s ID.
newCancelRun ::
  -- | 'id'
  Prelude.Text ->
  CancelRun
newCancelRun :: Text -> CancelRun
newCancelRun Text
pId_ = CancelRun' {$sel:id:CancelRun' :: Text
id = Text
pId_}

-- | The run\'s ID.
cancelRun_id :: Lens.Lens' CancelRun Prelude.Text
cancelRun_id :: Lens' CancelRun Text
cancelRun_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelRun' {Text
id :: Text
$sel:id:CancelRun' :: CancelRun -> Text
id} -> Text
id) (\s :: CancelRun
s@CancelRun' {} Text
a -> CancelRun
s {$sel:id:CancelRun' :: Text
id = Text
a} :: CancelRun)

instance Core.AWSRequest CancelRun where
  type AWSResponse CancelRun = CancelRunResponse
  request :: (Service -> Service) -> CancelRun -> Request CancelRun
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 CancelRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelRun)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull CancelRunResponse
CancelRunResponse'

instance Prelude.Hashable CancelRun where
  hashWithSalt :: Int -> CancelRun -> Int
hashWithSalt Int
_salt CancelRun' {Text
id :: Text
$sel:id:CancelRun' :: CancelRun -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

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

instance Data.ToHeaders CancelRun where
  toHeaders :: CancelRun -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CancelRun where
  toJSON :: CancelRun -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath CancelRun where
  toPath :: CancelRun -> ByteString
toPath CancelRun' {Text
id :: Text
$sel:id:CancelRun' :: CancelRun -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/run/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id, ByteString
"/cancel"]

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

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

-- |
-- Create a value of 'CancelRunResponse' 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.
newCancelRunResponse ::
  CancelRunResponse
newCancelRunResponse :: CancelRunResponse
newCancelRunResponse = CancelRunResponse
CancelRunResponse'

instance Prelude.NFData CancelRunResponse where
  rnf :: CancelRunResponse -> ()
rnf CancelRunResponse
_ = ()