{-# 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.DeletePartnerEventSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This operation is used by SaaS partners to delete a partner event
-- source. This operation is not used by Amazon Web Services customers.
--
-- When you delete an event source, the status of the corresponding partner
-- event bus in the Amazon Web Services customer account becomes DELETED.
module Amazonka.CloudWatchEvents.DeletePartnerEventSource
  ( -- * Creating a Request
    DeletePartnerEventSource (..),
    newDeletePartnerEventSource,

    -- * Request Lenses
    deletePartnerEventSource_name,
    deletePartnerEventSource_account,

    -- * Destructuring the Response
    DeletePartnerEventSourceResponse (..),
    newDeletePartnerEventSourceResponse,
  )
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:/ 'newDeletePartnerEventSource' smart constructor.
data DeletePartnerEventSource = DeletePartnerEventSource'
  { -- | The name of the event source to delete.
    DeletePartnerEventSource -> Text
name :: Prelude.Text,
    -- | The Amazon Web Services account ID of the Amazon Web Services customer
    -- that the event source was created for.
    DeletePartnerEventSource -> Text
account :: Prelude.Text
  }
  deriving (DeletePartnerEventSource -> DeletePartnerEventSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePartnerEventSource -> DeletePartnerEventSource -> Bool
$c/= :: DeletePartnerEventSource -> DeletePartnerEventSource -> Bool
== :: DeletePartnerEventSource -> DeletePartnerEventSource -> Bool
$c== :: DeletePartnerEventSource -> DeletePartnerEventSource -> Bool
Prelude.Eq, ReadPrec [DeletePartnerEventSource]
ReadPrec DeletePartnerEventSource
Int -> ReadS DeletePartnerEventSource
ReadS [DeletePartnerEventSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePartnerEventSource]
$creadListPrec :: ReadPrec [DeletePartnerEventSource]
readPrec :: ReadPrec DeletePartnerEventSource
$creadPrec :: ReadPrec DeletePartnerEventSource
readList :: ReadS [DeletePartnerEventSource]
$creadList :: ReadS [DeletePartnerEventSource]
readsPrec :: Int -> ReadS DeletePartnerEventSource
$creadsPrec :: Int -> ReadS DeletePartnerEventSource
Prelude.Read, Int -> DeletePartnerEventSource -> ShowS
[DeletePartnerEventSource] -> ShowS
DeletePartnerEventSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePartnerEventSource] -> ShowS
$cshowList :: [DeletePartnerEventSource] -> ShowS
show :: DeletePartnerEventSource -> String
$cshow :: DeletePartnerEventSource -> String
showsPrec :: Int -> DeletePartnerEventSource -> ShowS
$cshowsPrec :: Int -> DeletePartnerEventSource -> ShowS
Prelude.Show, forall x.
Rep DeletePartnerEventSource x -> DeletePartnerEventSource
forall x.
DeletePartnerEventSource -> Rep DeletePartnerEventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePartnerEventSource x -> DeletePartnerEventSource
$cfrom :: forall x.
DeletePartnerEventSource -> Rep DeletePartnerEventSource x
Prelude.Generic)

-- |
-- Create a value of 'DeletePartnerEventSource' 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', 'deletePartnerEventSource_name' - The name of the event source to delete.
--
-- 'account', 'deletePartnerEventSource_account' - The Amazon Web Services account ID of the Amazon Web Services customer
-- that the event source was created for.
newDeletePartnerEventSource ::
  -- | 'name'
  Prelude.Text ->
  -- | 'account'
  Prelude.Text ->
  DeletePartnerEventSource
newDeletePartnerEventSource :: Text -> Text -> DeletePartnerEventSource
newDeletePartnerEventSource Text
pName_ Text
pAccount_ =
  DeletePartnerEventSource'
    { $sel:name:DeletePartnerEventSource' :: Text
name = Text
pName_,
      $sel:account:DeletePartnerEventSource' :: Text
account = Text
pAccount_
    }

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

-- | The Amazon Web Services account ID of the Amazon Web Services customer
-- that the event source was created for.
deletePartnerEventSource_account :: Lens.Lens' DeletePartnerEventSource Prelude.Text
deletePartnerEventSource_account :: Lens' DeletePartnerEventSource Text
deletePartnerEventSource_account = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePartnerEventSource' {Text
account :: Text
$sel:account:DeletePartnerEventSource' :: DeletePartnerEventSource -> Text
account} -> Text
account) (\s :: DeletePartnerEventSource
s@DeletePartnerEventSource' {} Text
a -> DeletePartnerEventSource
s {$sel:account:DeletePartnerEventSource' :: Text
account = Text
a} :: DeletePartnerEventSource)

instance Core.AWSRequest DeletePartnerEventSource where
  type
    AWSResponse DeletePartnerEventSource =
      DeletePartnerEventSourceResponse
  request :: (Service -> Service)
-> DeletePartnerEventSource -> Request DeletePartnerEventSource
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 DeletePartnerEventSource
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePartnerEventSource)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeletePartnerEventSourceResponse
DeletePartnerEventSourceResponse'

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

instance Prelude.NFData DeletePartnerEventSource where
  rnf :: DeletePartnerEventSource -> ()
rnf DeletePartnerEventSource' {Text
account :: Text
name :: Text
$sel:account:DeletePartnerEventSource' :: DeletePartnerEventSource -> Text
$sel:name:DeletePartnerEventSource' :: DeletePartnerEventSource -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
account

instance Data.ToHeaders DeletePartnerEventSource where
  toHeaders :: DeletePartnerEventSource -> [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.DeletePartnerEventSource" ::
                          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 DeletePartnerEventSource where
  toJSON :: DeletePartnerEventSource -> Value
toJSON DeletePartnerEventSource' {Text
account :: Text
name :: Text
$sel:account:DeletePartnerEventSource' :: DeletePartnerEventSource -> Text
$sel:name:DeletePartnerEventSource' :: DeletePartnerEventSource -> 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),
            forall a. a -> Maybe a
Prelude.Just (Key
"Account" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
account)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    DeletePartnerEventSourceResponse
  where
  rnf :: DeletePartnerEventSourceResponse -> ()
rnf DeletePartnerEventSourceResponse
_ = ()