{-# 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.StopHyperParameterTuningJob
-- 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 running hyperparameter tuning job and all running training jobs
-- that the tuning job launched.
--
-- All model artifacts output from the training jobs are stored in Amazon
-- Simple Storage Service (Amazon S3). All data that the training jobs
-- write to Amazon CloudWatch Logs are still available in CloudWatch. After
-- the tuning job moves to the @Stopped@ state, it releases all reserved
-- resources for the tuning job.
module Amazonka.SageMaker.StopHyperParameterTuningJob
  ( -- * Creating a Request
    StopHyperParameterTuningJob (..),
    newStopHyperParameterTuningJob,

    -- * Request Lenses
    stopHyperParameterTuningJob_hyperParameterTuningJobName,

    -- * Destructuring the Response
    StopHyperParameterTuningJobResponse (..),
    newStopHyperParameterTuningJobResponse,
  )
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:/ 'newStopHyperParameterTuningJob' smart constructor.
data StopHyperParameterTuningJob = StopHyperParameterTuningJob'
  { -- | The name of the tuning job to stop.
    StopHyperParameterTuningJob -> Text
hyperParameterTuningJobName :: Prelude.Text
  }
  deriving (StopHyperParameterTuningJob -> StopHyperParameterTuningJob -> Bool
(StopHyperParameterTuningJob
 -> StopHyperParameterTuningJob -> Bool)
-> (StopHyperParameterTuningJob
    -> StopHyperParameterTuningJob -> Bool)
-> Eq StopHyperParameterTuningJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopHyperParameterTuningJob -> StopHyperParameterTuningJob -> Bool
$c/= :: StopHyperParameterTuningJob -> StopHyperParameterTuningJob -> Bool
== :: StopHyperParameterTuningJob -> StopHyperParameterTuningJob -> Bool
$c== :: StopHyperParameterTuningJob -> StopHyperParameterTuningJob -> Bool
Prelude.Eq, ReadPrec [StopHyperParameterTuningJob]
ReadPrec StopHyperParameterTuningJob
Int -> ReadS StopHyperParameterTuningJob
ReadS [StopHyperParameterTuningJob]
(Int -> ReadS StopHyperParameterTuningJob)
-> ReadS [StopHyperParameterTuningJob]
-> ReadPrec StopHyperParameterTuningJob
-> ReadPrec [StopHyperParameterTuningJob]
-> Read StopHyperParameterTuningJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopHyperParameterTuningJob]
$creadListPrec :: ReadPrec [StopHyperParameterTuningJob]
readPrec :: ReadPrec StopHyperParameterTuningJob
$creadPrec :: ReadPrec StopHyperParameterTuningJob
readList :: ReadS [StopHyperParameterTuningJob]
$creadList :: ReadS [StopHyperParameterTuningJob]
readsPrec :: Int -> ReadS StopHyperParameterTuningJob
$creadsPrec :: Int -> ReadS StopHyperParameterTuningJob
Prelude.Read, Int -> StopHyperParameterTuningJob -> ShowS
[StopHyperParameterTuningJob] -> ShowS
StopHyperParameterTuningJob -> String
(Int -> StopHyperParameterTuningJob -> ShowS)
-> (StopHyperParameterTuningJob -> String)
-> ([StopHyperParameterTuningJob] -> ShowS)
-> Show StopHyperParameterTuningJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopHyperParameterTuningJob] -> ShowS
$cshowList :: [StopHyperParameterTuningJob] -> ShowS
show :: StopHyperParameterTuningJob -> String
$cshow :: StopHyperParameterTuningJob -> String
showsPrec :: Int -> StopHyperParameterTuningJob -> ShowS
$cshowsPrec :: Int -> StopHyperParameterTuningJob -> ShowS
Prelude.Show, (forall x.
 StopHyperParameterTuningJob -> Rep StopHyperParameterTuningJob x)
-> (forall x.
    Rep StopHyperParameterTuningJob x -> StopHyperParameterTuningJob)
-> Generic StopHyperParameterTuningJob
forall x.
Rep StopHyperParameterTuningJob x -> StopHyperParameterTuningJob
forall x.
StopHyperParameterTuningJob -> Rep StopHyperParameterTuningJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopHyperParameterTuningJob x -> StopHyperParameterTuningJob
$cfrom :: forall x.
StopHyperParameterTuningJob -> Rep StopHyperParameterTuningJob x
Prelude.Generic)

-- |
-- Create a value of 'StopHyperParameterTuningJob' 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:
--
-- 'hyperParameterTuningJobName', 'stopHyperParameterTuningJob_hyperParameterTuningJobName' - The name of the tuning job to stop.
newStopHyperParameterTuningJob ::
  -- | 'hyperParameterTuningJobName'
  Prelude.Text ->
  StopHyperParameterTuningJob
newStopHyperParameterTuningJob :: Text -> StopHyperParameterTuningJob
newStopHyperParameterTuningJob
  Text
pHyperParameterTuningJobName_ =
    StopHyperParameterTuningJob' :: Text -> StopHyperParameterTuningJob
StopHyperParameterTuningJob'
      { $sel:hyperParameterTuningJobName:StopHyperParameterTuningJob' :: Text
hyperParameterTuningJobName =
          Text
pHyperParameterTuningJobName_
      }

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

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

instance Prelude.Hashable StopHyperParameterTuningJob

instance Prelude.NFData StopHyperParameterTuningJob

instance Core.ToHeaders StopHyperParameterTuningJob where
  toHeaders :: StopHyperParameterTuningJob -> [Header]
toHeaders =
    [Header] -> StopHyperParameterTuningJob -> [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.StopHyperParameterTuningJob" ::
                          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 StopHyperParameterTuningJob where
  toJSON :: StopHyperParameterTuningJob -> Value
toJSON StopHyperParameterTuningJob' {Text
hyperParameterTuningJobName :: Text
$sel:hyperParameterTuningJobName:StopHyperParameterTuningJob' :: StopHyperParameterTuningJob -> 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
"HyperParameterTuningJobName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hyperParameterTuningJobName
              )
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    StopHyperParameterTuningJobResponse