{-# 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.Kafka.DeleteConfiguration
-- 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 an MSK Configuration.
module Amazonka.Kafka.DeleteConfiguration
  ( -- * Creating a Request
    DeleteConfiguration (..),
    newDeleteConfiguration,

    -- * Request Lenses
    deleteConfiguration_arn,

    -- * Destructuring the Response
    DeleteConfigurationResponse (..),
    newDeleteConfigurationResponse,

    -- * Response Lenses
    deleteConfigurationResponse_arn,
    deleteConfigurationResponse_state,
    deleteConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteConfiguration' smart constructor.
data DeleteConfiguration = DeleteConfiguration'
  { -- | The Amazon Resource Name (ARN) that uniquely identifies an MSK
    -- configuration.
    DeleteConfiguration -> Text
arn :: Prelude.Text
  }
  deriving (DeleteConfiguration -> DeleteConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfiguration -> DeleteConfiguration -> Bool
$c/= :: DeleteConfiguration -> DeleteConfiguration -> Bool
== :: DeleteConfiguration -> DeleteConfiguration -> Bool
$c== :: DeleteConfiguration -> DeleteConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteConfiguration]
ReadPrec DeleteConfiguration
Int -> ReadS DeleteConfiguration
ReadS [DeleteConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfiguration]
$creadListPrec :: ReadPrec [DeleteConfiguration]
readPrec :: ReadPrec DeleteConfiguration
$creadPrec :: ReadPrec DeleteConfiguration
readList :: ReadS [DeleteConfiguration]
$creadList :: ReadS [DeleteConfiguration]
readsPrec :: Int -> ReadS DeleteConfiguration
$creadsPrec :: Int -> ReadS DeleteConfiguration
Prelude.Read, Int -> DeleteConfiguration -> ShowS
[DeleteConfiguration] -> ShowS
DeleteConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfiguration] -> ShowS
$cshowList :: [DeleteConfiguration] -> ShowS
show :: DeleteConfiguration -> String
$cshow :: DeleteConfiguration -> String
showsPrec :: Int -> DeleteConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteConfiguration -> ShowS
Prelude.Show, forall x. Rep DeleteConfiguration x -> DeleteConfiguration
forall x. DeleteConfiguration -> Rep DeleteConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConfiguration x -> DeleteConfiguration
$cfrom :: forall x. DeleteConfiguration -> Rep DeleteConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConfiguration' 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:
--
-- 'arn', 'deleteConfiguration_arn' - The Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
newDeleteConfiguration ::
  -- | 'arn'
  Prelude.Text ->
  DeleteConfiguration
newDeleteConfiguration :: Text -> DeleteConfiguration
newDeleteConfiguration Text
pArn_ =
  DeleteConfiguration' {$sel:arn:DeleteConfiguration' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
deleteConfiguration_arn :: Lens.Lens' DeleteConfiguration Prelude.Text
deleteConfiguration_arn :: Lens' DeleteConfiguration Text
deleteConfiguration_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfiguration' {Text
arn :: Text
$sel:arn:DeleteConfiguration' :: DeleteConfiguration -> Text
arn} -> Text
arn) (\s :: DeleteConfiguration
s@DeleteConfiguration' {} Text
a -> DeleteConfiguration
s {$sel:arn:DeleteConfiguration' :: Text
arn = Text
a} :: DeleteConfiguration)

instance Core.AWSRequest DeleteConfiguration where
  type
    AWSResponse DeleteConfiguration =
      DeleteConfigurationResponse
  request :: (Service -> Service)
-> DeleteConfiguration -> Request DeleteConfiguration
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 DeleteConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConfiguration)))
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 ConfigurationState -> Int -> DeleteConfigurationResponse
DeleteConfigurationResponse'
            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
"arn")
            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
"state")
            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 DeleteConfiguration where
  hashWithSalt :: Int -> DeleteConfiguration -> Int
hashWithSalt Int
_salt DeleteConfiguration' {Text
arn :: Text
$sel:arn:DeleteConfiguration' :: DeleteConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

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

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

-- | /See:/ 'newDeleteConfigurationResponse' smart constructor.
data DeleteConfigurationResponse = DeleteConfigurationResponse'
  { -- | The Amazon Resource Name (ARN) that uniquely identifies an MSK
    -- configuration.
    DeleteConfigurationResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The state of the configuration. The possible states are ACTIVE,
    -- DELETING, and DELETE_FAILED.
    DeleteConfigurationResponse -> Maybe ConfigurationState
state :: Prelude.Maybe ConfigurationState,
    -- | The response's http status code.
    DeleteConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
$c/= :: DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
== :: DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
$c== :: DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteConfigurationResponse]
ReadPrec DeleteConfigurationResponse
Int -> ReadS DeleteConfigurationResponse
ReadS [DeleteConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfigurationResponse]
$creadListPrec :: ReadPrec [DeleteConfigurationResponse]
readPrec :: ReadPrec DeleteConfigurationResponse
$creadPrec :: ReadPrec DeleteConfigurationResponse
readList :: ReadS [DeleteConfigurationResponse]
$creadList :: ReadS [DeleteConfigurationResponse]
readsPrec :: Int -> ReadS DeleteConfigurationResponse
$creadsPrec :: Int -> ReadS DeleteConfigurationResponse
Prelude.Read, Int -> DeleteConfigurationResponse -> ShowS
[DeleteConfigurationResponse] -> ShowS
DeleteConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfigurationResponse] -> ShowS
$cshowList :: [DeleteConfigurationResponse] -> ShowS
show :: DeleteConfigurationResponse -> String
$cshow :: DeleteConfigurationResponse -> String
showsPrec :: Int -> DeleteConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DeleteConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteConfigurationResponse x -> DeleteConfigurationResponse
forall x.
DeleteConfigurationResponse -> Rep DeleteConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConfigurationResponse x -> DeleteConfigurationResponse
$cfrom :: forall x.
DeleteConfigurationResponse -> Rep DeleteConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConfigurationResponse' 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:
--
-- 'arn', 'deleteConfigurationResponse_arn' - The Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
--
-- 'state', 'deleteConfigurationResponse_state' - The state of the configuration. The possible states are ACTIVE,
-- DELETING, and DELETE_FAILED.
--
-- 'httpStatus', 'deleteConfigurationResponse_httpStatus' - The response's http status code.
newDeleteConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteConfigurationResponse
newDeleteConfigurationResponse :: Int -> DeleteConfigurationResponse
newDeleteConfigurationResponse Int
pHttpStatus_ =
  DeleteConfigurationResponse'
    { $sel:arn:DeleteConfigurationResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:state:DeleteConfigurationResponse' :: Maybe ConfigurationState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
deleteConfigurationResponse_arn :: Lens.Lens' DeleteConfigurationResponse (Prelude.Maybe Prelude.Text)
deleteConfigurationResponse_arn :: Lens' DeleteConfigurationResponse (Maybe Text)
deleteConfigurationResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfigurationResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteConfigurationResponse' :: DeleteConfigurationResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteConfigurationResponse
s@DeleteConfigurationResponse' {} Maybe Text
a -> DeleteConfigurationResponse
s {$sel:arn:DeleteConfigurationResponse' :: Maybe Text
arn = Maybe Text
a} :: DeleteConfigurationResponse)

-- | The state of the configuration. The possible states are ACTIVE,
-- DELETING, and DELETE_FAILED.
deleteConfigurationResponse_state :: Lens.Lens' DeleteConfigurationResponse (Prelude.Maybe ConfigurationState)
deleteConfigurationResponse_state :: Lens' DeleteConfigurationResponse (Maybe ConfigurationState)
deleteConfigurationResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfigurationResponse' {Maybe ConfigurationState
state :: Maybe ConfigurationState
$sel:state:DeleteConfigurationResponse' :: DeleteConfigurationResponse -> Maybe ConfigurationState
state} -> Maybe ConfigurationState
state) (\s :: DeleteConfigurationResponse
s@DeleteConfigurationResponse' {} Maybe ConfigurationState
a -> DeleteConfigurationResponse
s {$sel:state:DeleteConfigurationResponse' :: Maybe ConfigurationState
state = Maybe ConfigurationState
a} :: DeleteConfigurationResponse)

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

instance Prelude.NFData DeleteConfigurationResponse where
  rnf :: DeleteConfigurationResponse -> ()
rnf DeleteConfigurationResponse' {Int
Maybe Text
Maybe ConfigurationState
httpStatus :: Int
state :: Maybe ConfigurationState
arn :: Maybe Text
$sel:httpStatus:DeleteConfigurationResponse' :: DeleteConfigurationResponse -> Int
$sel:state:DeleteConfigurationResponse' :: DeleteConfigurationResponse -> Maybe ConfigurationState
$sel:arn:DeleteConfigurationResponse' :: DeleteConfigurationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigurationState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus