{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:name:DeleteEventBus' :: Text
name = Text
pName_}

-- | The name of the event bus to delete.
deleteEventBus_name :: Lens.Lens' DeleteEventBus Prelude.Text
deleteEventBus_name :: Lens' DeleteEventBus Text
deleteEventBus_name = 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 :: (Service -> Service) -> DeleteEventBus -> Request DeleteEventBus
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEventBus)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteEventBusResponse
DeleteEventBusResponse'

instance Prelude.Hashable DeleteEventBus where
  hashWithSalt :: Int -> DeleteEventBus -> Int
hashWithSalt Int
_salt DeleteEventBus' {Text
name :: Text
$sel:name:DeleteEventBus' :: DeleteEventBus -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

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

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

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

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

-- | /See:/ 'newDeleteEventBusResponse' smart constructor.
data DeleteEventBusResponse = DeleteEventBusResponse'
  {
  }
  deriving (DeleteEventBusResponse -> DeleteEventBusResponse -> Bool
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]
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
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. 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 where
  rnf :: DeleteEventBusResponse -> ()
rnf DeleteEventBusResponse
_ = ()