{-# 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.CodeStarNotifications.ListNotificationRules
-- 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)
--
-- Returns a list of the notification rules for an AWS account.
--
-- This operation returns paginated results.
module Amazonka.CodeStarNotifications.ListNotificationRules
  ( -- * Creating a Request
    ListNotificationRules (..),
    newListNotificationRules,

    -- * Request Lenses
    listNotificationRules_filters,
    listNotificationRules_nextToken,
    listNotificationRules_maxResults,

    -- * Destructuring the Response
    ListNotificationRulesResponse (..),
    newListNotificationRulesResponse,

    -- * Response Lenses
    listNotificationRulesResponse_nextToken,
    listNotificationRulesResponse_notificationRules,
    listNotificationRulesResponse_httpStatus,
  )
where

import Amazonka.CodeStarNotifications.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:/ 'newListNotificationRules' smart constructor.
data ListNotificationRules = ListNotificationRules'
  { -- | The filters to use to return information by service or resource type.
    -- For valid values, see ListNotificationRulesFilter.
    --
    -- A filter with the same name can appear more than once when used with OR
    -- statements. Filters with different names should be applied with AND
    -- statements.
    ListNotificationRules -> Maybe [ListNotificationRulesFilter]
filters :: Prelude.Maybe [ListNotificationRulesFilter],
    -- | An enumeration token that, when provided in a request, returns the next
    -- batch of the results.
    ListNotificationRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A non-negative integer used to limit the number of returned results. The
    -- maximum number of results that can be returned is 100.
    ListNotificationRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListNotificationRules -> ListNotificationRules -> Bool
(ListNotificationRules -> ListNotificationRules -> Bool)
-> (ListNotificationRules -> ListNotificationRules -> Bool)
-> Eq ListNotificationRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationRules -> ListNotificationRules -> Bool
$c/= :: ListNotificationRules -> ListNotificationRules -> Bool
== :: ListNotificationRules -> ListNotificationRules -> Bool
$c== :: ListNotificationRules -> ListNotificationRules -> Bool
Prelude.Eq, ReadPrec [ListNotificationRules]
ReadPrec ListNotificationRules
Int -> ReadS ListNotificationRules
ReadS [ListNotificationRules]
(Int -> ReadS ListNotificationRules)
-> ReadS [ListNotificationRules]
-> ReadPrec ListNotificationRules
-> ReadPrec [ListNotificationRules]
-> Read ListNotificationRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationRules]
$creadListPrec :: ReadPrec [ListNotificationRules]
readPrec :: ReadPrec ListNotificationRules
$creadPrec :: ReadPrec ListNotificationRules
readList :: ReadS [ListNotificationRules]
$creadList :: ReadS [ListNotificationRules]
readsPrec :: Int -> ReadS ListNotificationRules
$creadsPrec :: Int -> ReadS ListNotificationRules
Prelude.Read, Int -> ListNotificationRules -> ShowS
[ListNotificationRules] -> ShowS
ListNotificationRules -> String
(Int -> ListNotificationRules -> ShowS)
-> (ListNotificationRules -> String)
-> ([ListNotificationRules] -> ShowS)
-> Show ListNotificationRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationRules] -> ShowS
$cshowList :: [ListNotificationRules] -> ShowS
show :: ListNotificationRules -> String
$cshow :: ListNotificationRules -> String
showsPrec :: Int -> ListNotificationRules -> ShowS
$cshowsPrec :: Int -> ListNotificationRules -> ShowS
Prelude.Show, (forall x. ListNotificationRules -> Rep ListNotificationRules x)
-> (forall x. Rep ListNotificationRules x -> ListNotificationRules)
-> Generic ListNotificationRules
forall x. Rep ListNotificationRules x -> ListNotificationRules
forall x. ListNotificationRules -> Rep ListNotificationRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNotificationRules x -> ListNotificationRules
$cfrom :: forall x. ListNotificationRules -> Rep ListNotificationRules x
Prelude.Generic)

-- |
-- Create a value of 'ListNotificationRules' 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:
--
-- 'filters', 'listNotificationRules_filters' - The filters to use to return information by service or resource type.
-- For valid values, see ListNotificationRulesFilter.
--
-- A filter with the same name can appear more than once when used with OR
-- statements. Filters with different names should be applied with AND
-- statements.
--
-- 'nextToken', 'listNotificationRules_nextToken' - An enumeration token that, when provided in a request, returns the next
-- batch of the results.
--
-- 'maxResults', 'listNotificationRules_maxResults' - A non-negative integer used to limit the number of returned results. The
-- maximum number of results that can be returned is 100.
newListNotificationRules ::
  ListNotificationRules
