{-# 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-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)
--
-- 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.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:/ 'newDeleteAlgorithm' smart constructor.
data DeleteAlgorithm = DeleteAlgorithm'
  { -- | The name of the algorithm to delete.
    DeleteAlgorithm -> Text
algorithmName :: Prelude.Text
  }
  deriving (DeleteAlgorithm -> DeleteAlgorithm -> Bool
(DeleteAlgorithm -> DeleteAlgorithm -> Bool)
-> (DeleteAlgorithm -> DeleteAlgorithm -> Bool)
-> Eq DeleteAlgorithm
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]
(Int -> ReadS DeleteAlgorithm)
-> ReadS [DeleteAlgorithm]
-> ReadPrec DeleteAlgorithm
-> ReadPrec [DeleteAlgorithm]
-> Read 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
(Int -> DeleteAlgorithm -> ShowS)
-> (DeleteAlgorithm -> String)
-> ([DeleteAlgorithm] -> ShowS)
-> Show DeleteAlgorithm
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. DeleteAlgorithm -> Rep DeleteAlgorithm x)
-> (forall x. Rep DeleteAlgorithm x -> DeleteAlgorithm)
-> Generic DeleteAlgorithm
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' :: Text -> DeleteAlgorithm
DeleteAlgorithm' {$sel:algorithmName:DeleteAlgorithm' :: Text
algorithmName = Text
pAlgorithmName_}

-- | The name of the algorithm to delete.
deleteAlgorithm_algorithmName :: Lens.Lens' DeleteAlgorithm Prelude.Text
deleteAlgorithm_algorithmName :: (Text -> f Text) -> DeleteAlgorithm -> f DeleteAlgorithm
deleteAlgorithm_algorithmName = (DeleteAlgorithm -> Text)
-> (DeleteAlgorithm -> Text -> DeleteAlgorithm)
-> Lens DeleteAlgorithm DeleteAlgorithm Text Text
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 :: DeleteAlgorithm -> Request DeleteAlgorithm
request = Service -> DeleteAlgorithm -> Request DeleteAlgorithm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAlgorithm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAlgorithm)))
response =
    AWSResponse DeleteAlgorithm
-> Logger
-> Service
-> Proxy DeleteAlgorithm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAlgorithm)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteAlgorithm
DeleteAlgorithmResponse
DeleteAlgorithmResponse'

instance Prelude.Hashable DeleteAlgorithm

instance Prelude.NFData DeleteAlgorithm

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

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

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

-- | /See:/ 'newDeleteAlgorithmResponse' smart constructor.
data DeleteAlgorithmResponse = DeleteAlgorithmResponse'
  {
  }
  deriving (DeleteAlgorithmResponse -> DeleteAlgorithmResponse -> Bool
(DeleteAlgorithmResponse -> DeleteAlgorithmResponse -> Bool)
-> (DeleteAlgorithmResponse -> DeleteAlgorithmResponse -> Bool)
-> Eq DeleteAlgorithmResponse
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]
(Int -> ReadS DeleteAlgorithmResponse)
-> ReadS [DeleteAlgorithmResponse]
-> ReadPrec DeleteAlgorithmResponse
-> ReadPrec [DeleteAlgorithmResponse]
-> Read 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
(Int -> DeleteAlgorithmResponse -> ShowS)
-> (DeleteAlgorithmResponse -> String)
-> ([DeleteAlgorithmResponse] -> ShowS)
-> Show DeleteAlgorithmResponse
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.
 DeleteAlgorithmResponse -> Rep DeleteAlgorithmResponse x)
-> (forall x.
    Rep DeleteAlgorithmResponse x -> DeleteAlgorithmResponse)
-> Generic DeleteAlgorithmResponse
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