{-# 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.DeleteEndpointConfig
-- 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)
--
-- Deletes an endpoint configuration. The @DeleteEndpointConfig@ API
-- deletes only the specified configuration. It does not delete endpoints
-- created using the configuration.
--
-- You must not delete an @EndpointConfig@ in use by an endpoint that is
-- live or while the @UpdateEndpoint@ or @CreateEndpoint@ operations are
-- being performed on the endpoint. If you delete the @EndpointConfig@ of
-- an endpoint that is active or being created or updated you may lose
-- visibility into the instance type the endpoint is using. The endpoint
-- must be deleted in order to stop incurring charges.
module Amazonka.SageMaker.DeleteEndpointConfig
  ( -- * Creating a Request
    DeleteEndpointConfig (..),
    newDeleteEndpointConfig,

    -- * Request Lenses
    deleteEndpointConfig_endpointConfigName,

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

-- |
-- Create a value of 'DeleteEndpointConfig' 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:
--
-- 'endpointConfigName', 'deleteEndpointConfig_endpointConfigName' - The name of the endpoint configuration that you want to delete.
newDeleteEndpointConfig ::
  -- | 'endpointConfigName'
  Prelude.Text ->
  DeleteEndpointConfig
newDeleteEndpointConfig :: Text -> DeleteEndpointConfig
newDeleteEndpointConfig Text
pEndpointConfigName_ =
  DeleteEndpointConfig' :: Text -> DeleteEndpointConfig
DeleteEndpointConfig'
    { $sel:endpointConfigName:DeleteEndpointConfig' :: Text
endpointConfigName =
        Text
pEndpointConfigName_
    }

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

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

instance Prelude.Hashable DeleteEndpointConfig

instance Prelude.NFData DeleteEndpointConfig

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

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

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

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

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

instance Prelude.NFData DeleteEndpointConfigResponse