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

    -- * Request Lenses
    deleteConfiguration_arn,

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

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

import qualified Amazonka.Core as Core
import Amazonka.Kafka.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:/ '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
(DeleteConfiguration -> DeleteConfiguration -> Bool)
-> (DeleteConfiguration -> DeleteConfiguration -> Bool)
-> Eq DeleteConfiguration
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]
(Int -> ReadS DeleteConfiguration)
-> ReadS [DeleteConfiguration]
-> ReadPrec DeleteConfiguration
-> ReadPrec [DeleteConfiguration]
-> Read 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
(Int -> DeleteConfiguration -> ShowS)
-> (DeleteConfiguration -> String)
-> ([DeleteConfiguration] -> ShowS)
-> Show DeleteConfiguration
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. DeleteConfiguration -> Rep DeleteConfiguration x)
-> (forall x. Rep DeleteConfiguration x -> DeleteConfiguration)
-> Generic DeleteConfiguration
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' :: Text -> DeleteConfiguration
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 :: (Text -> f Text) -> DeleteConfiguration -> f DeleteConfiguration
deleteConfiguration_arn = (DeleteConfiguration -> Text)
-> (DeleteConfiguration -> Text -> DeleteConfiguration)
-> Lens DeleteConfiguration DeleteConfiguration Text Text
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 :: DeleteConfiguration -> Request DeleteConfiguration
request = Service -> DeleteConfiguration -> Request DeleteConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteConfiguration))
-> Logger
-> Service
-> Proxy DeleteConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConfiguration)))
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 ConfigurationState
-> Maybe Text -> Int -> DeleteConfigurationResponse
DeleteConfigurationResponse'
            (Maybe ConfigurationState
 -> Maybe Text -> Int -> DeleteConfigurationResponse)
-> Either String (Maybe ConfigurationState)
-> Either String (Maybe Text -> Int -> DeleteConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ConfigurationState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"state")
            Either String (Maybe Text -> Int -> DeleteConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"arn")
            Either String (Int -> DeleteConfigurationResponse)
-> Either String Int -> Either String DeleteConfigurationResponse
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 DeleteConfiguration

instance Prelude.NFData DeleteConfiguration

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

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

-- | /See:/ 'newDeleteConfigurationResponse' smart constructor.
data DeleteConfigurationResponse = DeleteConfigurationResponse'
  { -- | The state of the configuration. The possible states are ACTIVE,
    -- DELETING, and DELETE_FAILED.
    DeleteConfigurationResponse -> Maybe ConfigurationState
state :: Prelude.Maybe ConfigurationState,
    -- | The Amazon Resource Name (ARN) that uniquely identifies an MSK
    -- configuration.
    DeleteConfigurationResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteConfigurationResponse -> DeleteConfigurationResponse -> Bool
(DeleteConfigurationResponse
 -> DeleteConfigurationResponse -> Bool)
-> (DeleteConfigurationResponse
    -> DeleteConfigurationResponse -> Bool)
-> Eq DeleteConfigurationResponse
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]
(Int -> ReadS DeleteConfigurationResponse)
-> ReadS [DeleteConfigurationResponse]
-> ReadPrec DeleteConfigurationResponse
-> ReadPrec [DeleteConfigurationResponse]
-> Read 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
(Int -> DeleteConfigurationResponse -> ShowS)
-> (DeleteConfigurationResponse -> String)
-> ([DeleteConfigurationResponse] -> ShowS)
-> Show DeleteConfigurationResponse
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.
 DeleteConfigurationResponse -> Rep DeleteConfigurationResponse x)
-> (forall x.
    Rep DeleteConfigurationResponse x -> DeleteConfigurationResponse)
-> Generic DeleteConfigurationResponse
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:
--
-- 'state', 'deleteConfigurationResponse_state' - The state of the configuration. The possible states are ACTIVE,
-- DELETING, and DELETE_FAILED.
--
-- 'arn', 'deleteConfigurationResponse_arn' - The Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
--
-- 'httpStatus', 'deleteConfigurationResponse_httpStatus' - The response's http status code.
newDeleteConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteConfigurationResponse
newDeleteConfigurationResponse :: Int -> DeleteConfigurationResponse
newDeleteConfigurationResponse Int
pHttpStatus_ =
  DeleteConfigurationResponse' :: Maybe ConfigurationState
-> Maybe Text -> Int -> DeleteConfigurationResponse
DeleteConfigurationResponse'
    { $sel:state:DeleteConfigurationResponse' :: Maybe ConfigurationState
state =
        Maybe ConfigurationState
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeleteConfigurationResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The state of the configuration. The possible states are ACTIVE,
-- DELETING, and DELETE_FAILED.
deleteConfigurationResponse_state :: Lens.Lens' DeleteConfigurationResponse (Prelude.Maybe ConfigurationState)
deleteConfigurationResponse_state :: (Maybe ConfigurationState -> f (Maybe ConfigurationState))
-> DeleteConfigurationResponse -> f DeleteConfigurationResponse
deleteConfigurationResponse_state = (DeleteConfigurationResponse -> Maybe ConfigurationState)
-> (DeleteConfigurationResponse
    -> Maybe ConfigurationState -> DeleteConfigurationResponse)
-> Lens
     DeleteConfigurationResponse
     DeleteConfigurationResponse
     (Maybe ConfigurationState)
     (Maybe ConfigurationState)
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 Amazon Resource Name (ARN) that uniquely identifies an MSK
-- configuration.
deleteConfigurationResponse_arn :: Lens.Lens' DeleteConfigurationResponse (Prelude.Maybe Prelude.Text)
deleteConfigurationResponse_arn :: (Maybe Text -> f (Maybe Text))
-> DeleteConfigurationResponse -> f DeleteConfigurationResponse
deleteConfigurationResponse_arn = (DeleteConfigurationResponse -> Maybe Text)
-> (DeleteConfigurationResponse
    -> Maybe Text -> DeleteConfigurationResponse)
-> Lens
     DeleteConfigurationResponse
     DeleteConfigurationResponse
     (Maybe Text)
     (Maybe Text)
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 response's http status code.
deleteConfigurationResponse_httpStatus :: Lens.Lens' DeleteConfigurationResponse Prelude.Int
deleteConfigurationResponse_httpStatus :: (Int -> f Int)
-> DeleteConfigurationResponse -> f DeleteConfigurationResponse
deleteConfigurationResponse_httpStatus = (DeleteConfigurationResponse -> Int)
-> (DeleteConfigurationResponse
    -> Int -> DeleteConfigurationResponse)
-> Lens
     DeleteConfigurationResponse DeleteConfigurationResponse Int Int
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