{-# 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.Config.DeleteDeliveryChannel
-- 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 delivery channel.
--
-- Before you can delete the delivery channel, you must stop the
-- configuration recorder by using the StopConfigurationRecorder action.
module Amazonka.Config.DeleteDeliveryChannel
  ( -- * Creating a Request
    DeleteDeliveryChannel (..),
    newDeleteDeliveryChannel,

    -- * Request Lenses
    deleteDeliveryChannel_deliveryChannelName,

    -- * Destructuring the Response
    DeleteDeliveryChannelResponse (..),
    newDeleteDeliveryChannelResponse,
  )
where

import Amazonka.Config.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

-- | The input for the DeleteDeliveryChannel action. The action accepts the
-- following data, in JSON format.
--
-- /See:/ 'newDeleteDeliveryChannel' smart constructor.
data DeleteDeliveryChannel = DeleteDeliveryChannel'
  { -- | The name of the delivery channel to delete.
    DeleteDeliveryChannel -> Text
deliveryChannelName :: Prelude.Text
  }
  deriving (DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool
(DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool)
-> (DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool)
-> Eq DeleteDeliveryChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool
$c/= :: DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool
== :: DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool
$c== :: DeleteDeliveryChannel -> DeleteDeliveryChannel -> Bool
Prelude.Eq, ReadPrec [DeleteDeliveryChannel]
ReadPrec DeleteDeliveryChannel
Int -> ReadS DeleteDeliveryChannel
ReadS [DeleteDeliveryChannel]
(Int -> ReadS DeleteDeliveryChannel)
-> ReadS [DeleteDeliveryChannel]
-> ReadPrec DeleteDeliveryChannel
-> ReadPrec [DeleteDeliveryChannel]
-> Read DeleteDeliveryChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDeliveryChannel]
$creadListPrec :: ReadPrec [DeleteDeliveryChannel]
readPrec :: ReadPrec DeleteDeliveryChannel
$creadPrec :: ReadPrec DeleteDeliveryChannel
readList :: ReadS [DeleteDeliveryChannel]
$creadList :: ReadS [DeleteDeliveryChannel]
readsPrec :: Int -> ReadS DeleteDeliveryChannel
$creadsPrec :: Int -> ReadS DeleteDeliveryChannel
Prelude.Read, Int -> DeleteDeliveryChannel -> ShowS
[DeleteDeliveryChannel] -> ShowS
DeleteDeliveryChannel -> String
(Int -> DeleteDeliveryChannel -> ShowS)
-> (DeleteDeliveryChannel -> String)
-> ([DeleteDeliveryChannel] -> ShowS)
-> Show DeleteDeliveryChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDeliveryChannel] -> ShowS
$cshowList :: [DeleteDeliveryChannel] -> ShowS
show :: DeleteDeliveryChannel -> String
$cshow :: DeleteDeliveryChannel -> String
showsPrec :: Int -> DeleteDeliveryChannel -> ShowS
$cshowsPrec :: Int -> DeleteDeliveryChannel -> ShowS
Prelude.Show, (forall x. DeleteDeliveryChannel -> Rep DeleteDeliveryChannel x)
-> (forall x. Rep DeleteDeliveryChannel x -> DeleteDeliveryChannel)
-> Generic DeleteDeliveryChannel
forall x. Rep DeleteDeliveryChannel x -> DeleteDeliveryChannel
forall x. DeleteDeliveryChannel -> Rep DeleteDeliveryChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDeliveryChannel x -> DeleteDeliveryChannel
$cfrom :: forall x. DeleteDeliveryChannel -> Rep DeleteDeliveryChannel x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDeliveryChannel' 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:
--
-- 'deliveryChannelName', 'deleteDeliveryChannel_deliveryChannelName' - The name of the delivery channel to delete.
newDeleteDeliveryChannel ::
  -- | 'deliveryChannelName'
  Prelude.Text ->
  DeleteDeliveryChannel
newDeleteDeliveryChannel :: Text -> DeleteDeliveryChannel
newDeleteDeliveryChannel Text
pDeliveryChannelName_ =
  DeleteDeliveryChannel' :: Text -> DeleteDeliveryChannel
DeleteDeliveryChannel'
    { $sel:deliveryChannelName:DeleteDeliveryChannel' :: Text
deliveryChannelName =
        Text
pDeliveryChannelName_
    }

-- | The name of the delivery channel to delete.
deleteDeliveryChannel_deliveryChannelName :: Lens.Lens' DeleteDeliveryChannel Prelude.Text
deleteDeliveryChannel_deliveryChannelName :: (Text -> f Text)
-> DeleteDeliveryChannel -> f DeleteDeliveryChannel
deleteDeliveryChannel_deliveryChannelName = (DeleteDeliveryChannel -> Text)
-> (DeleteDeliveryChannel -> Text -> DeleteDeliveryChannel)
-> Lens DeleteDeliveryChannel DeleteDeliveryChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeliveryChannel' {Text
deliveryChannelName :: Text
$sel:deliveryChannelName:DeleteDeliveryChannel' :: DeleteDeliveryChannel -> Text
deliveryChannelName} -> Text
deliveryChannelName) (\s :: DeleteDeliveryChannel
s@DeleteDeliveryChannel' {} Text
a -> DeleteDeliveryChannel
s {$sel:deliveryChannelName:DeleteDeliveryChannel' :: Text
deliveryChannelName = Text
a} :: DeleteDeliveryChannel)

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

instance Prelude.Hashable DeleteDeliveryChannel

instance Prelude.NFData DeleteDeliveryChannel

instance Core.ToHeaders DeleteDeliveryChannel where
  toHeaders :: DeleteDeliveryChannel -> [Header]
toHeaders =
    [Header] -> DeleteDeliveryChannel -> [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
"StarlingDoveService.DeleteDeliveryChannel" ::
                          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 DeleteDeliveryChannel where
  toJSON :: DeleteDeliveryChannel -> Value
toJSON DeleteDeliveryChannel' {Text
deliveryChannelName :: Text
$sel:deliveryChannelName:DeleteDeliveryChannel' :: DeleteDeliveryChannel -> 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
"DeliveryChannelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryChannelName)
          ]
      )

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

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

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

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

instance Prelude.NFData DeleteDeliveryChannelResponse