{-# 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.DeleteConnector
-- 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 the specified connector.
module Amazonka.KafkaConnect.DeleteConnector
  ( -- * Creating a Request
    DeleteConnector (..),
    newDeleteConnector,

    -- * Request Lenses
    deleteConnector_currentVersion,
    deleteConnector_connectorArn,

    -- * Destructuring the Response
    DeleteConnectorResponse (..),
    newDeleteConnectorResponse,

    -- * Response Lenses
    deleteConnectorResponse_connectorArn,
    deleteConnectorResponse_connectorState,
    deleteConnectorResponse_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:/ 'newDeleteConnector' smart constructor.
data DeleteConnector = DeleteConnector'
  { -- | The current version of the connector that you want to delete.
    DeleteConnector -> Maybe Text
currentVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the connector that you want to delete.
    DeleteConnector -> Text
connectorArn :: Prelude.Text
  }
  deriving (DeleteConnector -> DeleteConnector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConnector -> DeleteConnector -> Bool
$c/= :: DeleteConnector -> DeleteConnector -> Bool
== :: DeleteConnector -> DeleteConnector -> Bool
$c== :: DeleteConnector -> DeleteConnector -> Bool
Prelude.Eq, ReadPrec [DeleteConnector]
ReadPrec DeleteConnector
Int -> ReadS DeleteConnector
ReadS [DeleteConnector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConnector]
$creadListPrec :: ReadPrec [DeleteConnector]
readPrec :: ReadPrec DeleteConnector
$creadPrec :: ReadPrec DeleteConnector
readList :: ReadS [DeleteConnector]
$creadList :: ReadS [DeleteConnector]
readsPrec :: Int -> ReadS DeleteConnector
$creadsPrec :: Int -> ReadS DeleteConnector
Prelude.Read, Int -> DeleteConnector -> ShowS
[DeleteConnector] -> ShowS
DeleteConnector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConnector] -> ShowS
$cshowList :: [DeleteConnector] -> ShowS
show :: DeleteConnector -> String
$cshow :: DeleteConnector -> String
showsPrec :: Int -> DeleteConnector -> ShowS
$cshowsPrec :: Int -> DeleteConnector -> ShowS
Prelude.Show, forall x. Rep DeleteConnector x -> DeleteConnector
forall x. DeleteConnector -> Rep DeleteConnector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConnector x -> DeleteConnector
$cfrom :: forall x. DeleteConnector -> Rep DeleteConnector x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConnector' 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:
--
-- 'currentVersion', 'deleteConnector_currentVersion' - The current version of the connector that you want to delete.
--
-- 'connectorArn', 'deleteConnector_connectorArn' - The Amazon Resource Name (ARN) of the connector that you want to delete.
newDeleteConnector ::
  -- | 'connectorArn'
  Prelude.Text ->
  DeleteConnector
newDeleteConnector :: Text -> DeleteConnector
newDeleteConnector Text
pConnectorArn_ =
  DeleteConnector'
    { $sel:currentVersion:DeleteConnector' :: Maybe Text
currentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:connectorArn:DeleteConnector' :: Text
connectorArn = Text
pConnectorArn_
    }

-- | The current version of the connector that you want to delete.
deleteConnector_currentVersion :: Lens.Lens' DeleteConnector (Prelude.Maybe Prelude.Text)
deleteConnector_currentVersion :: Lens' DeleteConnector (Maybe Text)
deleteConnector_currentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnector' {Maybe Text
currentVersion :: Maybe Text
$sel:currentVersion:DeleteConnector' :: DeleteConnector -> Maybe Text
currentVersion} -> Maybe Text
currentVersion) (\s :: DeleteConnector
s@DeleteConnector' {} Maybe Text
a -> DeleteConnector
s {$sel:currentVersion:DeleteConnector' :: Maybe Text
currentVersion = Maybe Text
a} :: DeleteConnector)

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

instance Core.AWSRequest DeleteConnector where
  type
    AWSResponse DeleteConnector =
      DeleteConnectorResponse
  request :: (Service -> Service) -> DeleteConnector -> Request DeleteConnector
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 DeleteConnector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnector)))
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 ConnectorState -> Int -> DeleteConnectorResponse
DeleteConnectorResponse'
            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
