{-# 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.MachineLearning.DeleteRealtimeEndpoint
-- 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 a real time endpoint of an @MLModel@.
module Amazonka.MachineLearning.DeleteRealtimeEndpoint
  ( -- * Creating a Request
    DeleteRealtimeEndpoint (..),
    newDeleteRealtimeEndpoint,

    -- * Request Lenses
    deleteRealtimeEndpoint_mLModelId,

    -- * Destructuring the Response
    DeleteRealtimeEndpointResponse (..),
    newDeleteRealtimeEndpointResponse,

    -- * Response Lenses
    deleteRealtimeEndpointResponse_mLModelId,
    deleteRealtimeEndpointResponse_realtimeEndpointInfo,
    deleteRealtimeEndpointResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteRealtimeEndpoint' smart constructor.
data DeleteRealtimeEndpoint = DeleteRealtimeEndpoint'
  { -- | The ID assigned to the @MLModel@ during creation.
    DeleteRealtimeEndpoint -> Text
mLModelId :: Prelude.Text
  }
  deriving (DeleteRealtimeEndpoint -> DeleteRealtimeEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRealtimeEndpoint -> DeleteRealtimeEndpoint -> Bool
$c/= :: DeleteRealtimeEndpoint -> DeleteRealtimeEndpoint -> Bool
== :: DeleteRealtimeEndpoint -> DeleteRealtimeEndpoint -> Bool
$c== :: DeleteRealtimeEndpoint -> DeleteRealtimeEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteRealtimeEndpoint]
ReadPrec DeleteRealtimeEndpoint
Int -> ReadS DeleteRealtimeEndpoint
ReadS [DeleteRealtimeEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRealtimeEndpoint]
$creadListPrec :: ReadPrec [DeleteRealtimeEndpoint]
readPrec :: ReadPrec DeleteRealtimeEndpoint
$creadPrec :: ReadPrec DeleteRealtimeEndpoint
readList :: ReadS [DeleteRealtimeEndpoint]
$creadList :: ReadS [DeleteRealtimeEndpoint]
readsPrec :: Int -> ReadS DeleteRealtimeEndpoint
$creadsPrec :: Int -> ReadS DeleteRealtimeEndpoint
Prelude.Read, Int -> DeleteRealtimeEndpoint -> ShowS
[DeleteRealtimeEndpoint] -> ShowS
DeleteRealtimeEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRealtimeEndpoint] -> ShowS
$cshowList :: [DeleteRealtimeEndpoint] -> ShowS
show :: DeleteRealtimeEndpoint -> String
$cshow :: DeleteRealtimeEndpoint -> String
showsPrec :: Int -> DeleteRealtimeEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteRealtimeEndpoint -> ShowS
Prelude.Show, forall x. Rep DeleteRealtimeEndpoint x -> DeleteRealtimeEndpoint
forall x. DeleteRealtimeEndpoint -> Rep DeleteRealtimeEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRealtimeEndpoint x -> DeleteRealtimeEndpoint
$cfrom :: forall x. DeleteRealtimeEndpoint -> Rep DeleteRealtimeEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRealtimeEndpoint' 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:
--
-- 'mLModelId', 'deleteRealtimeEndpoint_mLModelId' - The ID assigned to the @MLModel@ during creation.
newDeleteRealtimeEndpoint ::
  -- | 'mLModelId'
  Prelude.Text ->
  DeleteRealtimeEndpoint
newDeleteRealtimeEndpoint :: Text -> DeleteRealtimeEndpoint
newDeleteRealtimeEndpoint Text
pMLModelId_ =
  DeleteRealtimeEndpoint' {$sel:mLModelId:DeleteRealtimeEndpoint' :: Text
mLModelId = Text
pMLModelId_}

-- | The ID assigned to the @MLModel@ during creation.
deleteRealtimeEndpoint_mLModelId :: Lens.Lens' DeleteRealtimeEndpoint Prelude.Text
deleteRealtimeEndpoint_mLModelId :: Lens' DeleteRealtimeEndpoint Text
deleteRealtimeEndpoint_mLModelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeEndpoint' {Text
mLModelId :: Text
$sel:mLModelId:DeleteRealtimeEndpoint' :: DeleteRealtimeEndpoint -> Text
mLModelId} -> Text
mLModelId) (\s :: DeleteRealtimeEndpoint
s@DeleteRealtimeEndpoint' {} Text
a -> DeleteRealtimeEndpoint
s {$sel:mLModelId:DeleteRealtimeEndpoint' :: Text
mLModelId = Text
a} :: DeleteRealtimeEndpoint)

instance Core.AWSRequest DeleteRealtimeEndpoint where
  type
    AWSResponse DeleteRealtimeEndpoint =
      DeleteRealtimeEndpointResponse
  request :: (Service -> Service)
-> DeleteRealtimeEndpoint -> Request DeleteRealtimeEndpoint
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 DeleteRealtimeEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRealtimeEndpoint)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe RealtimeEndpointInfo
-> Int
-> DeleteRealtimeEndpointResponse
DeleteRealtimeEndpointResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"MLModelId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RealtimeEndpointInfo")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

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

instance Data.ToHeaders DeleteRealtimeEndpoint where
  toHeaders :: DeleteRealtimeEndpoint -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"AmazonML_20141212.DeleteRealtimeEndpoint" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

-- | Represents the output of an @DeleteRealtimeEndpoint@ operation.
--
-- The result contains the @MLModelId@ and the endpoint information for the
-- @MLModel@.
--
-- /See:/ 'newDeleteRealtimeEndpointResponse' smart constructor.
data DeleteRealtimeEndpointResponse = DeleteRealtimeEndpointResponse'
  { -- | A user-supplied ID that uniquely identifies the @MLModel@. This value
    -- should be identical to the value of the @MLModelId@ in the request.
    DeleteRealtimeEndpointResponse -> Maybe Text
mLModelId :: Prelude.Maybe Prelude.Text,
    -- | The endpoint information of the @MLModel@
    DeleteRealtimeEndpointResponse -> Maybe RealtimeEndpointInfo
realtimeEndpointInfo :: Prelude.Maybe RealtimeEndpointInfo,
    -- | The response's http status code.
    DeleteRealtimeEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteRealtimeEndpointResponse
-> DeleteRealtimeEndpointResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRealtimeEndpointResponse
-> DeleteRealtimeEndpointResponse -> Bool
$c/= :: DeleteRealtimeEndpointResponse
-> DeleteRealtimeEndpointResponse -> Bool
== :: DeleteRealtimeEndpointResponse
-> DeleteRealtimeEndpointResponse -> Bool
$c== :: DeleteRealtimeEndpointResponse
-> DeleteRealtimeEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRealtimeEndpointResponse]
ReadPrec DeleteRealtimeEndpointResponse
Int -> ReadS DeleteRealtimeEndpointResponse
ReadS [DeleteRealtimeEndpointResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRealtimeEndpointResponse]
$creadListPrec :: ReadPrec [DeleteRealtimeEndpointResponse]
readPrec :: ReadPrec DeleteRealtimeEndpointResponse
$creadPrec :: ReadPrec DeleteRealtimeEndpointResponse
readList :: ReadS [DeleteRealtimeEndpointResponse]
$creadList :: ReadS [DeleteRealtimeEndpointResponse]
readsPrec :: Int -> ReadS DeleteRealtimeEndpointResponse
$creadsPrec :: Int -> ReadS DeleteRealtimeEndpointResponse
Prelude.Read, Int -> DeleteRealtimeEndpointResponse -> ShowS
[DeleteRealtimeEndpointResponse] -> ShowS
DeleteRealtimeEndpointResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRealtimeEndpointResponse] -> ShowS
$cshowList :: [DeleteRealtimeEndpointResponse] -> ShowS
show :: DeleteRealtimeEndpointResponse -> String
$cshow :: DeleteRealtimeEndpointResponse -> String
showsPrec :: Int -> DeleteRealtimeEndpointResponse -> ShowS
$cshowsPrec :: Int -> DeleteRealtimeEndpointResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteRealtimeEndpointResponse x
-> DeleteRealtimeEndpointResponse
forall x.
DeleteRealtimeEndpointResponse
-> Rep DeleteRealtimeEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRealtimeEndpointResponse x
-> DeleteRealtimeEndpointResponse
$cfrom :: forall x.
DeleteRealtimeEndpointResponse
-> Rep DeleteRealtimeEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRealtimeEndpointResponse' 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:
--
-- 'mLModelId', 'deleteRealtimeEndpointResponse_mLModelId' - A user-supplied ID that uniquely identifies the @MLModel@. This value
-- should be identical to the value of the @MLModelId@ in the request.
--
-- 'realtimeEndpointInfo', 'deleteRealtimeEndpointResponse_realtimeEndpointInfo' - The endpoint information of the @MLModel@
--
-- 'httpStatus', 'deleteRealtimeEndpointResponse_httpStatus' - The response's http status code.
newDeleteRealtimeEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteRealtimeEndpointResponse
newDeleteRealtimeEndpointResponse :: Int -> DeleteRealtimeEndpointResponse
newDeleteRealtimeEndpointResponse Int
pHttpStatus_ =
  DeleteRealtimeEndpointResponse'
    { $sel:mLModelId:DeleteRealtimeEndpointResponse' :: Maybe Text
mLModelId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:realtimeEndpointInfo:DeleteRealtimeEndpointResponse' :: Maybe RealtimeEndpointInfo
realtimeEndpointInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteRealtimeEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A user-supplied ID that uniquely identifies the @MLModel@. This value
-- should be identical to the value of the @MLModelId@ in the request.
deleteRealtimeEndpointResponse_mLModelId :: Lens.Lens' DeleteRealtimeEndpointResponse (Prelude.Maybe Prelude.Text)
deleteRealtimeEndpointResponse_mLModelId :: Lens' DeleteRealtimeEndpointResponse (Maybe Text)
deleteRealtimeEndpointResponse_mLModelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeEndpointResponse' {Maybe Text
mLModelId :: Maybe Text
$sel:mLModelId:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Maybe Text
mLModelId} -> Maybe Text
mLModelId) (\s :: DeleteRealtimeEndpointResponse
s@DeleteRealtimeEndpointResponse' {} Maybe Text
a -> DeleteRealtimeEndpointResponse
s {$sel:mLModelId:DeleteRealtimeEndpointResponse' :: Maybe Text
mLModelId = Maybe Text
a} :: DeleteRealtimeEndpointResponse)

-- | The endpoint information of the @MLModel@
deleteRealtimeEndpointResponse_realtimeEndpointInfo :: Lens.Lens' DeleteRealtimeEndpointResponse (Prelude.Maybe RealtimeEndpointInfo)
deleteRealtimeEndpointResponse_realtimeEndpointInfo :: Lens' DeleteRealtimeEndpointResponse (Maybe RealtimeEndpointInfo)
deleteRealtimeEndpointResponse_realtimeEndpointInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeEndpointResponse' {Maybe RealtimeEndpointInfo
realtimeEndpointInfo :: Maybe RealtimeEndpointInfo
$sel:realtimeEndpointInfo:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Maybe RealtimeEndpointInfo
realtimeEndpointInfo} -> Maybe RealtimeEndpointInfo
realtimeEndpointInfo) (\s :: DeleteRealtimeEndpointResponse
s@DeleteRealtimeEndpointResponse' {} Maybe RealtimeEndpointInfo
a -> DeleteRealtimeEndpointResponse
s {$sel:realtimeEndpointInfo:DeleteRealtimeEndpointResponse' :: Maybe RealtimeEndpointInfo
realtimeEndpointInfo = Maybe RealtimeEndpointInfo
a} :: DeleteRealtimeEndpointResponse)

-- | The response's http status code.
deleteRealtimeEndpointResponse_httpStatus :: Lens.Lens' DeleteRealtimeEndpointResponse Prelude.Int
deleteRealtimeEndpointResponse_httpStatus :: Lens' DeleteRealtimeEndpointResponse Int
deleteRealtimeEndpointResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteRealtimeEndpointResponse
s@DeleteRealtimeEndpointResponse' {} Int
a -> DeleteRealtimeEndpointResponse
s {$sel:httpStatus:DeleteRealtimeEndpointResponse' :: Int
httpStatus = Int
a} :: DeleteRealtimeEndpointResponse)

instance
  Prelude.NFData
    DeleteRealtimeEndpointResponse
  where
  rnf :: DeleteRealtimeEndpointResponse -> ()
rnf DeleteRealtimeEndpointResponse' {Int
Maybe Text
Maybe RealtimeEndpointInfo
httpStatus :: Int
realtimeEndpointInfo :: Maybe RealtimeEndpointInfo
mLModelId :: Maybe Text
$sel:httpStatus:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Int
$sel:realtimeEndpointInfo:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Maybe RealtimeEndpointInfo
$sel:mLModelId:DeleteRealtimeEndpointResponse' :: DeleteRealtimeEndpointResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mLModelId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RealtimeEndpointInfo
realtimeEndpointInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus