{-# 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.DMS.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 all the event subscriptions for a customer account. The
-- description of a subscription includes @SubscriptionName@,
-- @SNSTopicARN@, @CustomerID@, @SourceType@, @SourceID@, @CreationTime@,
-- and @Status@.
--
-- If you specify @SubscriptionName@, this action lists the description for
-- that subscription.
--
-- This operation returns paginated results.
module Amazonka.DMS.DescribeEventSubscriptions
  ( -- * Creating a Request
    DescribeEventSubscriptions (..),
    newDescribeEventSubscriptions,

    -- * Request Lenses
    describeEventSubscriptions_subscriptionName,
    describeEventSubscriptions_filters,
    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 Amazonka.DMS.Types
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:/ 'newDescribeEventSubscriptions' smart constructor.
data DescribeEventSubscriptions = DescribeEventSubscriptions'
  { -- | The name of the DMS event subscription to be described.
    DescribeEventSubscriptions -> Maybe Text
subscriptionName :: Prelude.Maybe Prelude.Text,
    -- | Filters applied to event subscriptions.
    DescribeEventSubscriptions -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeEventSubscriptions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a pagination token
    -- called a marker is included in the response so that the remaining
    -- results can be retrieved.
    --
    -- 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 DMS event subscription to be described.
--
-- 'filters', 'describeEventSubscriptions_filters' - Filters applied to event subscriptions.
--
-- 'marker', 'describeEventSubscriptions_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeEventSubscriptions_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that the remaining
-- results can be retrieved.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeEventSubscriptions ::
  DescribeEventSubscriptions
newDescribeEventSubscriptions :: DescribeEventSubscriptions
newDescribeEventSubscriptions =
  DescribeEventSubscriptions' :: Maybe Text
-> Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> DescribeEventSubscriptions
DescribeEventSubscriptions'
    { $sel:subscriptionName:DescribeEventSubscriptions' :: Maybe Text
subscriptionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeEventSubscriptions' :: Maybe [Filter]
filters = Maybe [Filter]
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 DMS event 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)

-- | Filters applied to event subscriptions.
describeEventSubscriptions_filters :: Lens.Lens' DescribeEventSubscriptions (Prelude.Maybe [Filter])
describeEventSubscriptions_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeEventSubscriptions -> f DescribeEventSubscriptions
describeEventSubscriptions_filters = (DescribeEventSubscriptions -> Maybe [Filter])
-> (DescribeEventSubscriptions
    -> Maybe [Filter] -> DescribeEventSubscriptions)
-> Lens
     DescribeEventSubscriptions
     DescribeEventSubscriptions
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventSubscriptions' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeEventSubscriptions
s@DescribeEventSubscriptions' {} Maybe [Filter]
a -> DescribeEventSubscriptions
s {$sel:filters:DescribeEventSubscriptions' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeEventSubscriptions) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeEventSubscriptions -> f DescribeEventSubscriptions)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeEventSubscriptions
-> f DescribeEventSubscriptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
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 records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that the remaining
-- results can be retrieved.
--
-- 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, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEventSubscriptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventSubscriptions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeEventSubscriptions))
-> Logger
-> Service
-> Proxy DescribeEventSubscriptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventSubscriptions)))
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 [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.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [EventSubscription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventSubscriptionsList"
                            Either String (Maybe (Maybe [EventSubscription]))
-> Maybe [EventSubscription]
-> Either String (Maybe [EventSubscription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EventSubscription]
forall a. Monoid a => a
Prelude.mempty
                        )
            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.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> 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] -> 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
"AmazonDMSv20160101.DescribeEventSubscriptions" ::
                          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 DescribeEventSubscriptions where
  toJSON :: DescribeEventSubscriptions -> Value
toJSON DescribeEventSubscriptions' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
subscriptionName :: Maybe Text
$sel:maxRecords:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Int
$sel:marker:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
$sel:filters:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe [Filter]
$sel:subscriptionName:DescribeEventSubscriptions' :: DescribeEventSubscriptions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SubscriptionName" 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
subscriptionName,
            (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"Marker" 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
marker,
            (Text
"MaxRecords" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxRecords
          ]
      )

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 = QueryString -> DescribeEventSubscriptions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- |
--
-- /See:/ 'newDescribeEventSubscriptionsResponse' smart constructor.
data DescribeEventSubscriptionsResponse = DescribeEventSubscriptionsResponse'
  { -- | A list of event subscriptions.
    DescribeEventSubscriptionsResponse -> Maybe [EventSubscription]
eventSubscriptionsList :: Prelude.Maybe [EventSubscription],
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    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' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- '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

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
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