"connectorArn")
            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
"connectorState")
            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 DeleteConnector where
  hashWithSalt :: Int -> DeleteConnector -> Int
hashWithSalt Int
_salt DeleteConnector' {Maybe Text
Text
connectorArn :: Text
currentVersion :: Maybe Text
$sel:connectorArn:DeleteConnector' :: DeleteConnector -> Text
$sel:currentVersion:DeleteConnector' :: DeleteConnector -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
currentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectorArn

instance Prelude.NFData DeleteConnector where
  rnf :: DeleteConnector -> ()
rnf DeleteConnector' {Maybe Text
Text
connectorArn :: Text
currentVersion :: Maybe Text
$sel:connectorArn:DeleteConnector' :: DeleteConnector -> Text
$sel:currentVersion:DeleteConnector' :: DeleteConnector -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
currentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectorArn

instance Data.ToHeaders DeleteConnector where
  toHeaders :: DeleteConnector -> 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 DeleteConnector where
  toPath :: DeleteConnector -> ByteString
toPath DeleteConnector' {Maybe Text
Text
connectorArn :: Text
currentVersion :: Maybe Text
$sel:connectorArn:DeleteConnector' :: DeleteConnector -> Text
$sel:currentVersion:DeleteConnector' :: DeleteConnector -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/connectors/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
connectorArn]

instance Data.ToQuery DeleteConnector where
  toQuery :: DeleteConnector -> QueryString
toQuery DeleteConnector' {Maybe Text
Text
connectorArn :: Text
currentVersion :: Maybe Text
$sel:connectorArn:DeleteConnector' :: DeleteConnector -> Text
$sel:currentVersion:DeleteConnector' :: DeleteConnector -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"currentVersion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
currentVersion]

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

-- |
-- Create a value of 'DeleteConnectorResponse' 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:
--
-- 'connectorArn', 'deleteConnectorResponse_connectorArn' - The Amazon Resource Name (ARN) of the connector that you requested to
-- delete.
--
-- 'connectorState', 'deleteConnectorResponse_connectorState' - The state of the connector that you requested to delete.
--
-- 'httpStatus', 'deleteConnectorResponse_httpStatus' - The response's http status code.
newDeleteConnectorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteConnectorResponse
newDeleteConnectorResponse :: Int -> DeleteConnectorResponse
newDeleteConnectorResponse Int
pHttpStatus_ =
  DeleteConnectorResponse'
    { $sel:connectorArn:DeleteConnectorResponse' :: Maybe Text
connectorArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:connectorState:DeleteConnectorResponse' :: Maybe ConnectorState
connectorState = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteConnectorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The state of the connector that you requested to delete.
deleteConnectorResponse_connectorState :: Lens.Lens' DeleteConnectorResponse (Prelude.Maybe ConnectorState)
deleteConnectorResponse_connectorState :: Lens' DeleteConnectorResponse (Maybe ConnectorState)
deleteConnectorResponse_connectorState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectorResponse' {Maybe ConnectorState
connectorState :: Maybe ConnectorState
$sel:connectorState:DeleteConnectorResponse' :: DeleteConnectorResponse -> Maybe ConnectorState
connectorState} -> Maybe ConnectorState
connectorState) (\s :: DeleteConnectorResponse
s@DeleteConnectorResponse' {} Maybe ConnectorState
a -> DeleteConnectorResponse
s {$sel:connectorState:DeleteConnectorResponse' :: Maybe ConnectorState
connectorState = Maybe ConnectorState
a} :: DeleteConnectorResponse)

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

instance Prelude.NFData DeleteConnectorResponse where
  rnf :: DeleteConnectorResponse -> ()
rnf DeleteConnectorResponse' {Int
Maybe Text
Maybe ConnectorState
httpStatus :: Int
connectorState :: Maybe ConnectorState
connectorArn :: Maybe Text
$sel:httpStatus:DeleteConnectorResponse' :: DeleteConnectorResponse -> Int
$sel:connectorState:DeleteConnectorResponse' :: DeleteConnectorResponse -> Maybe ConnectorState
$sel:connectorArn:DeleteConnectorResponse' :: DeleteConnectorResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectorState
connectorState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus