{-# 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.KafkaConnect.DeleteCustomPlugin
-- 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 custom plugin.
module Amazonka.KafkaConnect.DeleteCustomPlugin
  ( -- * Creating a Request
    DeleteCustomPlugin (..),
    newDeleteCustomPlugin,

    -- * Request Lenses
    deleteCustomPlugin_customPluginArn,

    -- * Destructuring the Response
    DeleteCustomPluginResponse (..),
    newDeleteCustomPluginResponse,

    -- * Response Lenses
    deleteCustomPluginResponse_customPluginArn,
    deleteCustomPluginResponse_customPluginState,
    deleteCustomPluginResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteCustomPlugin' smart constructor.
data DeleteCustomPlugin = DeleteCustomPlugin'
  { -- | The Amazon Resource Name (ARN) of the custom plugin that you want to
    -- delete.
    DeleteCustomPlugin -> Text
customPluginArn :: Prelude.Text
  }
  deriving (DeleteCustomPlugin -> DeleteCustomPlugin -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomPlugin -> DeleteCustomPlugin -> Bool
$c/= :: DeleteCustomPlugin -> DeleteCustomPlugin -> Bool
== :: DeleteCustomPlugin -> DeleteCustomPlugin -> Bool
$c== :: DeleteCustomPlugin -> DeleteCustomPlugin -> Bool
Prelude.Eq, ReadPrec [DeleteCustomPlugin]
ReadPrec DeleteCustomPlugin
Int -> ReadS DeleteCustomPlugin
ReadS [DeleteCustomPlugin]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCustomPlugin]
$creadListPrec :: ReadPrec [DeleteCustomPlugin]
readPrec :: ReadPrec DeleteCustomPlugin
$creadPrec :: ReadPrec DeleteCustomPlugin
readList :: ReadS [DeleteCustomPlugin]
$creadList :: ReadS [DeleteCustomPlugin]
readsPrec :: Int -> ReadS DeleteCustomPlugin
$creadsPrec :: Int -> ReadS DeleteCustomPlugin
Prelude.Read, Int -> DeleteCustomPlugin -> ShowS
[DeleteCustomPlugin] -> ShowS
DeleteCustomPlugin -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCustomPlugin] -> ShowS
$cshowList :: [DeleteCustomPlugin] -> ShowS
show :: DeleteCustomPlugin -> String
$cshow :: DeleteCustomPlugin -> String
showsPrec :: Int -> DeleteCustomPlugin -> ShowS
$cshowsPrec :: Int -> DeleteCustomPlugin -> ShowS
Prelude.Show, forall x. Rep DeleteCustomPlugin x -> DeleteCustomPlugin
forall x. DeleteCustomPlugin -> Rep DeleteCustomPlugin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCustomPlugin x -> DeleteCustomPlugin
$cfrom :: forall x. DeleteCustomPlugin -> Rep DeleteCustomPlugin x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCustomPlugin' 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:
--
-- 'customPluginArn', 'deleteCustomPlugin_customPluginArn' - The Amazon Resource Name (ARN) of the custom plugin that you want to
-- delete.
newDeleteCustomPlugin ::
  -- | 'customPluginArn'
  Prelude.Text ->
  DeleteCustomPlugin
newDeleteCustomPlugin :: Text -> DeleteCustomPlugin
newDeleteCustomPlugin Text
pCustomPluginArn_ =
  DeleteCustomPlugin'
    { $sel:customPluginArn:DeleteCustomPlugin' :: Text
customPluginArn =
        Text
pCustomPluginArn_
    }

-- | The Amazon Resource Name (ARN) of the custom plugin that you want to
-- delete.
deleteCustomPlugin_customPluginArn :: Lens.Lens' DeleteCustomPlugin Prelude.Text
deleteCustomPlugin_customPluginArn :: Lens' DeleteCustomPlugin Text
deleteCustomPlugin_customPluginArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomPlugin' {Text
customPluginArn :: Text
$sel:customPluginArn:DeleteCustomPlugin' :: DeleteCustomPlugin -> Text
customPluginArn} -> Text
customPluginArn) (\s :: DeleteCustomPlugin
s@DeleteCustomPlugin' {} Text
a -> DeleteCustomPlugin
s {$sel:customPluginArn:DeleteCustomPlugin' :: Text
customPluginArn = Text
a} :: DeleteCustomPlugin)