newListNotificationRules :: ListNotificationRules
newListNotificationRules =
  ListNotificationRules' :: Maybe [ListNotificationRulesFilter]
-> Maybe Text -> Maybe Natural -> ListNotificationRules
ListNotificationRules'
    { $sel:filters:ListNotificationRules' :: Maybe [ListNotificationRulesFilter]
filters = Maybe [ListNotificationRulesFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListNotificationRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListNotificationRules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to return information by service or resource type.
-- For valid values, see ListNotificationRulesFilter.
--
-- A filter with the same name can appear more than once when used with OR
-- statements. Filters with different names should be applied with AND
-- statements.
listNotificationRules_filters :: Lens.Lens' ListNotificationRules (Prelude.Maybe [ListNotificationRulesFilter])
listNotificationRules_filters :: (Maybe [ListNotificationRulesFilter]
 -> f (Maybe [ListNotificationRulesFilter]))
-> ListNotificationRules -> f ListNotificationRules
listNotificationRules_filters = (ListNotificationRules -> Maybe [ListNotificationRulesFilter])
-> (ListNotificationRules
    -> Maybe [ListNotificationRulesFilter] -> ListNotificationRules)
-> Lens
     ListNotificationRules
     ListNotificationRules
     (Maybe [ListNotificationRulesFilter])
     (Maybe [ListNotificationRulesFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe [ListNotificationRulesFilter]
filters :: Maybe [ListNotificationRulesFilter]
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
filters} -> Maybe [ListNotificationRulesFilter]
filters) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe [ListNotificationRulesFilter]
a -> ListNotificationRules
s {$sel:filters:ListNotificationRules' :: Maybe [ListNotificationRulesFilter]
filters = Maybe [ListNotificationRulesFilter]
a} :: ListNotificationRules) ((Maybe [ListNotificationRulesFilter]
  -> f (Maybe [ListNotificationRulesFilter]))
 -> ListNotificationRules -> f ListNotificationRules)
-> ((Maybe [ListNotificationRulesFilter]
     -> f (Maybe [ListNotificationRulesFilter]))
    -> Maybe [ListNotificationRulesFilter]
    -> f (Maybe [ListNotificationRulesFilter]))
-> (Maybe [ListNotificationRulesFilter]
    -> f (Maybe [ListNotificationRulesFilter]))
-> ListNotificationRules
-> f ListNotificationRules
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
-> Iso
     (Maybe [ListNotificationRulesFilter])
     (Maybe [ListNotificationRulesFilter])
     (Maybe [ListNotificationRulesFilter])
     (Maybe [ListNotificationRulesFilter])
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
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
  [ListNotificationRulesFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An enumeration token that, when provided in a request, returns the next
-- batch of the results.
listNotificationRules_nextToken :: Lens.Lens' ListNotificationRules (Prelude.Maybe Prelude.Text)
listNotificationRules_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListNotificationRules -> f ListNotificationRules
listNotificationRules_nextToken = (ListNotificationRules -> Maybe Text)
-> (ListNotificationRules -> Maybe Text -> ListNotificationRules)
-> Lens
     ListNotificationRules
     ListNotificationRules
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe Text
a -> ListNotificationRules
s {$sel:nextToken:ListNotificationRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationRules)

-- | A non-negative integer used to limit the number of returned results. The
-- maximum number of results that can be returned is 100.
listNotificationRules_maxResults :: Lens.Lens' ListNotificationRules (Prelude.Maybe Prelude.Natural)
listNotificationRules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListNotificationRules -> f ListNotificationRules
listNotificationRules_maxResults = (ListNotificationRules -> Maybe Natural)
-> (ListNotificationRules
    -> Maybe Natural -> ListNotificationRules)
-> Lens
     ListNotificationRules
     ListNotificationRules
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe Natural
a -> ListNotificationRules
s {$sel:maxResults:ListNotificationRules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListNotificationRules)

instance Core.AWSPager ListNotificationRules where
  page :: ListNotificationRules
-> AWSResponse ListNotificationRules -> Maybe ListNotificationRules
page ListNotificationRules
rq AWSResponse ListNotificationRules
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNotificationRules
ListNotificationRulesResponse
rs
            ListNotificationRulesResponse
-> Getting (First Text) ListNotificationRulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNotificationRulesResponse
-> Const (First Text) ListNotificationRulesResponse
Lens' ListNotificationRulesResponse (Maybe Text)
listNotificationRulesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNotificationRulesResponse
 -> Const (First Text) ListNotificationRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNotificationRulesResponse 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 ListNotificationRules
forall a. Maybe a
Prelude.Nothing
    | Maybe [NotificationRuleSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNotificationRules
ListNotificationRulesResponse
rs
            ListNotificationRulesResponse
-> Getting
     (First [NotificationRuleSummary])
     ListNotificationRulesResponse
     [NotificationRuleSummary]
-> Maybe [NotificationRuleSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [NotificationRuleSummary]
 -> Const
      (First [NotificationRuleSummary])
      (Maybe [NotificationRuleSummary]))
-> ListNotificationRulesResponse
-> Const
     (First [NotificationRuleSummary]) ListNotificationRulesResponse
Lens'
  ListNotificationRulesResponse (Maybe [NotificationRuleSummary])
listNotificationRulesResponse_notificationRules
              ((Maybe [NotificationRuleSummary]
  -> Const
       (First [NotificationRuleSummary])
       (Maybe [NotificationRuleSummary]))
 -> ListNotificationRulesResponse
 -> Const
      (First [NotificationRuleSummary]) ListNotificationRulesResponse)
-> (([NotificationRuleSummary]
     -> Const
          (First [NotificationRuleSummary]) [NotificationRuleSummary])
    -> Maybe [NotificationRuleSummary]
    -> Const
         (First [NotificationRuleSummary])
         (Maybe [NotificationRuleSummary]))
-> Getting
     (First [NotificationRuleSummary])
     ListNotificationRulesResponse
     [NotificationRuleSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([NotificationRuleSummary]
 -> Const
      (First [NotificationRuleSummary]) [NotificationRuleSummary])
-> Maybe [NotificationRuleSummary]
-> Const
     (First [NotificationRuleSummary]) (Maybe [NotificationRuleSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListNotificationRules
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListNotificationRules -> Maybe ListNotificationRules
forall a. a -> Maybe a
Prelude.Just (ListNotificationRules -> Maybe ListNotificationRules)
-> ListNotificationRules -> Maybe ListNotificationRules
forall a b. (a -> b) -> a -> b
Prelude.$
        ListNotificationRules
rq
          ListNotificationRules
-> (ListNotificationRules -> ListNotificationRules)
-> ListNotificationRules
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListNotificationRules -> Identity ListNotificationRules
Lens
  ListNotificationRules
  ListNotificationRules
  (Maybe Text)
  (Maybe Text)
listNotificationRules_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListNotificationRules -> Identity ListNotificationRules)
-> Maybe Text -> ListNotificationRules -> ListNotificationRules
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNotificationRules
ListNotificationRulesResponse
rs
          ListNotificationRulesResponse
-> Getting (First Text) ListNotificationRulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNotificationRulesResponse
-> Const (First Text) ListNotificationRulesResponse
Lens' ListNotificationRulesResponse (Maybe Text)
listNotificationRulesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNotificationRulesResponse
 -> Const (First Text) ListNotificationRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNotificationRulesResponse 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 ListNotificationRules where
  type
    AWSResponse ListNotificationRules =
      ListNotificationRulesResponse
  request :: ListNotificationRules -> Request ListNotificationRules
request = Service -> ListNotificationRules -> Request ListNotificationRules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListNotificationRules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListNotificationRules)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListNotificationRules))
-> Logger
-> Service
-> Proxy ListNotificationRules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListNotificationRules)))
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 Text
-> Maybe [NotificationRuleSummary]
-> Int
-> ListNotificationRulesResponse
ListNotificationRulesResponse'
            (Maybe Text
 -> Maybe [NotificationRuleSummary]
 -> Int
 -> ListNotificationRulesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [NotificationRuleSummary]
      -> Int -> ListNotificationRulesResponse)
