{-# 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.Redshift.DescribeEventSubscriptions
-- 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 descriptions of all the Amazon Redshift event notification
-- subscriptions for a customer account. If you specify a subscription
-- name, lists the description for that subscription.
--
-- If you specify both tag keys and tag values in the same request, Amazon
-- Redshift returns all event notification subscriptions that match any
-- combination of the specified keys and values. For example, if you have
-- @owner@ and @environment@ for tag keys, and @admin@ and @test@ for tag
-- values, all subscriptions that have any combination of those values are
-- returned.
--
-- If both tag keys and values are omitted from the request, subscriptions
-- are returned regardless of whether they have tag keys or values
-- associated with them.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeEventSubscriptions
  ( -- * Creating a Request
    DescribeEventSubscriptions (..),
    newDescribeEventSubscriptions,

    -- * Request Lenses
    describeEventSubscriptions_subscriptionName,
    describeEventSubscriptions_tagValues,
    describeEventSubscriptions_tagKeys,
    describeEventSubscriptions_marker,
    describeEventSubscriptions_maxRecords,

    -- * Destructuring the Response
    DescribeEventSubscriptionsResponse (..),
    newDescribeEventSubscriptionsResponse,

    -- * Response Lenses
    describeEventSubscriptionsResponse_eventSubscriptionsList,
    describeEventSubscriptionsResponse_marker,
    describeEventSubscriptionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDescribeEventSubscriptions' smart constructor.
data DescribeEventSubscriptions = DescribeEventSubscriptions'
  { -- | The name of the Amazon Redshift event notification subscription to be
    -- described.
    DescribeEventSubscriptions -> Maybe Text
subscriptionName :: Prelude.Maybe Prelude.Text,
    -- | A tag value or values for which you want to return all matching event
    -- notification subscriptions that are associated with the specified tag
    -- value or values. For example, suppose that you have subscriptions that
    -- are tagged with values called @admin@ and @test@. If you specify both of
    -- these tag values in the request, Amazon Redshift returns a response with
    -- the subscriptions that have either or both of these tag values
    -- associated with them.
    DescribeEventSubscriptions -> Maybe [Text]
tagValues :: Prelude.Maybe [Prelude.Text],
    -- | A tag key or keys for which you want to return all matching event
    -- notification subscriptions that are associated with the specified key or
    -- keys. For example, suppose that you have subscriptions that are tagged
    -- with keys called @owner@ and @environment@. If you specify both of these
    -- tag keys in the request, Amazon Redshift returns a response with the
    -- subscriptions that have either or both of these tag keys associated with
    -- them.
    DescribeEventSubscriptions -> Maybe [Text]
tagKeys :: Prelude.Maybe [Prelude.Text],
    -- | An optional parameter that specifies the starting point to return a set
    -- of response records. When the results of a DescribeEventSubscriptions
    -- request exceed the value specified in @MaxRecords@, Amazon Web Services
    -- returns a value in the @Marker@ field of the response. You can retrieve
    -- the next set of response records by providing the returned marker value
    -- in the @Marker@ parameter and retrying the request.
    DescribeEventSubscriptions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of response records to return in each call. If the
    -- number of remaining response records exceeds the specified @MaxRecords@
    -- value, a value is returned in a @marker@ field of the response. You can
    -- retrieve the next set of records by retrying the command with the
    -- returned marker value.
    --
    -- Default: @100@
    --
    -- Constraints: minimum 20, maximum 100.
    DescribeEventSubscriptions -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool
(DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool)
-> (DescribeEventSubscriptions
    -> DescribeEventSubscriptions -> Bool)
-> Eq DescribeEventSubscriptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool
$c/= :: DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool
== :: DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool
$c== :: DescribeEventSubscriptions -> DescribeEventSubscriptions -> Bool
Prelude.Eq, ReadPrec [DescribeEventSubscriptions]
ReadPrec DescribeEventSubscriptions
Int -> ReadS DescribeEventSubscriptions
ReadS [DescribeEventSubscriptions]
(Int -> ReadS DescribeEventSubscriptions)
-> ReadS [DescribeEventSubscriptions]
-> ReadPrec DescribeEventSubscriptions
-> ReadPrec [DescribeEventSubscriptions]
-> Read DescribeEventSubscriptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventSubscriptions]
$creadListPrec :: ReadPrec [DescribeEventSubscriptions]
readPrec :: ReadPrec DescribeEventSubscriptions
$creadPrec :: ReadPrec DescribeEventSubscriptions
readList :: ReadS [DescribeEventSubscriptions]
$creadList :: ReadS [DescribeEventSubscriptions]
readsPrec :: Int -> ReadS DescribeEventSubscriptions
$creadsPrec :: Int -> ReadS DescribeEventSubscriptions
Prelude.Read, Int -> DescribeEventSubscriptions -> ShowS
[DescribeEventSubscriptions] -> ShowS
DescribeEventSubscriptions -> String
(Int -> DescribeEventSubscriptions -> ShowS)
-> (DescribeEventSubscriptions -> String)
-> ([DescribeEventSubscriptions] -> ShowS)
-> Show DescribeEventSubscriptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventSubscriptions] -> ShowS
$cshowList :: [DescribeEventSubscriptions] -> ShowS
show :: DescribeEventSubscriptions -> String
$cshow :: DescribeEventSubscriptions -> String
showsPrec :: Int -> DescribeEventSubscriptions -> ShowS
$cshowsPrec :: Int -> DescribeEventSubscriptions -> ShowS
Prelude.Show, (forall x.
 DescribeEventSubscriptions -> Rep DescribeEventSubscriptions x)
-> (forall x.
    Rep DescribeEventSubscriptions x -> DescribeEventSubscriptions)
-> Generic DescribeEventSubscriptions
forall x.
Rep DescribeEventSubscriptions x -> DescribeEventSubscriptions
forall x.
DescribeEventSubscriptions -> Rep DescribeEventSubscriptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventSubscriptions x -> DescribeEventSubscriptions
$cfrom :: forall x.
DescribeEventSubscriptions -> Rep DescribeEventSubscriptions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventSubscriptions' 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:
--
-- 'subscriptionName', 'describeEventSubscriptions_subscriptionName' - The name of the Amazon Redshift event notification subscription to be
-- described.
--
-- 'tagValues', 'describeEventSubscriptions_tagValues' - A tag value or values for which you want to return all matching event
-- notification subscriptions that are associated with the specified tag
-- value or values. For example, suppose that you have subscriptions that
-- are tagged with values called @admin@ and @test@. If you specify both of
-- these tag values in the request, Amazon Redshift returns a response with
-- the subscriptions that have either or both of these tag values
-- associated with them.
--
-- 'tagKeys', 'describeEventSubscriptions_tagKeys' - A tag key or keys for which you want to return all matching event
-- notification subscriptions that are associated with the specified key or
-- keys. For example, suppose that you have subscriptions that are tagged
-- with keys called @owner@ and @environment@. If you specify both of these
-- tag keys in the request, Amazon Redshift returns a response with the
-- subscriptions that have either or both of these tag keys associated with
-- them.
--
-- 'marker', 'describeEventSubscriptions_marker' - An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeEventSubscriptions
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- returns a value in the @Marker@ field of the response. You can retrieve
-- the next set of response records by providing the returned marker value
-- in the @Marker@ parameter and retrying the request.
--
-- 'maxRecords', 'describeEventSubscriptions_maxRecords' - The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
newDescribeEventSubscriptions ::
  DescribeEventSubscriptions
newDescribeEventSubscriptions :: DescribeEventSubscriptions
newDescribeEventSubscriptions =
  DescribeEventSubscriptions' :: Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Int
-> DescribeEventSubscriptions
DescribeEventSubscriptions'
    { $sel:subscriptionName:DescribeEventSubscriptions' :: Maybe Text
subscriptionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tagValues:DescribeEventSubscriptions' :: Maybe [Text]
tagValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeys:DescribeEventSubscriptions' :: Maybe [Text]
tagKeys = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeEventSubscriptions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeEventSubscriptions' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Amazon Redshift event notification subscription to be
-- described.
describeEventSubscriptions_subscriptionName :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe Prelude.Text)
describeEventSubscriptions_subscriptionName :: (Maybe Text -> f (Maybe Text))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_subscriptionName = (DescribeEventSubscriptions -> Maybe Text)
-> (DescribeEventSubscriptions
    -> Maybe Text -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe Text
subscriptionName :: Maybe Text
$sel:subscriptionName:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
subscriptionName} -> Maybe Text
subscriptionName) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe Text
a -> DescribeEventSubscriptions
s {$sel:subscriptionName:DescribeEventSubscriptions' :: Maybe Text
subscriptionName = Maybe Text
a} :: DescribeEventSubscriptions)

-- | A tag value or values for which you want to return all matching event
-- notification subscriptions that are associated with the specified tag
-- value or values. For example, suppose that you have subscriptions that
-- are tagged with values called @admin@ and @test@. If you specify both of
-- these tag values in the request, Amazon Redshift returns a response with
-- the subscriptions that have either or both of these tag values
-- associated with them.
describeEventSubscriptions_tagValues :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe [Prelude.Text])
describeEventSubscriptions_tagValues :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_tagValues = (DescribeEventSubscriptions -> Maybe [Text])
-> (DescribeEventSubscriptions
    -> Maybe [Text] -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe [Text]
tagValues :: Maybe [Text]
$sel:tagValues:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Text]
tagValues} -> Maybe [Text]
tagValues) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe [Text]
a -> DescribeEventSubscriptions
s {$sel:tagValues:DescribeEventSubscriptions' :: Maybe [Text]
tagValues = Maybe [Text]
a} :: DescribeEventSubscriptions) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeEventSubscriptions -> f DescribeEventSubscriptions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventSubscriptions
-> f DescribeEventSubscriptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A tag key or keys for which you want to return all matching event
-- notification subscriptions that are associated with the specified key or
-- keys. For example, suppose that you have subscriptions that are tagged
-- with keys called @owner@ and @environment@. If you specify both of these
-- tag keys in the request, Amazon Redshift returns a response with the
-- subscriptions that have either or both of these tag keys associated with
-- them.
describeEventSubscriptions_tagKeys :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe [Prelude.Text])
describeEventSubscriptions_tagKeys :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_tagKeys = (DescribeEventSubscriptions -> Maybe [Text])
-> (DescribeEventSubscriptions
    -> Maybe [Text] -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe [Text]
tagKeys :: Maybe [Text]
$sel:tagKeys:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Text]
tagKeys} -> Maybe [Text]
tagKeys) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe [Text]
a -> DescribeEventSubscriptions
s {$sel:tagKeys:DescribeEventSubscriptions' :: Maybe [Text]
tagKeys = Maybe [Text]
a} :: DescribeEventSubscriptions) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeEventSubscriptions -> f DescribeEventSubscriptions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEventSubscriptions
-> f DescribeEventSubscriptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeEventSubscriptions
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- returns a value in the @Marker@ field of the response. You can retrieve
-- the next set of response records by providing the returned marker value
-- in the @Marker@ parameter and retrying the request.
describeEventSubscriptions_marker :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe Prelude.Text)
describeEventSubscriptions_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_marker = (DescribeEventSubscriptions -> Maybe Text)
-> (DescribeEventSubscriptions
    -> Maybe Text -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe Text
a -> DescribeEventSubscriptions
s {$sel:marker:DescribeEventSubscriptions' :: Maybe Text
marker = Maybe Text
a} :: DescribeEventSubscriptions)

-- | The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
describeEventSubscriptions_maxRecords :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe Prelude.Int)
describeEventSubscriptions_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_maxRecords = (DescribeEventSubscriptions -> Maybe Int)
-> (DescribeEventSubscriptions
    -> Maybe Int -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe Int
a -> DescribeEventSubscriptions
s {$sel:maxRecords:DescribeEventSubscriptions' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeEventSubscriptions)

instance Core.AWSPager DescribeEventSubscriptions where
  page :: DescribeEventSubscriptions
-> AWSResponse DescribeEventSubscriptions
-> Maybe DescribeEventSubscriptions
page DescribeEventSubscriptions
rq AWSResponse DescribeEventSubscriptions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEventSubscriptions
DescribeEventSubscriptionsResponse
rs
            DescribeEventSubscriptionsResponse
-> Getting (First Text) DescribeEventSubscriptionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEventSubscriptionsResponse
-> Const (First Text) DescribeEventSubscriptionsResponse
Lens' DescribeEventSubscriptionsResponse (Maybe Text)
describeEventSubscriptionsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEventSubscriptionsResponse
 -> Const (First Text) DescribeEventSubscriptionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeEventSubscriptionsResponse 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 DescribeEventSubscriptions
forall a. Maybe a
Prelude.Nothing
    | Maybe [EventSubscription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEventSubscriptions
DescribeEventSubscriptionsResponse
rs
            DescribeEventSubscriptionsResponse
-> Getting
     (First [EventSubscription])
     DescribeEventSubscriptionsResponse
     [EventSubscription]
-> Maybe [EventSubscription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [EventSubscription]
 -> Const (First [EventSubscription]) (Maybe [EventSubscription]))
-> DescribeEventSubscriptionsResponse
-> Const
     (First [EventSubscription]) DescribeEventSubscriptionsResponse
Lens'
  DescribeEventSubscriptionsResponse (Maybe [EventSubscription])
describeEventSubscriptionsResponse_eventSubscriptionsList
              ((Maybe [EventSubscription]
  -> Const (First [EventSubscription]) (Maybe [EventSubscription]))
 -> DescribeEventSubscriptionsResponse
 -> Const
      (First [EventSubscription]) DescribeEventSubscriptionsResponse)
-> (([EventSubscription]
     -> Const (First [EventSubscription]) [EventSubscription])
    -> Maybe [EventSubscription]
    -> Const (First [EventSubscription]) (Maybe [EventSubscription]))
-> Getting
     (First [EventSubscription])
     DescribeEventSubscriptionsResponse
     [EventSubscription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EventSubscription]
 -> Const (First [EventSubscription]) [EventSubscription])
-> Maybe [EventSubscription]
-> Const (First [EventSubscription]) (Maybe [EventSubscription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeEventSubscriptions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeEventSubscriptions -> Maybe DescribeEventSubscriptions
forall a. a -> Maybe a
Prelude.Just (DescribeEventSubscriptions -> Maybe DescribeEventSubscriptions)
-> DescribeEventSubscriptions -> Maybe DescribeEventSubscriptions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeEventSubscriptions
rq
          DescribeEventSubscriptions
-> (DescribeEventSubscriptions -> DescribeEventSubscriptions)
-> DescribeEventSubscriptions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeEventSubscriptions
-> Identity DescribeEventSubscriptions
Lens
  DescribeEventSubscriptions
  DescribeEventSubscriptions
  (Maybe Text)
  (Maybe Text)
describeEventSubscriptions_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeEventSubscriptions
 -> Identity DescribeEventSubscriptions)
-> Maybe Text
-> DescribeEventSubscriptions
-> DescribeEventSubscriptions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeEventSubscriptions
DescribeEventSubscriptionsResponse
rs
          DescribeEventSubscriptionsResponse
-> Getting (First Text) DescribeEventSubscriptionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEventSubscriptionsResponse
-> Const (First Text) DescribeEventSubscriptionsResponse
Lens' DescribeEventSubscriptionsResponse (Maybe Text)
describeEventSubscriptionsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEventSubscriptionsResponse
 -> Const (First Text) DescribeEventSubscriptionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeEventSubscriptionsResponse 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 DescribeEventSubscriptions where
  type
    AWSResponse DescribeEventSubscriptions =
      DescribeEventSubscriptionsResponse
  request :: DescribeEventSubscriptions -> Request DescribeEventSubscriptions
request = Service
-> DescribeEventSubscriptions -> Request DescribeEventSubscriptions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEventSubscriptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventSubscriptions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeEventSubscriptions))
-> Logger
-> Service
-> Proxy DescribeEventSubscriptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventSubscriptions)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeEventSubscriptionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [EventSubscription]
-> Maybe Text -> Int -> DescribeEventSubscriptionsResponse
DescribeEventSubscriptionsResponse'
            (Maybe [EventSubscription]
 -> Maybe Text -> Int -> DescribeEventSubscriptionsResponse)
-> Either String (Maybe [EventSubscription])
-> Either
     String (Maybe Text -> Int -> DescribeEventSubscriptionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EventSubscriptionsList"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [EventSubscription]))
-> Either String (Maybe [EventSubscription])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [EventSubscription])
-> [Node] -> Either String (Maybe [EventSubscription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [EventSubscription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"EventSubscription")
                        )
            Either
  String (Maybe Text -> Int -> DescribeEventSubscriptionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeEventSubscriptionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either String (Int -> DescribeEventSubscriptionsResponse)
-> Either String Int
-> Either String DescribeEventSubscriptionsResponse
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 DescribeEventSubscriptions

instance Prelude.NFData DescribeEventSubscriptions

instance Core.ToHeaders DescribeEventSubscriptions where
  toHeaders :: DescribeEventSubscriptions -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeEventSubscriptions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeEventSubscriptions where
  toQuery :: DescribeEventSubscriptions -> QueryString
toQuery DescribeEventSubscriptions' {Maybe Int
Maybe [Text]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
tagKeys :: Maybe [Text]
tagValues :: Maybe [Text]
subscriptionName :: Maybe Text
$sel:maxRecords:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Int
$sel:marker:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
$sel:tagKeys:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Text]
$sel:tagValues:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Text]
$sel:subscriptionName:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeEventSubscriptions" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"SubscriptionName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
subscriptionName,
        ByteString
