{-# 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.CloudWatchLogs.DeleteSubscriptionFilter
-- 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 subscription filter.
module Amazonka.CloudWatchLogs.DeleteSubscriptionFilter
  ( -- * Creating a Request
    DeleteSubscriptionFilter (..),
    newDeleteSubscriptionFilter,

    -- * Request Lenses
    deleteSubscriptionFilter_logGroupName,
    deleteSubscriptionFilter_filterName,

    -- * Destructuring the Response
    DeleteSubscriptionFilterResponse (..),
    newDeleteSubscriptionFilterResponse,
  )
where

import Amazonka.CloudWatchLogs.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:/ 'newDeleteSubscriptionFilter' smart constructor.
data DeleteSubscriptionFilter = DeleteSubscriptionFilter'
  { -- | The name of the log group.
    DeleteSubscriptionFilter -> Text
logGroupName :: Prelude.Text,
    -- | The name of the subscription filter.
    DeleteSubscriptionFilter -> Text
filterName :: Prelude.Text
  }
  deriving (DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool
(DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool)
-> (DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool)
-> Eq DeleteSubscriptionFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool
$c/= :: DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool
== :: DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool
$c== :: DeleteSubscriptionFilter -> DeleteSubscriptionFilter -> Bool
Prelude.Eq, ReadPrec [DeleteSubscriptionFilter]
ReadPrec DeleteSubscriptionFilter
Int -> ReadS DeleteSubscriptionFilter
ReadS [DeleteSubscriptionFilter]
(Int -> ReadS DeleteSubscriptionFilter)
-> ReadS [DeleteSubscriptionFilter]
-> ReadPrec DeleteSubscriptionFilter
-> ReadPrec [DeleteSubscriptionFilter]
-> Read DeleteSubscriptionFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSubscriptionFilter]
$creadListPrec :: ReadPrec [DeleteSubscriptionFilter]
readPrec :: ReadPrec DeleteSubscriptionFilter
$creadPrec :: ReadPrec DeleteSubscriptionFilter
readList :: ReadS [DeleteSubscriptionFilter]
$creadList :: ReadS [DeleteSubscriptionFilter]
readsPrec :: Int -> ReadS DeleteSubscriptionFilter
$creadsPrec :: Int -> ReadS DeleteSubscriptionFilter
Prelude.Read, Int -> DeleteSubscriptionFilter -> ShowS
[DeleteSubscriptionFilter] -> ShowS
DeleteSubscriptionFilter -> String
(Int -> DeleteSubscriptionFilter -> ShowS)
-> (DeleteSubscriptionFilter -> String)
-> ([DeleteSubscriptionFilter] -> ShowS)
-> Show DeleteSubscriptionFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSubscriptionFilter] -> ShowS
$cshowList :: [DeleteSubscriptionFilter] -> ShowS
show :: DeleteSubscriptionFilter -> String
$cshow :: DeleteSubscriptionFilter -> String
showsPrec :: Int -> DeleteSubscriptionFilter -> ShowS
$cshowsPrec :: Int -> DeleteSubscriptionFilter -> ShowS
Prelude.Show, (forall x.
 DeleteSubscriptionFilter -> Rep DeleteSubscriptionFilter x)
-> (forall x.
    Rep DeleteSubscriptionFilter x -> DeleteSubscriptionFilter)
-> Generic DeleteSubscriptionFilter
forall x.
Rep DeleteSubscriptionFilter x -> DeleteSubscriptionFilter
forall x.
DeleteSubscriptionFilter -> Rep DeleteSubscriptionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteSubscriptionFilter x -> DeleteSubscriptionFilter
$cfrom :: forall x.
DeleteSubscriptionFilter -> Rep DeleteSubscriptionFilter x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSubscriptionFilter' 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:
--
-- 'logGroupName', 'deleteSubscriptionFilter_logGroupName' - The name of the log group.
--
-- 'filterName', 'deleteSubscriptionFilter_filterName' - The name of the subscription filter.
newDeleteSubscriptionFilter ::
  -- | 'logGroupName'
  Prelude.Text ->
  -- | 'filterName'
  Prelude.Text ->
  DeleteSubscriptionFilter
newDeleteSubscriptionFilter :: Text -> Text -> DeleteSubscriptionFilter
newDeleteSubscriptionFilter
  Text
pLogGroupName_
  Text
pFilterName_ =
    DeleteSubscriptionFilter' :: Text -> Text -> DeleteSubscriptionFilter
DeleteSubscriptionFilter'
      { $sel:logGroupName:DeleteSubscriptionFilter' :: Text
logGroupName =
          Text
pLogGroupName_,
        $sel:filterName:DeleteSubscriptionFilter' :: Text
filterName = Text
pFilterName_
      }

-- | The name of the log group.
deleteSubscriptionFilter_logGroupName :: Lens.Lens' DeleteSubscriptionFilter Prelude.Text
deleteSubscriptionFilter_logGroupName :: (Text -> f Text)
-> DeleteSubscriptionFilter -> f DeleteSubscriptionFilter
deleteSubscriptionFilter_logGroupName = (DeleteSubscriptionFilter -> Text)
-> (DeleteSubscriptionFilter -> Text -> DeleteSubscriptionFilter)
-> Lens DeleteSubscriptionFilter DeleteSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSubscriptionFilter' {Text
logGroupName :: Text
$sel:logGroupName:DeleteSubscriptionFilter' :: DeleteSubscriptionFilter -> Text
logGroupName} -> Text
logGroupName) (\s :: DeleteSubscriptionFilter
s@DeleteSubscriptionFilter' {} Text
a -> DeleteSubscriptionFilter
s {$sel:logGroupName:DeleteSubscriptionFilter' :: Text
logGroupName = Text
a} :: DeleteSubscriptionFilter)

-- | The name of the subscription filter.
deleteSubscriptionFilter_filterName :: Lens.Lens' DeleteSubscriptionFilter Prelude.Text
deleteSubscriptionFilter_filterName :: (Text -> f Text)
-> DeleteSubscriptionFilter -> f DeleteSubscriptionFilter
deleteSubscriptionFilter_filterName = (DeleteSubscriptionFilter -> Text)
-> (DeleteSubscriptionFilter -> Text -> DeleteSubscriptionFilter)
-> Lens DeleteSubscriptionFilter DeleteSubscriptionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSubscriptionFilter' {Text
filterName :: Text
$sel:filterName:DeleteSubscriptionFilter' :: DeleteSubscriptionFilter -> Text
filterName} -> Text
filterName) (\s :: DeleteSubscriptionFilter
s@DeleteSubscriptionFilter' {} Text
a -> DeleteSubscriptionFilter
s {$sel:filterName:DeleteSubscriptionFilter' :: Text
filterName = Text
a} :: DeleteSubscriptionFilter)

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

instance Prelude.Hashable DeleteSubscriptionFilter

instance Prelude.NFData DeleteSubscriptionFilter

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

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

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

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

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

instance
  Prelude.NFData
    DeleteSubscriptionFilterResponse