{-# 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.DeleteAlgorithm
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes the specified algorithm from your account.
module Amazonka.SageMaker.DeleteAlgorithm
  ( -- * Creating a Request
    DeleteAlgorithm (..),
    newDeleteAlgorithm,

    -- * Request Lenses
    deleteAlgorithm_algorithmName,

    -- * Destructuring the Response
    DeleteAlgorithmResponse (..),
    newDeleteAlgorithmResponse,
  )
where

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

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

-- |
-- Create a value of 'DeleteAlgorithm' 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:
--
-- 'algorithmName', 'deleteAlgorithm_algorithmName' - The name of the algorithm to delete.
newDeleteAlgorithm ::
  -- | 'algorithmName'
  Prelude.Text ->
  DeleteAlgorithm
newDeleteAlgorithm :: Text -> DeleteAlgorithm
newDeleteAlgorithm Text
pAlgorithmName_ =
  DeleteAlgorithm' {$sel:algorithmName:DeleteAlgorithm' :: Text
algorithmName = Text
pAlgorithmName_}

-- | The name of the algorithm to delete.
deleteAlgorithm_algorithmName :: Lens.Lens' DeleteAlgorithm Prelude.Text
deleteAlgorithm_algorithmName :: Lens' DeleteAlgorithm Text
deleteAlgorithm_algorithmName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlgorithm' {Text
algorithmName :: Text
$sel:algorithmName:DeleteAlgorithm' :: DeleteAlgorithm -> Text
algorithmName} -> Text
algorithmName) (\s :: DeleteAlgorithm
s@DeleteAlgorithm' {} Text
a -> DeleteAlgorithm
s {$sel:algorithmName:DeleteAlgorithm' :: Text
algorithmName = Text
a} :: DeleteAlgorithm)

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

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

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

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

instance Data.ToJSON DeleteAlgorithm where
  toJSON :: DeleteAlgorithm -> Value
toJSON DeleteAlgorithm' {Text
algorithmName :: Text
$sel:algorithmName:DeleteAlgorithm' :: DeleteAlgorithm -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"AlgorithmName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
algorithmName)
          ]
      )

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

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

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

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

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