"TagValues"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"TagValue" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagValues),
        ByteString
"TagKeys"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"TagKey" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagKeys),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- |
--
-- /See:/ 'newDescribeEventSubscriptionsResponse' smart constructor.
data DescribeEventSubscriptionsResponse = DescribeEventSubscriptionsResponse'
  { -- | A list of event subscriptions.
    DescribeEventSubscriptionsResponse -> Maybe [EventSubscription]
eventSubscriptionsList :: Prelude.Maybe [EventSubscription],
    -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- marker value in the @Marker@ parameter and retrying the command. If the
    -- @Marker@ field is empty, all response records have been retrieved for
    -- the request.
    DescribeEventSubscriptionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeEventSubscriptionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEventSubscriptionsResponse
-> DescribeEventSubscriptionsResponse -> Bool
(DescribeEventSubscriptionsResponse
 -> DescribeEventSubscriptionsResponse -> Bool)
-> (DescribeEventSubscriptionsResponse
    -> DescribeEventSubscriptionsResponse -> Bool)
-> Eq DescribeEventSubscriptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventSubscriptionsResponse
-> DescribeEventSubscriptionsResponse -> Bool
$c/= :: DescribeEventSubscriptionsResponse
-> DescribeEventSubscriptionsResponse -> Bool
== :: DescribeEventSubscriptionsResponse
-> DescribeEventSubscriptionsResponse -> Bool
$c== :: DescribeEventSubscriptionsResponse
-> DescribeEventSubscriptionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventSubscriptionsResponse]
ReadPrec DescribeEventSubscriptionsResponse
Int -> ReadS DescribeEventSubscriptionsResponse
ReadS [DescribeEventSubscriptionsResponse]
(Int -> ReadS DescribeEventSubscriptionsResponse)
-> ReadS [DescribeEventSubscriptionsResponse]
-> ReadPrec DescribeEventSubscriptionsResponse
-> ReadPrec [DescribeEventSubscriptionsResponse]
-> Read DescribeEventSubscriptionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventSubscriptionsResponse]
$creadListPrec :: ReadPrec [DescribeEventSubscriptionsResponse]
readPrec :: ReadPrec DescribeEventSubscriptionsResponse
$creadPrec :: ReadPrec DescribeEventSubscriptionsResponse
readList :: ReadS [DescribeEventSubscriptionsResponse]
$creadList :: ReadS [DescribeEventSubscriptionsResponse]
readsPrec :: Int -> ReadS DescribeEventSubscriptionsResponse
$creadsPrec :: Int -> ReadS DescribeEventSubscriptionsResponse
Prelude.Read, Int -> DescribeEventSubscriptionsResponse -> ShowS
[DescribeEventSubscriptionsResponse] -> ShowS
DescribeEventSubscriptionsResponse -> String
(Int -> DescribeEventSubscriptionsResponse -> ShowS)
-> (DescribeEventSubscriptionsResponse -> String)
-> ([DescribeEventSubscriptionsResponse] -> ShowS)
-> Show DescribeEventSubscriptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventSubscriptionsResponse] -> ShowS
$cshowList :: [DescribeEventSubscriptionsResponse] -> ShowS
show :: DescribeEventSubscriptionsResponse -> String
$cshow :: DescribeEventSubscriptionsResponse -> String
showsPrec :: Int -> DescribeEventSubscriptionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventSubscriptionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEventSubscriptionsResponse
 -> Rep DescribeEventSubscriptionsResponse x)
-> (forall x.
    Rep DescribeEventSubscriptionsResponse x
    -> DescribeEventSubscriptionsResponse)
-> Generic DescribeEventSubscriptionsResponse
forall x.
Rep DescribeEventSubscriptionsResponse x
-> DescribeEventSubscriptionsResponse
forall x.
DescribeEventSubscriptionsResponse
-> Rep DescribeEventSubscriptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventSubscriptionsResponse x
-> DescribeEventSubscriptionsResponse
$cfrom :: forall x.
DescribeEventSubscriptionsResponse
-> Rep DescribeEventSubscriptionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventSubscriptionsResponse' 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:
--
-- 'eventSubscriptionsList', 'describeEventSubscriptionsResponse_eventSubscriptionsList' - A list of event subscriptions.
--
-- 'marker', 'describeEventSubscriptionsResponse_marker' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
--
-- 'httpStatus', 'describeEventSubscriptionsResponse_httpStatus' - The response's http status code.
newDescribeEventSubscriptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEventSubscriptionsResponse
newDescribeEventSubscriptionsResponse :: Int -> DescribeEventSubscriptionsResponse
newDescribeEventSubscriptionsResponse Int
pHttpStatus_ =
  DescribeEventSubscriptionsResponse' :: Maybe [EventSubscription]
-> Maybe Text -> Int -> DescribeEventSubscriptionsResponse
DescribeEventSubscriptionsResponse'
    { $sel:eventSubscriptionsList:DescribeEventSubscriptionsResponse' :: Maybe [EventSubscription]
eventSubscriptionsList =
        Maybe [EventSubscription]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeEventSubscriptionsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEventSubscriptionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of event subscriptions.
describeEventSubscriptionsResponse_eventSubscriptionsList :: Lens.Lens' DescribeEventSubscriptionsResponse (Prelude.Maybe [EventSubscription])
describeEventSubscriptionsResponse_eventSubscriptionsList :: (Maybe [EventSubscription] -> f (Maybe [EventSubscription]))
-> DescribeEventSubscriptionsResponse
-> f DescribeEventSubscriptionsResponse
describeEventSubscriptionsResponse_eventSubscriptionsList = (DescribeEventSubscriptionsResponse -> Maybe [EventSubscription])
-> (DescribeEventSubscriptionsResponse
    -> Maybe [EventSubscription] -> DescribeEventSubscriptionsResponse)
-> Lens'
     DescribeEventSubscriptionsResponse (Maybe [EventSubscription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptionsResponse' {Maybe [EventSubscription]
eventSubscriptionsList :: Maybe [EventSubscription]
$sel:eventSubscriptionsList:DescribeEventSubscriptionsResponse' :: DescribeEventSubscriptionsResponse -> Maybe [EventSubscription]
eventSubscriptionsList} -> Maybe [EventSubscription]
eventSubscriptionsList) (\s :: DescribeEventSubscriptionsResponse
s@DescribeEventSubscriptionsResponse' {} Maybe [EventSubscription]
a -> DescribeEventSubscriptionsResponse
s {$sel:eventSubscriptionsList:DescribeEventSubscriptionsResponse' :: Maybe [EventSubscription]
eventSubscriptionsList = Maybe [EventSubscription]
a} :: DescribeEventSubscriptionsResponse) ((Maybe [EventSubscription] -> f (Maybe [EventSubscription]))
 -> DescribeEventSubscriptionsResponse
 -> f DescribeEventSubscriptionsResponse)
-> ((Maybe [EventSubscription] -> f (Maybe [EventSubscription]))
    -> Maybe [EventSubscription] -> f (Maybe [EventSubscription]))
-> (Maybe [EventSubscription] -> f (Maybe [EventSubscription]))
-> DescribeEventSubscriptionsResponse
-> f DescribeEventSubscriptionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EventSubscription]
  [EventSubscription]
  [EventSubscription]
  [EventSubscription]
-> Iso
     (Maybe [EventSubscription])
     (Maybe [EventSubscription])
     (Maybe [EventSubscription])
     (Maybe [EventSubscription])
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
  [EventSubscription]
  [EventSubscription]
  [EventSubscription]
  [EventSubscription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
describeEventSubscriptionsResponse_marker :: Lens.Lens' DescribeEventSubscriptionsResponse (Prelude.Maybe Prelude.Text)
describeEventSubscriptionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeEventSubscriptionsResponse
-> f DescribeEventSubscriptionsResponse
describeEventSubscriptionsResponse_marker = (DescribeEventSubscriptionsResponse -> Maybe Text)
-> (DescribeEventSubscriptionsResponse
    -> Maybe Text -> DescribeEventSubscriptionsResponse)
-> Lens' DescribeEventSubscriptionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeEventSubscriptionsResponse' :: DescribeEventSubscriptionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeEventSubscriptionsResponse
s@DescribeEventSubscriptionsResponse' {} Maybe Text
a -> DescribeEventSubscriptionsResponse
s {$sel:marker:DescribeEventSubscriptionsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeEventSubscriptionsResponse)

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

instance
  Prelude.NFData
    DescribeEventSubscriptionsResponse