{-# 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.MQ.DeleteBroker
-- 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 a broker. Note: This API is asynchronous.
module Amazonka.MQ.DeleteBroker
  ( -- * Creating a Request
    DeleteBroker (..),
    newDeleteBroker,

    -- * Request Lenses
    deleteBroker_brokerId,

    -- * Destructuring the Response
    DeleteBrokerResponse (..),
    newDeleteBrokerResponse,

    -- * Response Lenses
    deleteBrokerResponse_brokerId,
    deleteBrokerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteBroker' smart constructor.
data DeleteBroker = DeleteBroker'
  { -- | The unique ID that Amazon MQ generates for the broker.
    DeleteBroker -> Text
brokerId :: Prelude.Text
  }
  deriving (DeleteBroker -> DeleteBroker -> Bool
(DeleteBroker -> DeleteBroker -> Bool)
-> (DeleteBroker -> DeleteBroker -> Bool) -> Eq DeleteBroker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBroker -> DeleteBroker -> Bool
$c/= :: DeleteBroker -> DeleteBroker -> Bool
== :: DeleteBroker -> DeleteBroker -> Bool
$c== :: DeleteBroker -> DeleteBroker -> Bool
Prelude.Eq, ReadPrec [DeleteBroker]
ReadPrec DeleteBroker
Int -> ReadS DeleteBroker
ReadS [DeleteBroker]
(Int -> ReadS DeleteBroker)
-> ReadS [DeleteBroker]
-> ReadPrec DeleteBroker
-> ReadPrec [DeleteBroker]
-> Read DeleteBroker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBroker]
$creadListPrec :: ReadPrec [DeleteBroker]
readPrec :: ReadPrec DeleteBroker
$creadPrec :: ReadPrec DeleteBroker
readList :: ReadS [DeleteBroker]
$creadList :: ReadS [DeleteBroker]
readsPrec :: Int -> ReadS DeleteBroker
$creadsPrec :: Int -> ReadS DeleteBroker
Prelude.Read, Int -> DeleteBroker -> ShowS
[DeleteBroker] -> ShowS
DeleteBroker -> String
(Int -> DeleteBroker -> ShowS)
-> (DeleteBroker -> String)
-> ([DeleteBroker] -> ShowS)
-> Show DeleteBroker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBroker] -> ShowS
$cshowList :: [DeleteBroker] -> ShowS
show :: DeleteBroker -> String
$cshow :: DeleteBroker -> String
showsPrec :: Int -> DeleteBroker -> ShowS
$cshowsPrec :: Int -> DeleteBroker -> ShowS
Prelude.Show, (forall x. DeleteBroker -> Rep DeleteBroker x)
-> (forall x. Rep DeleteBroker x -> DeleteBroker)
-> Generic DeleteBroker
forall x. Rep DeleteBroker x -> DeleteBroker
forall x. DeleteBroker -> Rep DeleteBroker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBroker x -> DeleteBroker
$cfrom :: forall x. DeleteBroker -> Rep DeleteBroker x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBroker' 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:
--
-- 'brokerId', 'deleteBroker_brokerId' - The unique ID that Amazon MQ generates for the broker.
newDeleteBroker ::
  -- | 'brokerId'
  Prelude.Text ->
  DeleteBroker
newDeleteBroker :: Text -> DeleteBroker
newDeleteBroker Text
pBrokerId_ =
  DeleteBroker' :: Text -> DeleteBroker
DeleteBroker' {$sel:brokerId:DeleteBroker' :: Text
brokerId = Text
pBrokerId_}

-- | The unique ID that Amazon MQ generates for the broker.
deleteBroker_brokerId :: Lens.Lens' DeleteBroker Prelude.Text
deleteBroker_brokerId :: (Text -> f Text) -> DeleteBroker -> f DeleteBroker
deleteBroker_brokerId = (DeleteBroker -> Text)
-> (DeleteBroker -> Text -> DeleteBroker)
-> Lens DeleteBroker DeleteBroker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBroker' {Text
brokerId :: Text
$sel:brokerId:DeleteBroker' :: DeleteBroker -> Text
brokerId} -> Text
brokerId) (\s :: DeleteBroker
s@DeleteBroker' {} Text
a -> DeleteBroker
s {$sel:brokerId:DeleteBroker' :: Text
brokerId = Text
a} :: DeleteBroker)

instance Core.AWSRequest DeleteBroker where
  type AWSResponse DeleteBroker = DeleteBrokerResponse
  request :: DeleteBroker -> Request DeleteBroker
request = Service -> DeleteBroker -> Request DeleteBroker
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteBroker
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBroker)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteBroker))
-> Logger
-> Service
-> Proxy DeleteBroker
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteBroker)))
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 -> Int -> DeleteBrokerResponse
DeleteBrokerResponse'
            (Maybe Text -> Int -> DeleteBrokerResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteBrokerResponse)
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
"brokerId")
            Either String (Int -> DeleteBrokerResponse)
-> Either String Int -> Either String DeleteBrokerResponse
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 DeleteBroker