instance Core.AWSRequest DeleteCustomPlugin where
  type
    AWSResponse DeleteCustomPlugin =
      DeleteCustomPluginResponse
  request :: (Service -> Service)
-> DeleteCustomPlugin -> Request DeleteCustomPlugin
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteCustomPlugin
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCustomPlugin)))
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 CustomPluginState -> Int -> DeleteCustomPluginResponse
DeleteCustomPluginResponse'
            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
"customPluginArn")
            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
"customPluginState")
            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 DeleteCustomPlugin where
  hashWithSalt :: Int -> DeleteCustomPlugin -> Int
hashWithSalt Int
_salt DeleteCustomPlugin' {Text
customPluginArn :: Text
$sel:customPluginArn:DeleteCustomPlugin' :: DeleteCustomPlugin -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customPluginArn

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

instance Data.ToHeaders DeleteCustomPlugin where
  toHeaders :: DeleteCustomPlugin -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteCustomPlugin where
  toPath :: DeleteCustomPlugin -> ByteString
toPath DeleteCustomPlugin' {Text
customPluginArn :: Text
$sel:customPluginArn:DeleteCustomPlugin' :: DeleteCustomPlugin -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/custom-plugins/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
customPluginArn]

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

-- | /See:/ 'newDeleteCustomPluginResponse' smart constructor.
data DeleteCustomPluginResponse = DeleteCustomPluginResponse'
  { -- | The Amazon Resource Name (ARN) of the custom plugin that you requested
    -- to delete.
    DeleteCustomPluginResponse -> Maybe Text
customPluginArn :: Prelude.Maybe Prelude.Text,
    -- | The state of the custom plugin.
    DeleteCustomPluginResponse -> Maybe CustomPluginState
customPluginState :: Prelude.Maybe CustomPluginState,
    -- | The response's http status code.
    DeleteCustomPluginResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteCustomPluginResponse -> DeleteCustomPluginResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomPluginResponse -> DeleteCustomPluginResponse -> Bool
$c/= :: DeleteCustomPluginResponse -> DeleteCustomPluginResponse -> Bool
== :: DeleteCustomPluginResponse -> DeleteCustomPluginResponse -> Bool
$c== :: DeleteCustomPluginResponse -> DeleteCustomPluginResponse -> Bool
Prelude.Eq, ReadPrec [DeleteCustomPluginResponse]
ReadPrec DeleteCustomPluginResponse
Int -> ReadS DeleteCustomPluginResponse
ReadS [DeleteCustomPluginResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCustomPluginResponse]
$creadListPrec :: ReadPrec [DeleteCustomPluginResponse]
readPrec :: ReadPrec DeleteCustomPluginResponse
$creadPrec :: ReadPrec DeleteCustomPluginResponse
readList :: ReadS [DeleteCustomPluginResponse]
$creadList :: ReadS [DeleteCustomPluginResponse]
readsPrec :: Int -> ReadS DeleteCustomPluginResponse
$creadsPrec :: Int -> ReadS DeleteCustomPluginResponse
Prelude.Read, Int -> DeleteCustomPluginResponse -> ShowS
[DeleteCustomPluginResponse] -> ShowS
DeleteCustomPluginResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCustomPluginResponse] -> ShowS
$cshowList :: [DeleteCustomPluginResponse] -> ShowS
show :: DeleteCustomPluginResponse -> String
$cshow :: DeleteCustomPluginResponse -> String
showsPrec :: Int -> DeleteCustomPluginResponse -> ShowS
$cshowsPrec :: Int -> DeleteCustomPluginResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteCustomPluginResponse x -> DeleteCustomPluginResponse
forall x.
DeleteCustomPluginResponse -> Rep DeleteCustomPluginResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCustomPluginResponse x -> DeleteCustomPluginResponse
$cfrom :: forall x.
DeleteCustomPluginResponse -> Rep DeleteCustomPluginResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCustomPluginResponse' 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:
--
-- 'customPluginArn', 'deleteCustomPluginResponse_customPluginArn' - The Amazon Resource Name (ARN) of the custom plugin that you requested
-- to delete.
--
-- 'customPluginState', 'deleteCustomPluginResponse_customPluginState' - The state of the custom plugin.
--
-- 'httpStatus', 'deleteCustomPluginResponse_httpStatus' - The response's http status code.
newDeleteCustomPluginResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteCustomPluginResponse
newDeleteCustomPluginResponse :: Int -> DeleteCustomPluginResponse
newDeleteCustomPluginResponse Int
pHttpStatus_ =
  DeleteCustomPluginResponse'
    { $sel:customPluginArn:DeleteCustomPluginResponse' :: Maybe Text
customPluginArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customPluginState:DeleteCustomPluginResponse' :: Maybe CustomPluginState
customPluginState = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteCustomPluginResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the custom plugin that you requested
-- to delete.
deleteCustomPluginResponse_customPluginArn :: Lens.Lens' DeleteCustomPluginResponse (Prelude.Maybe Prelude.Text)
deleteCustomPluginResponse_customPluginArn :: Lens' DeleteCustomPluginResponse (Maybe Text)
deleteCustomPluginResponse_customPluginArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomPluginResponse' {Maybe Text
customPluginArn :: Maybe Text
$sel:customPluginArn:DeleteCustomPluginResponse' :: DeleteCustomPluginResponse -> Maybe Text
customPluginArn} -> Maybe Text
customPluginArn) (\s :: DeleteCustomPluginResponse
s@DeleteCustomPluginResponse' {} Maybe Text
a -> DeleteCustomPluginResponse
s {$sel:customPluginArn:DeleteCustomPluginResponse' :: Maybe Text
customPluginArn = Maybe Text
a} :: DeleteCustomPluginResponse)

-- | The state of the custom plugin.
deleteCustomPluginResponse_customPluginState :: Lens.Lens' DeleteCustomPluginResponse (Prelude.Maybe CustomPluginState)
deleteCustomPluginResponse_customPluginState :: Lens' DeleteCustomPluginResponse (Maybe CustomPluginState)
deleteCustomPluginResponse_customPluginState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomPluginResponse' {Maybe CustomPluginState
customPluginState :: Maybe CustomPluginState
$sel:customPluginState:DeleteCustomPluginResponse' :: DeleteCustomPluginResponse -> Maybe CustomPluginState
customPluginState} -> Maybe CustomPluginState
customPluginState) (\s :: DeleteCustomPluginResponse
s@DeleteCustomPluginResponse' {} Maybe CustomPluginState
a -> DeleteCustomPluginResponse
s {$sel:customPluginState:DeleteCustomPluginResponse' :: Maybe CustomPluginState
customPluginState = Maybe CustomPluginState
a} :: DeleteCustomPluginResponse)

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

instance Prelude.NFData DeleteCustomPluginResponse where
  rnf :: DeleteCustomPluginResponse -> ()
rnf DeleteCustomPluginResponse' {Int
Maybe Text
Maybe CustomPluginState
httpStatus :: Int
customPluginState :: Maybe CustomPluginState
customPluginArn :: Maybe Text
$sel:httpStatus:DeleteCustomPluginResponse' :: DeleteCustomPluginResponse -> Int
$sel:customPluginState:DeleteCustomPluginResponse' :: DeleteCustomPluginResponse -> Maybe CustomPluginState
$sel:customPluginArn:DeleteCustomPluginResponse' :: DeleteCustomPluginResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customPluginArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomPluginState
customPluginState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus