{-# 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-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)
--
-- 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.Lens as Lens
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
(DeletePartnerEventSource -> DeletePartnerEventSource -> Bool)
-> (DeletePartnerEventSource -> DeletePartnerEventSource -> Bool)
-> Eq DeletePartnerEventSource
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]
(Int -> ReadS DeletePartnerEventSource)
-> ReadS [DeletePartnerEventSource]
-> ReadPrec DeletePartnerEventSource
-> ReadPrec [DeletePartnerEventSource]
-> Read 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
(Int -> DeletePartnerEventSource -> ShowS)
-> (DeletePartnerEventSource -> String)
-> ([DeletePartnerEventSource] -> ShowS)
-> Show DeletePartnerEventSource
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.
 DeletePartnerEventSource -> Rep DeletePartnerEventSource x)
-> (forall x.
    Rep DeletePartnerEventSource x -> DeletePartnerEventSource)
-> Generic DeletePartnerEventSource
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' :: Text -> Text -> DeletePartnerEventSource
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 :: (Text -> f Text)
-> DeletePartnerEventSource -> f DeletePartnerEventSource
deletePartnerEventSource_name = (DeletePartnerEventSource -> Text)
-> (DeletePartnerEventSource -> Text -> DeletePartnerEventSource)
-> Lens DeletePartnerEventSource DeletePartnerEventSource Text Text
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 :: (Text -> f Text)
-> DeletePartnerEventSource -> f DeletePartnerEventSource
deletePartnerEventSource_account = (DeletePartnerEventSource -> Text)
-> (DeletePartnerEventSource -> Text -> DeletePartnerEventSource)
-> Lens DeletePartnerEventSource DeletePartnerEventSource Text Text
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 :: DeletePartnerEventSource -> Request DeletePartnerEventSource
request = Service
-> DeletePartnerEventSource -> Request DeletePartnerEventSource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePartnerEventSource
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePartnerEventSource)))
response =
    AWSResponse DeletePartnerEventSource
-> Logger
-> Service
-> Proxy DeletePartnerEventSource
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePartnerEventSource)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeletePartnerEventSource
DeletePartnerEventSourceResponse
DeletePartnerEventSourceResponse'

instance Prelude.Hashable DeletePartnerEventSource

instance Prelude.NFData DeletePartnerEventSource

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

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

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

-- | /See:/ 'newDeletePartnerEventSourceResponse' smart constructor.
data DeletePartnerEventSourceResponse = DeletePartnerEventSourceResponse'
  {
  }
  deriving (DeletePartnerEventSourceResponse
-> DeletePartnerEventSourceResponse -> Bool
(DeletePartnerEventSourceResponse
 -> DeletePartnerEventSourceResponse -> Bool)
-> (DeletePartnerEventSourceResponse
    -> DeletePartnerEventSourceResponse -> Bool)
-> Eq DeletePartnerEventSourceResponse
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]
(Int -> ReadS DeletePartnerEventSourceResponse)
-> ReadS [DeletePartnerEventSourceResponse]
-> ReadPrec DeletePartnerEventSourceResponse
-> ReadPrec [DeletePartnerEventSourceResponse]
-> Read 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
(Int -> DeletePartnerEventSourceResponse -> ShowS)
-> (DeletePartnerEventSourceResponse -> String)
-> ([DeletePartnerEventSourceResponse] -> ShowS)
-> Show DeletePartnerEventSourceResponse
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.
 DeletePartnerEventSourceResponse
 -> Rep DeletePartnerEventSourceResponse x)
-> (forall x.
    Rep DeletePartnerEventSourceResponse x
    -> DeletePartnerEventSourceResponse)
-> Generic DeletePartnerEventSourceResponse
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