{-# 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.DeleteEndpoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an endpoint. SageMaker frees up all of the resources that were
-- deployed when the endpoint was created.
--
-- SageMaker retires any custom KMS key grants associated with the
-- endpoint, meaning you don\'t need to use the
-- <http://docs.aws.amazon.com/kms/latest/APIReference/API_RevokeGrant.html RevokeGrant>
-- API call.
--
-- When you delete your endpoint, SageMaker asynchronously deletes
-- associated endpoint resources such as KMS key grants. You might still
-- see these resources in your account for a few minutes after deleting
-- your endpoint. Do not delete or revoke the permissions for your
-- @ @<https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModel.html#sagemaker-CreateModel-request-ExecutionRoleArn ExecutionRoleArn>@ @,
-- otherwise SageMaker cannot delete these resources.
module Amazonka.SageMaker.DeleteEndpoint
  ( -- * Creating a Request
    DeleteEndpoint (..),
    newDeleteEndpoint,

    -- * Request Lenses
    deleteEndpoint_endpointName,

    -- * Destructuring the Response
    DeleteEndpointResponse (..),
    newDeleteEndpointResponse,
  )
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:/ 'newDeleteEndpoint' smart constructor.
data DeleteEndpoint = DeleteEndpoint'
  { -- | The name of the endpoint that you want to delete.
    DeleteEndpoint -> Text
endpointName :: Prelude.Text
  }
  deriving (DeleteEndpoint -> DeleteEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEndpoint -> DeleteEndpoint -> Bool
$c/= :: DeleteEndpoint -> DeleteEndpoint -> Bool
== :: DeleteEndpoint -> DeleteEndpoint -> Bool
$c== :: DeleteEndpoint -> DeleteEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteEndpoint]
ReadPrec DeleteEndpoint
Int -> ReadS DeleteEndpoint
ReadS [DeleteEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEndpoint]
$creadListPrec :: ReadPrec [DeleteEndpoint]
readPrec :: ReadPrec DeleteEndpoint
$creadPrec :: ReadPrec DeleteEndpoint
readList :: ReadS [DeleteEndpoint]
$creadList :: ReadS [DeleteEndpoint]
readsPrec :: Int -> ReadS DeleteEndpoint
$creadsPrec :: Int -> ReadS DeleteEndpoint
Prelude.Read, Int -> DeleteEndpoint -> ShowS
[DeleteEndpoint] -> ShowS
DeleteEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEndpoint] -> ShowS
$cshowList :: [DeleteEndpoint] -> ShowS
show :: DeleteEndpoint -> String
$cshow :: DeleteEndpoint -> String
showsPrec :: Int -> DeleteEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteEndpoint -> ShowS
Prelude.Show, forall x. Rep DeleteEndpoint x -> DeleteEndpoint
forall x. DeleteEndpoint -> Rep DeleteEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEndpoint x -> DeleteEndpoint
$cfrom :: forall x. DeleteEndpoint -> Rep DeleteEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEndpoint' 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:
--
-- 'endpointName', 'deleteEndpoint_endpointName' - The name of the endpoint that you want to delete.
newDeleteEndpoint ::
  -- | 'endpointName'
  Prelude.Text ->
  DeleteEndpoint
newDeleteEndpoint :: Text -> DeleteEndpoint
newDeleteEndpoint Text
pEndpointName_ =
  DeleteEndpoint' {$sel:endpointName:DeleteEndpoint' :: Text
endpointName = Text
pEndpointName_}

-- | The name of the endpoint that you want to delete.
deleteEndpoint_endpointName :: Lens.Lens' DeleteEndpoint Prelude.Text
deleteEndpoint_endpointName :: Lens' DeleteEndpoint Text
deleteEndpoint_endpointName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEndpoint' {Text
endpointName :: Text
$sel:endpointName:DeleteEndpoint' :: DeleteEndpoint -> Text
endpointName} -> Text
endpointName) (\s :: DeleteEndpoint
s@DeleteEndpoint' {} Text
a -> DeleteEndpoint
s {$sel:endpointName:DeleteEndpoint' :: Text
endpointName = Text
a} :: DeleteEndpoint)

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

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

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

instance Data.ToHeaders DeleteEndpoint where
  toHeaders :: DeleteEndpoint -> [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.DeleteEndpoint" :: 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 DeleteEndpoint where
  toJSON :: DeleteEndpoint -> Value
toJSON DeleteEndpoint' {Text
endpointName :: Text
$sel:endpointName:DeleteEndpoint' :: DeleteEndpoint -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"EndpointName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointName)]
      )

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

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

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

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

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