{-# 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.CloudWatchEvents.DeleteEventBus
-- 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 custom event bus or partner event bus. All rules
-- associated with this event bus need to be deleted. You can\'t delete
-- your account\'s default event bus.
module Amazonka.CloudWatchEvents.DeleteEventBus
  ( -- * Creating a Request
    DeleteEventBus (..),
    newDeleteEventBus,

    -- * Request Lenses
    deleteEventBus_name,

    -- * Destructuring the Response
    DeleteEventBusResponse (..),
    newDeleteEventBusResponse,
  )
where

import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
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:/ 'newDeleteEventBus' smart constructor.
data DeleteEventBus = DeleteEventBus'
  { -- | The name of the event bus to delete.
    DeleteEventBus -> Text
name :: Prelude.Text
  }
  deriving (DeleteEventBus -> DeleteEventBus -> Bool
(DeleteEventBus -> DeleteEventBus -> Bool)
-> (DeleteEventBus -> DeleteEventBus -> Bool) -> Eq DeleteEventBus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventBus -> DeleteEventBus -> Bool
$c/= :: DeleteEventBus -> DeleteEventBus -> Bool
== :: DeleteEventBus -> DeleteEventBus -> Bool
$c== :: DeleteEventBus -> DeleteEventBus -> Bool
Prelude.Eq, ReadPrec [DeleteEventBus]
ReadPrec DeleteEventBus
Int -> ReadS DeleteEventBus
ReadS [DeleteEventBus]
(Int -> ReadS DeleteEventBus)
-> ReadS [DeleteEventBus]
-> ReadPrec DeleteEventBus
-> ReadPrec [DeleteEventBus]
-> Read DeleteEventBus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventBus]
$creadListPrec :: ReadPrec [DeleteEventBus]
readPrec :: ReadPrec DeleteEventBus
$creadPrec :: ReadPrec DeleteEventBus
readList :: ReadS [DeleteEventBus]
$creadList :: ReadS [DeleteEventBus]
readsPrec :: Int -> ReadS DeleteEventBus
$creadsPrec :: Int -> ReadS DeleteEventBus
Prelude.Read, Int -> DeleteEventBus -> ShowS
[DeleteEventBus] -> ShowS
DeleteEventBus -> String
(Int -> DeleteEventBus -> ShowS)
-> (DeleteEventBus -> String)
-> ([DeleteEventBus] -> ShowS)
-> Show DeleteEventBus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventBus] -> ShowS
$cshowList :: [DeleteEventBus] -> ShowS
show :: DeleteEventBus -> String
$cshow :: DeleteEventBus -> String
showsPrec :: Int -> DeleteEventBus -> ShowS
$cshowsPrec :: Int -> DeleteEventBus -> ShowS
Prelude.Show, (forall x. DeleteEventBus -> Rep DeleteEventBus x)
-> (forall x. Rep DeleteEventBus x -> DeleteEventBus)
-> Generic DeleteEventBus
forall x. Rep DeleteEventBus x -> DeleteEventBus
forall x. DeleteEventBus -> Rep DeleteEventBus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEventBus x -> DeleteEventBus
$cfrom :: forall x. DeleteEventBus -> Rep DeleteEventBus x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventBus' 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:
--
-- 'name', 'deleteEventBus_name' - The name of the event bus to delete.
newDeleteEventBus ::
  -- | 'name'
  Prelude.Text ->
  DeleteEventBus
newDeleteEventBus :: Text -> DeleteEventBus
newDeleteEventBus Text
pName_ =
  DeleteEventBus' :: Text -> DeleteEventBus
DeleteEventBus' {$sel:name:DeleteEventBus' :: Text
name = Text
pName_}

-- | The name of the event bus to delete.
deleteEventBus_name :: Lens.Lens' DeleteEventBus Prelude.Text
deleteEventBus_name :: (Text -> f Text) -> DeleteEventBus -> f DeleteEventBus
deleteEventBus_name = (DeleteEventBus -> Text)
-> (DeleteEventBus -> Text -> DeleteEventBus)
-> Lens DeleteEventBus DeleteEventBus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventBus' {Text
name :: Text
$sel:name:DeleteEventBus' :: DeleteEventBus -> Text
name} -> Text
name) (\s :: DeleteEventBus
s@DeleteEventBus' {} Text
a -> DeleteEventBus
s {$sel:name:DeleteEventBus' :: Text
name = Text
a} :: DeleteEventBus)

instance Core.AWSRequest DeleteEventBus where
  type
    AWSResponse DeleteEventBus =
      DeleteEventBusResponse
  request :: DeleteEventBus -> Request DeleteEventBus
request = Service -> DeleteEventBus -> Request DeleteEventBus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEventBus)))
response =
    AWSResponse DeleteEventBus
-> Logger
-> Service
-> Proxy DeleteEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEventBus)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteEventBus
DeleteEventBusResponse
DeleteEventBusResponse'

instance Prelude.Hashable DeleteEventBus

instance Prelude.NFData DeleteEventBus

instance Core.ToHeaders DeleteEventBus where
  toHeaders :: DeleteEventBus -> [Header]
toHeaders =
    [Header] -> DeleteEventBus -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"AWSEvents.DeleteEventBus" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteEventBus where
  toJSON :: DeleteEventBus -> Value
toJSON DeleteEventBus' {Text
name :: Text
$sel:name:DeleteEventBus' :: DeleteEventBus -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

instance Core.ToPath DeleteEventBus where
  toPath :: DeleteEventBus -> ByteString
toPath = ByteString -> DeleteEventBus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDeleteEventBusResponse' smart constructor.
data DeleteEventBusResponse = DeleteEventBusResponse'
  {
  }
  deriving (DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
(DeleteEventBusResponse -> DeleteEventBusResponse -> Bool)
-> (DeleteEventBusResponse -> DeleteEventBusResponse -> Bool)
-> Eq DeleteEventBusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
$c/= :: DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
== :: DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
$c== :: DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
Prelude.Eq, ReadPrec [DeleteEventBusResponse]
ReadPrec DeleteEventBusResponse
Int -> ReadS DeleteEventBusResponse
ReadS [DeleteEventBusResponse]
(Int -> ReadS DeleteEventBusResponse)
-> ReadS [DeleteEventBusResponse]
-> ReadPrec DeleteEventBusResponse
-> ReadPrec [DeleteEventBusResponse]
-> Read DeleteEventBusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventBusResponse]
$creadListPrec :: ReadPrec [DeleteEventBusResponse]
readPrec :: ReadPrec DeleteEventBusResponse
$creadPrec :: ReadPrec DeleteEventBusResponse
readList :: ReadS [DeleteEventBusResponse]
$creadList :: ReadS [DeleteEventBusResponse]
readsPrec :: Int -> ReadS DeleteEventBusResponse
$creadsPrec :: Int -> ReadS DeleteEventBusResponse
Prelude.Read, Int -> DeleteEventBusResponse -> ShowS
[DeleteEventBusResponse] -> ShowS
DeleteEventBusResponse -> String
(Int -> DeleteEventBusResponse -> ShowS)
-> (DeleteEventBusResponse -> String)
-> ([DeleteEventBusResponse] -> ShowS)
-> Show DeleteEventBusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventBusResponse] -> ShowS
$cshowList :: [DeleteEventBusResponse] -> ShowS
show :: DeleteEventBusResponse -> String
$cshow :: DeleteEventBusResponse -> String
showsPrec :: Int -> DeleteEventBusResponse -> ShowS
$cshowsPrec :: Int -> DeleteEventBusResponse -> ShowS
Prelude.Show, (forall x. DeleteEventBusResponse -> Rep DeleteEventBusResponse x)
-> (forall x.
    Rep DeleteEventBusResponse x -> DeleteEventBusResponse)
-> Generic DeleteEventBusResponse
forall x. Rep DeleteEventBusResponse x -> DeleteEventBusResponse
forall x. DeleteEventBusResponse -> Rep DeleteEventBusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEventBusResponse x -> DeleteEventBusResponse
$cfrom :: forall x. DeleteEventBusResponse -> Rep DeleteEventBusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventBusResponse' 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.
newDeleteEventBusResponse ::
  DeleteEventBusResponse
newDeleteEventBusResponse :: DeleteEventBusResponse
newDeleteEventBusResponse = DeleteEventBusResponse
DeleteEventBusResponse'

instance Prelude.NFData DeleteEventBusResponse