{-# 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.DescribeSubscriptionFilters
-- 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)
--
-- Lists the subscription filters for the specified log group. You can list
-- all the subscription filters or filter the results by prefix. The
-- results are ASCII-sorted by filter name.
--
-- This operation returns paginated results.
module Amazonka.CloudWatchLogs.DescribeSubscriptionFilters
  ( -- * Creating a Request
    DescribeSubscriptionFilters (..),
    newDescribeSubscriptionFilters,

    -- * Request Lenses
    describeSubscriptionFilters_filterNamePrefix,
    describeSubscriptionFilters_nextToken,
    describeSubscriptionFilters_limit,
    describeSubscriptionFilters_logGroupName,

    -- * Destructuring the Response
    DescribeSubscriptionFiltersResponse (..),
    newDescribeSubscriptionFiltersResponse,

    -- * Response Lenses
    describeSubscriptionFiltersResponse_subscriptionFilters,
    describeSubscriptionFiltersResponse_nextToken,
    describeSubscriptionFiltersResponse_httpStatus,
  )
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:/ 'newDescribeSubscriptionFilters' smart constructor.
data DescribeSubscriptionFilters = DescribeSubscriptionFilters'
  { -- | The prefix to match. If you don\'t specify a value, no prefix filter is
    -- applied.
    DescribeSubscriptionFilters -> Maybe Text
filterNamePrefix :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeSubscriptionFilters -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items returned. If you don\'t specify a value, the
    -- default is up to 50 items.
    DescribeSubscriptionFilters -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The name of the log group.
    DescribeSubscriptionFilters -> Text
logGroupName :: Prelude.Text
  }
  deriving (DescribeSubscriptionFilters -> DescribeSubscriptionFilters -> Bool
(DescribeSubscriptionFilters
 -> DescribeSubscriptionFilters -> Bool)
-> (DescribeSubscriptionFilters
    -> DescribeSubscriptionFilters -> Bool)
-> Eq DescribeSubscriptionFilters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSubscriptionFilters -> DescribeSubscriptionFilters -> Bool
$c/= :: DescribeSubscriptionFilters -> DescribeSubscriptionFilters -> Bool
== :: DescribeSubscriptionFilters -> DescribeSubscriptionFilters -> Bool
$c== :: DescribeSubscriptionFilters -> DescribeSubscriptionFilters -> Bool
Prelude.Eq, ReadPrec [DescribeSubscriptionFilters]
ReadPrec DescribeSubscriptionFilters
Int -> ReadS DescribeSubscriptionFilters
ReadS [DescribeSubscriptionFilters]
(Int -> ReadS DescribeSubscriptionFilters)
-> ReadS [DescribeSubscriptionFilters]
-> ReadPrec DescribeSubscriptionFilters
-> ReadPrec [DescribeSubscriptionFilters]
-> Read DescribeSubscriptionFilters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSubscriptionFilters]
$creadListPrec :: ReadPrec [DescribeSubscriptionFilters]
readPrec :: ReadPrec DescribeSubscriptionFilters
$creadPrec :: ReadPrec DescribeSubscriptionFilters
readList :: ReadS [DescribeSubscriptionFilters]
$creadList :: ReadS [DescribeSubscriptionFilters]
readsPrec :: Int -> ReadS DescribeSubscriptionFilters
$creadsPrec :: Int -> ReadS DescribeSubscriptionFilters
Prelude.Read, Int -> DescribeSubscriptionFilters -> ShowS
[DescribeSubscriptionFilters] -> ShowS
DescribeSubscriptionFilters -> String
(Int -> DescribeSubscriptionFilters -> ShowS)
-> (DescribeSubscriptionFilters -> String)
-> ([DescribeSubscriptionFilters] -> ShowS)
-> Show DescribeSubscriptionFilters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSubscriptionFilters] -> ShowS
$cshowList :: [DescribeSubscriptionFilters] -> ShowS
show :: DescribeSubscriptionFilters -> String
$cshow :: DescribeSubscriptionFilters -> String
showsPrec :: Int -> DescribeSubscriptionFilters -> ShowS
$cshowsPrec :: Int -> DescribeSubscriptionFilters -> ShowS
Prelude.Show, (forall x.
 DescribeSubscriptionFilters -> Rep DescribeSubscriptionFilters x)
-> (forall x.
    Rep DescribeSubscriptionFilters x -> DescribeSubscriptionFilters)
-> Generic DescribeSubscriptionFilters
forall x.
Rep DescribeSubscriptionFilters x -> DescribeSubscriptionFilters
forall x.
DescribeSubscriptionFilters -> Rep DescribeSubscriptionFilters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSubscriptionFilters x -> DescribeSubscriptionFilters
$cfrom :: forall x.
DescribeSubscriptionFilters -> Rep DescribeSubscriptionFilters x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSubscriptionFilters' 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:
--
-- 'filterNamePrefix', 'describeSubscriptionFilters_filterNamePrefix' - The prefix to match. If you don\'t specify a value, no prefix filter is
-- applied.
--
-- 'nextToken', 'describeSubscriptionFilters_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'limit', 'describeSubscriptionFilters_limit' - The maximum number of items returned. If you don\'t specify a value, the
-- default is up to 50 items.
--
-- 'logGroupName', 'describeSubscriptionFilters_logGroupName' - The name of the log group.
newDescribeSubscriptionFilters ::
  -- | 'logGroupName'
  Prelude.Text ->
  DescribeSubscriptionFilters
newDescribeSubscriptionFilters :: Text -> DescribeSubscriptionFilters
newDescribeSubscriptionFilters Text
pLogGroupName_ =
  DescribeSubscriptionFilters' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeSubscriptionFilters
DescribeSubscriptionFilters'
    { $sel:filterNamePrefix:DescribeSubscriptionFilters' :: Maybe Text
filterNamePrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSubscriptionFilters' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeSubscriptionFilters' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:DescribeSubscriptionFilters' :: Text
logGroupName = Text
pLogGroupName_
    }

-- | The prefix to match. If you don\'t specify a value, no prefix filter is
-- applied.
describeSubscriptionFilters_filterNamePrefix :: Lens.Lens' DescribeSubscriptionFilters (Prelude.Maybe Prelude.Text)
describeSubscriptionFilters_filterNamePrefix :: (Maybe Text -> f (Maybe Text))
-> DescribeSubscriptionFilters -> f DescribeSubscriptionFilters
describeSubscriptionFilters_filterNamePrefix = (DescribeSubscriptionFilters -> Maybe Text)
-> (DescribeSubscriptionFilters
    -> Maybe Text -> DescribeSubscriptionFilters)
-> Lens
     DescribeSubscriptionFilters
     DescribeSubscriptionFilters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFilters' {Maybe Text
filterNamePrefix :: Maybe Text
$sel:filterNamePrefix:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Text
filterNamePrefix} -> Maybe Text
filterNamePrefix) (\s :: DescribeSubscriptionFilters
s@DescribeSubscriptionFilters' {} Maybe Text
a -> DescribeSubscriptionFilters
s {$sel:filterNamePrefix:DescribeSubscriptionFilters' :: Maybe Text
filterNamePrefix = Maybe Text
a} :: DescribeSubscriptionFilters)

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeSubscriptionFilters_nextToken :: Lens.Lens' DescribeSubscriptionFilters (Prelude.Maybe Prelude.Text)
describeSubscriptionFilters_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSubscriptionFilters -> f DescribeSubscriptionFilters
describeSubscriptionFilters_nextToken = (DescribeSubscriptionFilters -> Maybe Text)
-> (DescribeSubscriptionFilters
    -> Maybe Text -> DescribeSubscriptionFilters)
-> Lens
     DescribeSubscriptionFilters
     DescribeSubscriptionFilters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFilters' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSubscriptionFilters
s@DescribeSubscriptionFilters' {} Maybe Text
a -> DescribeSubscriptionFilters
s {$sel:nextToken:DescribeSubscriptionFilters' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSubscriptionFilters)

-- | The maximum number of items returned. If you don\'t specify a value, the
-- default is up to 50 items.
describeSubscriptionFilters_limit :: Lens.Lens' DescribeSubscriptionFilters (Prelude.Maybe Prelude.Natural)
describeSubscriptionFilters_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeSubscriptionFilters -> f DescribeSubscriptionFilters
describeSubscriptionFilters_limit = (DescribeSubscriptionFilters -> Maybe Natural)
-> (DescribeSubscriptionFilters
    -> Maybe Natural -> DescribeSubscriptionFilters)
-> Lens
     DescribeSubscriptionFilters
     DescribeSubscriptionFilters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFilters' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeSubscriptionFilters
s@DescribeSubscriptionFilters' {} Maybe Natural
a -> DescribeSubscriptionFilters
s {$sel:limit:DescribeSubscriptionFilters' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeSubscriptionFilters)

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

instance Core.AWSPager DescribeSubscriptionFilters where
  page :: DescribeSubscriptionFilters
-> AWSResponse DescribeSubscriptionFilters
-> Maybe DescribeSubscriptionFilters
page DescribeSubscriptionFilters
rq AWSResponse DescribeSubscriptionFilters
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSubscriptionFilters
DescribeSubscriptionFiltersResponse
rs
            DescribeSubscriptionFiltersResponse
-> Getting (First Text) DescribeSubscriptionFiltersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSubscriptionFiltersResponse
-> Const (First Text) DescribeSubscriptionFiltersResponse
Lens' DescribeSubscriptionFiltersResponse (Maybe Text)
describeSubscriptionFiltersResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSubscriptionFiltersResponse
 -> Const (First Text) DescribeSubscriptionFiltersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSubscriptionFiltersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeSubscriptionFilters
forall a. Maybe a
Prelude.Nothing
    | Maybe [SubscriptionFilter] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSubscriptionFilters
DescribeSubscriptionFiltersResponse
rs
            DescribeSubscriptionFiltersResponse
-> Getting
     (First [SubscriptionFilter])
     DescribeSubscriptionFiltersResponse
     [SubscriptionFilter]
-> Maybe [SubscriptionFilter]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SubscriptionFilter]
 -> Const (First [SubscriptionFilter]) (Maybe [SubscriptionFilter]))
-> DescribeSubscriptionFiltersResponse
-> Const
     (First [SubscriptionFilter]) DescribeSubscriptionFiltersResponse
Lens'
  DescribeSubscriptionFiltersResponse (Maybe [SubscriptionFilter])
describeSubscriptionFiltersResponse_subscriptionFilters
              ((Maybe [SubscriptionFilter]
  -> Const (First [SubscriptionFilter]) (Maybe [SubscriptionFilter]))
 -> DescribeSubscriptionFiltersResponse
 -> Const
      (First [SubscriptionFilter]) DescribeSubscriptionFiltersResponse)
-> (([SubscriptionFilter]
     -> Const (First [SubscriptionFilter]) [SubscriptionFilter])
    -> Maybe [SubscriptionFilter]
    -> Const (First [SubscriptionFilter]) (Maybe [SubscriptionFilter]))
-> Getting
     (First [SubscriptionFilter])
     DescribeSubscriptionFiltersResponse
     [SubscriptionFilter]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SubscriptionFilter]
 -> Const (First [SubscriptionFilter]) [SubscriptionFilter])
-> Maybe [SubscriptionFilter]
-> Const (First [SubscriptionFilter]) (Maybe [SubscriptionFilter])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeSubscriptionFilters
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeSubscriptionFilters -> Maybe DescribeSubscriptionFilters
forall a. a -> Maybe a
Prelude.Just (DescribeSubscriptionFilters -> Maybe DescribeSubscriptionFilters)
-> DescribeSubscriptionFilters -> Maybe DescribeSubscriptionFilters
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeSubscriptionFilters
rq
          DescribeSubscriptionFilters
-> (DescribeSubscriptionFilters -> DescribeSubscriptionFilters)
-> DescribeSubscriptionFilters
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeSubscriptionFilters
-> Identity DescribeSubscriptionFilters
Lens
  DescribeSubscriptionFilters
  DescribeSubscriptionFilters
  (Maybe Text)
  (Maybe Text)
describeSubscriptionFilters_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeSubscriptionFilters
 -> Identity DescribeSubscriptionFilters)
-> Maybe Text
-> DescribeSubscriptionFilters
-> DescribeSubscriptionFilters
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeSubscriptionFilters
DescribeSubscriptionFiltersResponse
rs
          DescribeSubscriptionFiltersResponse
-> Getting (First Text) DescribeSubscriptionFiltersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSubscriptionFiltersResponse
-> Const (First Text) DescribeSubscriptionFiltersResponse
Lens' DescribeSubscriptionFiltersResponse (Maybe Text)
describeSubscriptionFiltersResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSubscriptionFiltersResponse
 -> Const (First Text) DescribeSubscriptionFiltersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSubscriptionFiltersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeSubscriptionFilters where
  type
    AWSResponse DescribeSubscriptionFilters =
      DescribeSubscriptionFiltersResponse
  request :: DescribeSubscriptionFilters -> Request DescribeSubscriptionFilters
request = Service
-> DescribeSubscriptionFilters
-> Request DescribeSubscriptionFilters
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSubscriptionFilters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSubscriptionFilters)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeSubscriptionFilters))
-> Logger
-> Service
-> Proxy DescribeSubscriptionFilters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSubscriptionFilters)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [SubscriptionFilter]
-> Maybe Text -> Int -> DescribeSubscriptionFiltersResponse
DescribeSubscriptionFiltersResponse'
            (Maybe [SubscriptionFilter]
 -> Maybe Text -> Int -> DescribeSubscriptionFiltersResponse)
-> Either String (Maybe [SubscriptionFilter])
-> Either
     String (Maybe Text -> Int -> DescribeSubscriptionFiltersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [SubscriptionFilter]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"subscriptionFilters"
                            Either String (Maybe (Maybe [SubscriptionFilter]))
-> Maybe [SubscriptionFilter]
-> Either String (Maybe [SubscriptionFilter])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SubscriptionFilter]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> DescribeSubscriptionFiltersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeSubscriptionFiltersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> DescribeSubscriptionFiltersResponse)
-> Either String Int
-> Either String DescribeSubscriptionFiltersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeSubscriptionFilters

instance Prelude.NFData DescribeSubscriptionFilters

instance Core.ToHeaders DescribeSubscriptionFilters where
  toHeaders :: DescribeSubscriptionFilters -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSubscriptionFilters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Logs_20140328.DescribeSubscriptionFilters" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeSubscriptionFilters where
  toJSON :: DescribeSubscriptionFilters -> Value
toJSON DescribeSubscriptionFilters' {Maybe Natural
Maybe Text
Text
logGroupName :: Text
limit :: Maybe Natural
nextToken :: Maybe Text
filterNamePrefix :: Maybe Text
$sel:logGroupName:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Text
$sel:limit:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Natural
$sel:nextToken:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Text
$sel:filterNamePrefix:DescribeSubscriptionFilters' :: DescribeSubscriptionFilters -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"filterNamePrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
filterNamePrefix,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            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)
          ]
      )

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

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

