{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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:/ '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
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]
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
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.
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'
      { $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 :: Lens' DeleteSubscriptionFilter Text
deleteSubscriptionFilter_logGroupName = 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 :: Lens' DeleteSubscriptionFilter Text
deleteSubscriptionFilter_filterName = 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 :: (Service -> Service)
-> DeleteSubscriptionFilter -> Request DeleteSubscriptionFilter
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 DeleteSubscriptionFilter
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSubscriptionFilter)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteSubscriptionFilterResponse
DeleteSubscriptionFilterResponse'

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

instance Prelude.NFData DeleteSubscriptionFilter where
  rnf :: DeleteSubscriptionFilter -> ()
rnf DeleteSubscriptionFilter' {Text
filterName :: Text
logGroupName :: Text
$sel:filterName:DeleteSubscriptionFilter' :: DeleteSubscriptionFilter -> Text
$sel:logGroupName:DeleteSubscriptionFilter' :: DeleteSubscriptionFilter -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
logGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
filterName

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

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

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

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