{-# 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.SageMaker.StopTransformJob
-- 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)
--
-- Stops a transform job.
--
-- When Amazon SageMaker receives a @StopTransformJob@ request, the status
-- of the job changes to @Stopping@. After Amazon SageMaker stops the job,
-- the status is set to @Stopped@. When you stop a transform job before it
-- is completed, Amazon SageMaker doesn\'t store the job\'s output in
-- Amazon S3.
module Amazonka.SageMaker.StopTransformJob
  ( -- * Creating a Request
    StopTransformJob (..),
    newStopTransformJob,

    -- * Request Lenses
    stopTransformJob_transformJobName,

    -- * Destructuring the Response
    StopTransformJobResponse (..),
    newStopTransformJobResponse,
  )
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.SageMaker.Types

-- | /See:/ 'newStopTransformJob' smart constructor.
data StopTransformJob = StopTransformJob'
  { -- | The name of the transform job to stop.
    StopTransformJob -> Text
transformJobName :: Prelude.Text
  }
  deriving (StopTransformJob -> StopTransformJob -> Bool
(StopTransformJob -> StopTransformJob -> Bool)
-> (StopTransformJob -> StopTransformJob -> Bool)
-> Eq StopTransformJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTransformJob -> StopTransformJob -> Bool
$c/= :: StopTransformJob -> StopTransformJob -> Bool
== :: StopTransformJob -> StopTransformJob -> Bool
$c== :: StopTransformJob -> StopTransformJob -> Bool
Prelude.Eq, ReadPrec [StopTransformJob]
ReadPrec StopTransformJob
Int -> ReadS StopTransformJob
ReadS [StopTransformJob]
(Int -> ReadS StopTransformJob)
-> ReadS [StopTransformJob]
-> ReadPrec StopTransformJob
-> ReadPrec [StopTransformJob]
-> Read StopTransformJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTransformJob]
$creadListPrec :: ReadPrec [StopTransformJob]
readPrec :: ReadPrec StopTransformJob
$creadPrec :: ReadPrec StopTransformJob
readList :: ReadS [StopTransformJob]
$creadList :: ReadS [StopTransformJob]
readsPrec :: Int -> ReadS StopTransformJob
$creadsPrec :: Int -> ReadS StopTransformJob
Prelude.Read, Int -> StopTransformJob -> ShowS
[StopTransformJob] -> ShowS
StopTransformJob -> String
(Int -> StopTransformJob -> ShowS)
-> (StopTransformJob -> String)
-> ([StopTransformJob] -> ShowS)
-> Show StopTransformJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTransformJob] -> ShowS
$cshowList :: [StopTransformJob] -> ShowS
show :: StopTransformJob -> String
$cshow :: StopTransformJob -> String
showsPrec :: Int -> StopTransformJob -> ShowS
$cshowsPrec :: Int -> StopTransformJob -> ShowS
Prelude.Show, (forall x. StopTransformJob -> Rep StopTransformJob x)
-> (forall x. Rep StopTransformJob x -> StopTransformJob)
-> Generic StopTransformJob
forall x. Rep StopTransformJob x -> StopTransformJob
forall x. StopTransformJob -> Rep StopTransformJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopTransformJob x -> StopTransformJob
$cfrom :: forall x. StopTransformJob -> Rep StopTransformJob x
Prelude.Generic)

-- |
-- Create a value of 'StopTransformJob' 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:
--
-- 'transformJobName', 'stopTransformJob_transformJobName' - The name of the transform job to stop.
newStopTransformJob ::
  -- | 'transformJobName'
  Prelude.Text ->
  StopTransformJob
newStopTransformJob :: Text -> StopTransformJob
newStopTransformJob Text
pTransformJobName_ =
  StopTransformJob' :: Text -> StopTransformJob
StopTransformJob'
    { $sel:transformJobName:StopTransformJob' :: Text
transformJobName =
        Text
pTransformJobName_
    }

-- | The name of the transform job to stop.
stopTransformJob_transformJobName :: Lens.Lens' StopTransformJob Prelude.Text
stopTransformJob_transformJobName :: (Text -> f Text) -> StopTransformJob -> f StopTransformJob
stopTransformJob_transformJobName = (StopTransformJob -> Text)
-> (StopTransformJob -> Text -> StopTransformJob)
-> Lens StopTransformJob StopTransformJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTransformJob' {Text
transformJobName :: Text
$sel:transformJobName:StopTransformJob' :: StopTransformJob -> Text
transformJobName} -> Text
transformJobName) (\s :: StopTransformJob
s@StopTransformJob' {} Text
a -> StopTransformJob
s {$sel:transformJobName:StopTransformJob' :: Text
transformJobName = Text
a} :: StopTransformJob)

instance Core.AWSRequest StopTransformJob where
  type
    AWSResponse StopTransformJob =
      StopTransformJobResponse
  request :: StopTransformJob -> Request StopTransformJob
request = Service -> StopTransformJob -> Request StopTransformJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopTransformJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopTransformJob)))
response =
    AWSResponse StopTransformJob
-> Logger
-> Service
-> Proxy StopTransformJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopTransformJob)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse StopTransformJob
StopTransformJobResponse
StopTransformJobResponse'

instance Prelude.Hashable StopTransformJob

instance Prelude.NFData StopTransformJob

instance Core.ToHeaders StopTransformJob where
  toHeaders :: StopTransformJob -> [Header]
toHeaders =
    [Header] -> StopTransformJob -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"SageMaker.StopTransformJob" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StopTransformJob where
  toJSON :: StopTransformJob -> Value
toJSON StopTransformJob' {Text
transformJobName :: Text
$sel:transformJobName:StopTransformJob' :: StopTransformJob -> 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
"TransformJobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
transformJobName)
          ]
      )

instance Core.ToPath StopTransformJob where
  toPath :: StopTransformJob -> ByteString
toPath = ByteString -> StopTransformJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

instance Prelude.NFData StopTransformJobResponse