-- | /See:/ 'newDescribeSubscriptionFiltersResponse' smart constructor.
data DescribeSubscriptionFiltersResponse = DescribeSubscriptionFiltersResponse'
  { -- | The subscription filters.
    DescribeSubscriptionFiltersResponse -> Maybe [SubscriptionFilter]
subscriptionFilters :: Prelude.Maybe [SubscriptionFilter],
    DescribeSubscriptionFiltersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeSubscriptionFiltersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSubscriptionFiltersResponse
-> DescribeSubscriptionFiltersResponse -> Bool
(DescribeSubscriptionFiltersResponse
 -> DescribeSubscriptionFiltersResponse -> Bool)
-> (DescribeSubscriptionFiltersResponse
    -> DescribeSubscriptionFiltersResponse -> Bool)
-> Eq DescribeSubscriptionFiltersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSubscriptionFiltersResponse
-> DescribeSubscriptionFiltersResponse -> Bool
$c/= :: DescribeSubscriptionFiltersResponse
-> DescribeSubscriptionFiltersResponse -> Bool
== :: DescribeSubscriptionFiltersResponse
-> DescribeSubscriptionFiltersResponse -> Bool
$c== :: DescribeSubscriptionFiltersResponse
-> DescribeSubscriptionFiltersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSubscriptionFiltersResponse]
ReadPrec DescribeSubscriptionFiltersResponse
Int -> ReadS DescribeSubscriptionFiltersResponse
ReadS [DescribeSubscriptionFiltersResponse]
(Int -> ReadS DescribeSubscriptionFiltersResponse)
-> ReadS [DescribeSubscriptionFiltersResponse]
-> ReadPrec DescribeSubscriptionFiltersResponse
-> ReadPrec [DescribeSubscriptionFiltersResponse]
-> Read DescribeSubscriptionFiltersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSubscriptionFiltersResponse]
$creadListPrec :: ReadPrec [DescribeSubscriptionFiltersResponse]
readPrec :: ReadPrec DescribeSubscriptionFiltersResponse
$creadPrec :: ReadPrec DescribeSubscriptionFiltersResponse
readList :: ReadS [DescribeSubscriptionFiltersResponse]
$creadList :: ReadS [DescribeSubscriptionFiltersResponse]
readsPrec :: Int -> ReadS DescribeSubscriptionFiltersResponse
$creadsPrec :: Int -> ReadS DescribeSubscriptionFiltersResponse
Prelude.Read, Int -> DescribeSubscriptionFiltersResponse -> ShowS
[DescribeSubscriptionFiltersResponse] -> ShowS
DescribeSubscriptionFiltersResponse -> String
(Int -> DescribeSubscriptionFiltersResponse -> ShowS)
-> (DescribeSubscriptionFiltersResponse -> String)
-> ([DescribeSubscriptionFiltersResponse] -> ShowS)
-> Show DescribeSubscriptionFiltersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSubscriptionFiltersResponse] -> ShowS
$cshowList :: [DescribeSubscriptionFiltersResponse] -> ShowS
show :: DescribeSubscriptionFiltersResponse -> String
$cshow :: DescribeSubscriptionFiltersResponse -> String
showsPrec :: Int -> DescribeSubscriptionFiltersResponse -> ShowS
$cshowsPrec :: Int -> DescribeSubscriptionFiltersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSubscriptionFiltersResponse
 -> Rep DescribeSubscriptionFiltersResponse x)
-> (forall x.
    Rep DescribeSubscriptionFiltersResponse x
    -> DescribeSubscriptionFiltersResponse)
-> Generic DescribeSubscriptionFiltersResponse
forall x.
Rep DescribeSubscriptionFiltersResponse x
-> DescribeSubscriptionFiltersResponse
forall x.
DescribeSubscriptionFiltersResponse
-> Rep DescribeSubscriptionFiltersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSubscriptionFiltersResponse x
-> DescribeSubscriptionFiltersResponse
$cfrom :: forall x.
DescribeSubscriptionFiltersResponse
-> Rep DescribeSubscriptionFiltersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSubscriptionFiltersResponse' 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:
--
-- 'subscriptionFilters', 'describeSubscriptionFiltersResponse_subscriptionFilters' - The subscription filters.
--
-- 'nextToken', 'describeSubscriptionFiltersResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'describeSubscriptionFiltersResponse_httpStatus' - The response's http status code.
newDescribeSubscriptionFiltersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSubscriptionFiltersResponse
newDescribeSubscriptionFiltersResponse :: Int -> DescribeSubscriptionFiltersResponse
newDescribeSubscriptionFiltersResponse Int
pHttpStatus_ =
  DescribeSubscriptionFiltersResponse' :: Maybe [SubscriptionFilter]