instance Prelude.NFData DeleteBroker

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

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

-- | /See:/ 'newDeleteBrokerResponse' smart constructor.
data DeleteBrokerResponse = DeleteBrokerResponse'
  { -- | The unique ID that Amazon MQ generates for the broker.
    DeleteBrokerResponse -> Maybe Text
brokerId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteBrokerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteBrokerResponse -> DeleteBrokerResponse -> Bool
(DeleteBrokerResponse -> DeleteBrokerResponse -> Bool)
-> (DeleteBrokerResponse -> DeleteBrokerResponse -> Bool)
-> Eq DeleteBrokerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBrokerResponse -> DeleteBrokerResponse -> Bool
$c/= :: DeleteBrokerResponse -> DeleteBrokerResponse -> Bool
== :: DeleteBrokerResponse -> DeleteBrokerResponse -> Bool
$c== :: DeleteBrokerResponse -> DeleteBrokerResponse -> Bool
Prelude.Eq, ReadPrec [DeleteBrokerResponse]
ReadPrec DeleteBrokerResponse
Int -> ReadS DeleteBrokerResponse
ReadS [DeleteBrokerResponse]
(Int -> ReadS DeleteBrokerResponse)
-> ReadS [DeleteBrokerResponse]
-> ReadPrec DeleteBrokerResponse
-> ReadPrec [DeleteBrokerResponse]
-> Read DeleteBrokerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBrokerResponse]
$creadListPrec :: ReadPrec [DeleteBrokerResponse]
readPrec :: ReadPrec DeleteBrokerResponse
$creadPrec :: ReadPrec DeleteBrokerResponse
readList :: ReadS [DeleteBrokerResponse]
$creadList :: ReadS [DeleteBrokerResponse]
readsPrec :: Int -> ReadS DeleteBrokerResponse
$creadsPrec :: Int -> ReadS DeleteBrokerResponse
Prelude.Read, Int -> DeleteBrokerResponse -> ShowS
[DeleteBrokerResponse] -> ShowS
DeleteBrokerResponse -> String
(Int -> DeleteBrokerResponse -> ShowS)
-> (DeleteBrokerResponse -> String)
-> ([DeleteBrokerResponse] -> ShowS)
-> Show DeleteBrokerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBrokerResponse] -> ShowS
$cshowList :: [DeleteBrokerResponse] -> ShowS
show :: DeleteBrokerResponse -> String
$cshow :: DeleteBrokerResponse -> String
showsPrec :: Int -> DeleteBrokerResponse -> ShowS
$cshowsPrec :: Int -> DeleteBrokerResponse -> ShowS
Prelude.Show, (forall x. DeleteBrokerResponse -> Rep DeleteBrokerResponse x)
-> (forall x. Rep DeleteBrokerResponse x -> DeleteBrokerResponse)
-> Generic DeleteBrokerResponse
forall x. Rep DeleteBrokerResponse x -> DeleteBrokerResponse
forall x. DeleteBrokerResponse -> Rep DeleteBrokerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBrokerResponse x -> DeleteBrokerResponse
$cfrom :: forall x. DeleteBrokerResponse -> Rep DeleteBrokerResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBrokerResponse' 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:
--
-- 'brokerId', 'deleteBrokerResponse_brokerId' - The unique ID that Amazon MQ generates for the broker.
--
-- 'httpStatus', 'deleteBrokerResponse_httpStatus' - The response's http status code.
newDeleteBrokerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteBrokerResponse
newDeleteBrokerResponse :: Int -> DeleteBrokerResponse
newDeleteBrokerResponse Int
pHttpStatus_ =
  DeleteBrokerResponse' :: Maybe Text -> Int -> DeleteBrokerResponse
DeleteBrokerResponse'
    { $sel:brokerId:DeleteBrokerResponse' :: Maybe Text
brokerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteBrokerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID that Amazon MQ generates for the broker.
deleteBrokerResponse_brokerId :: Lens.Lens' DeleteBrokerResponse (Prelude.Maybe Prelude.Text)
deleteBrokerResponse_brokerId :: (Maybe Text -> f (Maybe Text))
-> DeleteBrokerResponse -> f DeleteBrokerResponse
deleteBrokerResponse_brokerId = (DeleteBrokerResponse -> Maybe Text)
-> (DeleteBrokerResponse -> Maybe Text -> DeleteBrokerResponse)
-> Lens
     DeleteBrokerResponse DeleteBrokerResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBrokerResponse' {Maybe Text
brokerId :: Maybe Text
$sel:brokerId:DeleteBrokerResponse' :: DeleteBrokerResponse -> Maybe Text
brokerId} -> Maybe Text
brokerId) (\s :: DeleteBrokerResponse
s@DeleteBrokerResponse' {} Maybe Text
a -> DeleteBrokerResponse
s {$sel:brokerId:DeleteBrokerResponse' :: Maybe Text
brokerId = Maybe Text
a} :: DeleteBrokerResponse)

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

instance Prelude.NFData DeleteBrokerResponse