{-# 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-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 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 Amazonka.KafkaConnect.Types
import qualified Amazonka.Lens as Lens
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
(DeleteConnector -> DeleteConnector -> Bool)
-> (DeleteConnector -> DeleteConnector -> Bool)
-> Eq DeleteConnector
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]
(Int -> ReadS DeleteConnector)
-> ReadS [DeleteConnector]
-> ReadPrec DeleteConnector
-> ReadPrec [DeleteConnector]
-> Read 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
(Int -> DeleteConnector -> ShowS)
-> (DeleteConnector -> String)
-> ([DeleteConnector] -> ShowS)
-> Show DeleteConnector
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. DeleteConnector -> Rep DeleteConnector x)
-> (forall x. Rep DeleteConnector x -> DeleteConnector)
-> Generic DeleteConnector
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' :: Maybe Text -> Text -> DeleteConnector
DeleteConnector'
    { $sel:currentVersion:DeleteConnector' :: Maybe Text
currentVersion = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteConnector -> f DeleteConnector
deleteConnector_currentVersion = (DeleteConnector -> Maybe Text)
-> (DeleteConnector -> Maybe Text -> DeleteConnector)
-> Lens DeleteConnector DeleteConnector (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> DeleteConnector -> f DeleteConnector
deleteConnector_connectorArn = (DeleteConnector -> Text)
-> (DeleteConnector -> Text -> DeleteConnector)
-> Lens DeleteConnector DeleteConnector Text Text
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 :: DeleteConnector -> Request DeleteConnector
request = Service -> DeleteConnector -> Request DeleteConnector
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteConnector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnector)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteConnector))
-> Logger
-> Service
-> Proxy DeleteConnector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnector)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Maybe Text
 -> Maybe ConnectorState -> Int -> DeleteConnectorResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe ConnectorState -> Int -> DeleteConnectorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"connectorArn")
            Either
  String (Maybe ConnectorState -> Int -> DeleteConnectorResponse)
-> Either String (Maybe ConnectorState)
-> Either String (Int -> DeleteConnectorResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ConnectorState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"connectorState")
            Either String (Int -> DeleteConnectorResponse)
-> Either String Int -> Either String DeleteConnectorResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteConnector

instance Prelude.NFData DeleteConnector

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

instance Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/connectors/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
connectorArn]

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"currentVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(DeleteConnectorResponse -> DeleteConnectorResponse -> Bool)
-> (DeleteConnectorResponse -> DeleteConnectorResponse -> Bool)
-> Eq DeleteConnectorResponse
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]
(Int -> ReadS DeleteConnectorResponse)
-> ReadS [DeleteConnectorResponse]
-> ReadPrec DeleteConnectorResponse
-> ReadPrec [DeleteConnectorResponse]
-> Read 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
(Int -> DeleteConnectorResponse -> ShowS)
-> (DeleteConnectorResponse -> String)
-> ([DeleteConnectorResponse] -> ShowS)
-> Show DeleteConnectorResponse
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.
 DeleteConnectorResponse -> Rep DeleteConnectorResponse x)
-> (forall x.
    Rep DeleteConnectorResponse x -> DeleteConnectorResponse)
-> Generic DeleteConnectorResponse
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' :: Maybe Text
-> Maybe ConnectorState -> Int -> DeleteConnectorResponse
DeleteConnectorResponse'
    { $sel:connectorArn:DeleteConnectorResponse' :: Maybe Text
connectorArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectorState:DeleteConnectorResponse' :: Maybe ConnectorState
connectorState = Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> DeleteConnectorResponse -> f DeleteConnectorResponse
deleteConnectorResponse_connectorArn = (DeleteConnectorResponse -> Maybe Text)
-> (DeleteConnectorResponse
    -> Maybe Text -> DeleteConnectorResponse)
-> Lens
     DeleteConnectorResponse
     DeleteConnectorResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe ConnectorState -> f (Maybe ConnectorState))
-> DeleteConnectorResponse -> f DeleteConnectorResponse
deleteConnectorResponse_connectorState = (DeleteConnectorResponse -> Maybe ConnectorState)
-> (DeleteConnectorResponse
    -> Maybe ConnectorState -> DeleteConnectorResponse)
-> Lens
     DeleteConnectorResponse
     DeleteConnectorResponse
     (Maybe ConnectorState)
     (Maybe 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 :: (Int -> f Int)
-> DeleteConnectorResponse -> f DeleteConnectorResponse
deleteConnectorResponse_httpStatus = (DeleteConnectorResponse -> Int)
-> (DeleteConnectorResponse -> Int -> DeleteConnectorResponse)
-> Lens DeleteConnectorResponse DeleteConnectorResponse Int Int
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