-> Maybe Text -> Int -> DescribeSubscriptionFiltersResponse
DescribeSubscriptionFiltersResponse'
    { $sel:subscriptionFilters:DescribeSubscriptionFiltersResponse' :: Maybe [SubscriptionFilter]
subscriptionFilters =
        Maybe [SubscriptionFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSubscriptionFiltersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSubscriptionFiltersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The subscription filters.
describeSubscriptionFiltersResponse_subscriptionFilters :: Lens.Lens' DescribeSubscriptionFiltersResponse (Prelude.Maybe [SubscriptionFilter])
describeSubscriptionFiltersResponse_subscriptionFilters :: (Maybe [SubscriptionFilter] -> f (Maybe [SubscriptionFilter]))
-> DescribeSubscriptionFiltersResponse
-> f DescribeSubscriptionFiltersResponse
describeSubscriptionFiltersResponse_subscriptionFilters = (DescribeSubscriptionFiltersResponse -> Maybe [SubscriptionFilter])
-> (DescribeSubscriptionFiltersResponse
    -> Maybe [SubscriptionFilter]
    -> DescribeSubscriptionFiltersResponse)
-> Lens'
     DescribeSubscriptionFiltersResponse (Maybe [SubscriptionFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFiltersResponse' {Maybe [SubscriptionFilter]
subscriptionFilters :: Maybe [SubscriptionFilter]
$sel:subscriptionFilters:DescribeSubscriptionFiltersResponse' :: DescribeSubscriptionFiltersResponse -> Maybe [SubscriptionFilter]
subscriptionFilters} -> Maybe [SubscriptionFilter]
subscriptionFilters) (\s :: DescribeSubscriptionFiltersResponse
s@DescribeSubscriptionFiltersResponse' {} Maybe [SubscriptionFilter]
a -> DescribeSubscriptionFiltersResponse
s {$sel:subscriptionFilters:DescribeSubscriptionFiltersResponse' :: Maybe [SubscriptionFilter]
subscriptionFilters = Maybe [SubscriptionFilter]
a} :: DescribeSubscriptionFiltersResponse) ((Maybe [SubscriptionFilter] -> f (Maybe [SubscriptionFilter]))
 -> DescribeSubscriptionFiltersResponse
 -> f DescribeSubscriptionFiltersResponse)
-> ((Maybe [SubscriptionFilter] -> f (Maybe [SubscriptionFilter]))
    -> Maybe [SubscriptionFilter] -> f (Maybe [SubscriptionFilter]))
-> (Maybe [SubscriptionFilter] -> f (Maybe [SubscriptionFilter]))
-> DescribeSubscriptionFiltersResponse
-> f DescribeSubscriptionFiltersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SubscriptionFilter]
  [SubscriptionFilter]
  [SubscriptionFilter]
  [SubscriptionFilter]
-> Iso
     (Maybe [SubscriptionFilter])
     (Maybe [SubscriptionFilter])
     (Maybe [SubscriptionFilter])
     (Maybe [SubscriptionFilter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [SubscriptionFilter]
  [SubscriptionFilter]
  [SubscriptionFilter]
  [SubscriptionFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
describeSubscriptionFiltersResponse_nextToken :: Lens.Lens' DescribeSubscriptionFiltersResponse (Prelude.Maybe Prelude.Text)
describeSubscriptionFiltersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSubscriptionFiltersResponse
-> f DescribeSubscriptionFiltersResponse
describeSubscriptionFiltersResponse_nextToken = (DescribeSubscriptionFiltersResponse -> Maybe Text)
-> (DescribeSubscriptionFiltersResponse
    -> Maybe Text -> DescribeSubscriptionFiltersResponse)
-> Lens' DescribeSubscriptionFiltersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFiltersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSubscriptionFiltersResponse' :: DescribeSubscriptionFiltersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSubscriptionFiltersResponse
s@DescribeSubscriptionFiltersResponse' {} Maybe Text
a -> DescribeSubscriptionFiltersResponse
s {$sel:nextToken:DescribeSubscriptionFiltersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSubscriptionFiltersResponse)

-- | The response's http status code.
describeSubscriptionFiltersResponse_httpStatus :: Lens.Lens' DescribeSubscriptionFiltersResponse Prelude.Int
describeSubscriptionFiltersResponse_httpStatus :: (Int -> f Int)
-> DescribeSubscriptionFiltersResponse
-> f DescribeSubscriptionFiltersResponse
describeSubscriptionFiltersResponse_httpStatus = (DescribeSubscriptionFiltersResponse -> Int)
-> (DescribeSubscriptionFiltersResponse
    -> Int -> DescribeSubscriptionFiltersResponse)
-> Lens
     DescribeSubscriptionFiltersResponse
     DescribeSubscriptionFiltersResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubscriptionFiltersResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeSubscriptionFiltersResponse' :: DescribeSubscriptionFiltersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeSubscriptionFiltersResponse
s@DescribeSubscriptionFiltersResponse' {} Int
a -> DescribeSubscriptionFiltersResponse
s {$sel:httpStatus:DescribeSubscriptionFiltersResponse' :: Int
httpStatus = Int
a} :: DescribeSubscriptionFiltersResponse)

instance
  Prelude.NFData
    DescribeSubscriptionFiltersResponse