forall (f :: * -> *) a b. Functor 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
  (Maybe [NotificationRuleSummary]
   -> Int -> ListNotificationRulesResponse)
-> Either String (Maybe [NotificationRuleSummary])
-> Either String (Int -> ListNotificationRulesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [NotificationRuleSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NotificationRules"
                            Either String (Maybe (Maybe [NotificationRuleSummary]))
-> Maybe [NotificationRuleSummary]
-> Either String (Maybe [NotificationRuleSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [NotificationRuleSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListNotificationRulesResponse)
-> Either String Int -> Either String ListNotificationRulesResponse
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 ListNotificationRules

instance Prelude.NFData ListNotificationRules

instance Core.ToHeaders ListNotificationRules where
  toHeaders :: ListNotificationRules -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListNotificationRules -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 ListNotificationRules where
  toJSON :: ListNotificationRules -> Value
toJSON ListNotificationRules' {Maybe Natural
Maybe [ListNotificationRulesFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [ListNotificationRulesFilter]
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [ListNotificationRulesFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ListNotificationRulesFilter] -> Pair)
-> Maybe [ListNotificationRulesFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ListNotificationRulesFilter]
filters,
            (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
"MaxResults" 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
maxResults
          ]
      )

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

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

-- | /See:/ 'newListNotificationRulesResponse' smart constructor.
data ListNotificationRulesResponse = ListNotificationRulesResponse'
  { -- | An enumeration token that can be used in a request to return the next
    -- batch of the results.
    ListNotificationRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of notification rules for the AWS account, by Amazon Resource
    -- Name (ARN) and ID.
    ListNotificationRulesResponse -> Maybe [NotificationRuleSummary]
notificationRules :: Prelude.Maybe [NotificationRuleSummary],
    -- | The response's http status code.
    ListNotificationRulesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
(ListNotificationRulesResponse
 -> ListNotificationRulesResponse -> Bool)
-> (ListNotificationRulesResponse
    -> ListNotificationRulesResponse -> Bool)
-> Eq ListNotificationRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
$c/= :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
== :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
$c== :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListNotificationRulesResponse]
ReadPrec ListNotificationRulesResponse
Int -> ReadS ListNotificationRulesResponse
ReadS [ListNotificationRulesResponse]
(Int -> ReadS ListNotificationRulesResponse)
-> ReadS [ListNotificationRulesResponse]
-> ReadPrec ListNotificationRulesResponse
-> ReadPrec [ListNotificationRulesResponse]
-> Read ListNotificationRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationRulesResponse]
$creadListPrec :: ReadPrec [ListNotificationRulesResponse]
readPrec :: ReadPrec ListNotificationRulesResponse
$creadPrec :: ReadPrec ListNotificationRulesResponse
readList :: ReadS [ListNotificationRulesResponse]
$creadList :: ReadS [ListNotificationRulesResponse]
readsPrec :: Int -> ReadS ListNotificationRulesResponse
$creadsPrec :: Int -> ReadS ListNotificationRulesResponse
Prelude.Read, Int -> ListNotificationRulesResponse -> ShowS
[ListNotificationRulesResponse] -> ShowS
ListNotificationRulesResponse -> String
(Int -> ListNotificationRulesResponse -> ShowS)
-> (ListNotificationRulesResponse -> String)
-> ([ListNotificationRulesResponse] -> ShowS)
-> Show ListNotificationRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationRulesResponse] -> ShowS
$cshowList :: [ListNotificationRulesResponse] -> ShowS
show :: ListNotificationRulesResponse -> String
$cshow :: ListNotificationRulesResponse -> String
showsPrec :: Int -> ListNotificationRulesResponse -> ShowS
$cshowsPrec :: Int -> ListNotificationRulesResponse -> ShowS
Prelude.Show, (forall x.
 ListNotificationRulesResponse
 -> Rep ListNotificationRulesResponse x)
-> (forall x.
    Rep ListNotificationRulesResponse x
    -> ListNotificationRulesResponse)
-> Generic ListNotificationRulesResponse
forall x.
Rep ListNotificationRulesResponse x
-> ListNotificationRulesResponse
forall x.
ListNotificationRulesResponse
-> Rep ListNotificationRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListNotificationRulesResponse x
-> ListNotificationRulesResponse
$cfrom :: forall x.
ListNotificationRulesResponse
-> Rep ListNotificationRulesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListNotificationRulesResponse' 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:
--
-- 'nextToken', 'listNotificationRulesResponse_nextToken' - An enumeration token that can be used in a request to return the next
-- batch of the results.
--
-- 'notificationRules', 'listNotificationRulesResponse_notificationRules' - The list of notification rules for the AWS account, by Amazon Resource
-- Name (ARN) and ID.
--
-- 'httpStatus', 'listNotificationRulesResponse_httpStatus' - The response's http status code.
newListNotificationRulesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListNotificationRulesResponse
newListNotificationRulesResponse :: Int -> ListNotificationRulesResponse
newListNotificationRulesResponse Int
pHttpStatus_ =
  ListNotificationRulesResponse' :: Maybe Text
-> Maybe [NotificationRuleSummary]
-> Int
-> ListNotificationRulesResponse
ListNotificationRulesResponse'
    { $sel:nextToken:ListNotificationRulesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationRules:ListNotificationRulesResponse' :: Maybe [NotificationRuleSummary]
notificationRules = Maybe [NotificationRuleSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListNotificationRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An enumeration token that can be used in a request to return the next
-- batch of the results.
listNotificationRulesResponse_nextToken :: Lens.Lens' ListNotificationRulesResponse (Prelude.Maybe Prelude.Text)
listNotificationRulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListNotificationRulesResponse -> f ListNotificationRulesResponse
listNotificationRulesResponse_nextToken = (ListNotificationRulesResponse -> Maybe Text)
-> (ListNotificationRulesResponse
    -> Maybe Text -> ListNotificationRulesResponse)
-> Lens' ListNotificationRulesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationRulesResponse
s@ListNotificationRulesResponse' {} Maybe Text
a -> ListNotificationRulesResponse
s {$sel:nextToken:ListNotificationRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationRulesResponse)

-- | The list of notification rules for the AWS account, by Amazon Resource
-- Name (ARN) and ID.
listNotificationRulesResponse_notificationRules :: Lens.Lens' ListNotificationRulesResponse (Prelude.Maybe [NotificationRuleSummary])
listNotificationRulesResponse_notificationRules :: (Maybe [NotificationRuleSummary]
 -> f (Maybe [NotificationRuleSummary]))
-> ListNotificationRulesResponse -> f ListNotificationRulesResponse
listNotificationRulesResponse_notificationRules = (ListNotificationRulesResponse -> Maybe [NotificationRuleSummary])
-> (ListNotificationRulesResponse
    -> Maybe [NotificationRuleSummary]
    -> ListNotificationRulesResponse)
-> Lens'
     ListNotificationRulesResponse (Maybe [NotificationRuleSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRulesResponse' {Maybe [NotificationRuleSummary]
notificationRules :: Maybe [NotificationRuleSummary]
$sel:notificationRules:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Maybe [NotificationRuleSummary]
notificationRules} -> Maybe [NotificationRuleSummary]
notificationRules) (\s :: ListNotificationRulesResponse
s@ListNotificationRulesResponse' {} Maybe [NotificationRuleSummary]
a -> ListNotificationRulesResponse
s {$sel:notificationRules:ListNotificationRulesResponse' :: Maybe [NotificationRuleSummary]
notificationRules = Maybe [NotificationRuleSummary]
a} :: ListNotificationRulesResponse) ((Maybe [NotificationRuleSummary]
  -> f (Maybe [NotificationRuleSummary]))
 -> ListNotificationRulesResponse
 -> f ListNotificationRulesResponse)
-> ((Maybe [NotificationRuleSummary]
     -> f (Maybe [NotificationRuleSummary]))
    -> Maybe [NotificationRuleSummary]
    -> f (Maybe [NotificationRuleSummary]))
-> (Maybe [NotificationRuleSummary]
    -> f (Maybe [NotificationRuleSummary]))
-> ListNotificationRulesResponse
-> f ListNotificationRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NotificationRuleSummary]
  [NotificationRuleSummary]
  [NotificationRuleSummary]
  [NotificationRuleSummary]
-> Iso
     (Maybe [NotificationRuleSummary])
     (Maybe [NotificationRuleSummary])
     (Maybe [NotificationRuleSummary])
     (Maybe [NotificationRuleSummary])
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
  [NotificationRuleSummary]
  [NotificationRuleSummary]
  [NotificationRuleSummary]
  [NotificationRuleSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListNotificationRulesResponse