{-# 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.Budgets.DescribeNotificationsForBudget
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the notifications that are associated with a budget.
--
-- This operation returns paginated results.
module Amazonka.Budgets.DescribeNotificationsForBudget
  ( -- * Creating a Request
    DescribeNotificationsForBudget (..),
    newDescribeNotificationsForBudget,

    -- * Request Lenses
    describeNotificationsForBudget_nextToken,
    describeNotificationsForBudget_maxResults,
    describeNotificationsForBudget_accountId,
    describeNotificationsForBudget_budgetName,

    -- * Destructuring the Response
    DescribeNotificationsForBudgetResponse (..),
    newDescribeNotificationsForBudgetResponse,

    -- * Response Lenses
    describeNotificationsForBudgetResponse_nextToken,
    describeNotificationsForBudgetResponse_notifications,
    describeNotificationsForBudgetResponse_httpStatus,
  )
where

import Amazonka.Budgets.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

-- | Request of DescribeNotificationsForBudget
--
-- /See:/ 'newDescribeNotificationsForBudget' smart constructor.
data DescribeNotificationsForBudget = DescribeNotificationsForBudget'
  { -- | The pagination token that you include in your request to indicate the
    -- next set of results that you want to retrieve.
    DescribeNotificationsForBudget -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An optional integer that represents how many entries a paginated
    -- response contains. The maximum is 100.
    DescribeNotificationsForBudget -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The @accountId@ that is associated with the budget whose notifications
    -- you want descriptions of.
    DescribeNotificationsForBudget -> Text
accountId :: Prelude.Text,
    -- | The name of the budget whose notifications you want descriptions of.
    DescribeNotificationsForBudget -> Text
budgetName :: Prelude.Text
  }
  deriving (DescribeNotificationsForBudget
-> DescribeNotificationsForBudget -> Bool
(DescribeNotificationsForBudget
 -> DescribeNotificationsForBudget -> Bool)
-> (DescribeNotificationsForBudget
    -> DescribeNotificationsForBudget -> Bool)
-> Eq DescribeNotificationsForBudget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNotificationsForBudget
-> DescribeNotificationsForBudget -> Bool
$c/= :: DescribeNotificationsForBudget
-> DescribeNotificationsForBudget -> Bool
== :: DescribeNotificationsForBudget
-> DescribeNotificationsForBudget -> Bool
$c== :: DescribeNotificationsForBudget
-> DescribeNotificationsForBudget -> Bool
Prelude.Eq, ReadPrec [DescribeNotificationsForBudget]
ReadPrec DescribeNotificationsForBudget
Int -> ReadS DescribeNotificationsForBudget
ReadS [DescribeNotificationsForBudget]
(Int -> ReadS DescribeNotificationsForBudget)
-> ReadS [DescribeNotificationsForBudget]
-> ReadPrec DescribeNotificationsForBudget
-> ReadPrec [DescribeNotificationsForBudget]
-> Read DescribeNotificationsForBudget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNotificationsForBudget]
$creadListPrec :: ReadPrec [DescribeNotificationsForBudget]
readPrec :: ReadPrec DescribeNotificationsForBudget
$creadPrec :: ReadPrec DescribeNotificationsForBudget
readList :: ReadS [DescribeNotificationsForBudget]
$creadList :: ReadS [DescribeNotificationsForBudget]
readsPrec :: Int -> ReadS DescribeNotificationsForBudget
$creadsPrec :: Int -> ReadS DescribeNotificationsForBudget
Prelude.Read, Int -> DescribeNotificationsForBudget -> ShowS
[DescribeNotificationsForBudget] -> ShowS
DescribeNotificationsForBudget -> String
(Int -> DescribeNotificationsForBudget -> ShowS)
-> (DescribeNotificationsForBudget -> String)
-> ([DescribeNotificationsForBudget] -> ShowS)
-> Show DescribeNotificationsForBudget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNotificationsForBudget] -> ShowS
$cshowList :: [DescribeNotificationsForBudget] -> ShowS
show :: DescribeNotificationsForBudget -> String
$cshow :: DescribeNotificationsForBudget -> String
showsPrec :: Int -> DescribeNotificationsForBudget -> ShowS
$cshowsPrec :: Int -> DescribeNotificationsForBudget -> ShowS
Prelude.Show, (forall x.
 DescribeNotificationsForBudget
 -> Rep DescribeNotificationsForBudget x)
-> (forall x.
    Rep DescribeNotificationsForBudget x
    -> DescribeNotificationsForBudget)
-> Generic DescribeNotificationsForBudget
forall x.
Rep DescribeNotificationsForBudget x
-> DescribeNotificationsForBudget
forall x.
DescribeNotificationsForBudget
-> Rep DescribeNotificationsForBudget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeNotificationsForBudget x
-> DescribeNotificationsForBudget
$cfrom :: forall x.
DescribeNotificationsForBudget
-> Rep DescribeNotificationsForBudget x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNotificationsForBudget' 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', 'describeNotificationsForBudget_nextToken' - The pagination token that you include in your request to indicate the
-- next set of results that you want to retrieve.
--
-- 'maxResults', 'describeNotificationsForBudget_maxResults' - An optional integer that represents how many entries a paginated
-- response contains. The maximum is 100.
--
-- 'accountId', 'describeNotificationsForBudget_accountId' - The @accountId@ that is associated with the budget whose notifications
-- you want descriptions of.
--
-- 'budgetName', 'describeNotificationsForBudget_budgetName' - The name of the budget whose notifications you want descriptions of.
newDescribeNotificationsForBudget ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  DescribeNotificationsForBudget
newDescribeNotificationsForBudget :: Text -> Text -> DescribeNotificationsForBudget
newDescribeNotificationsForBudget
  Text
pAccountId_
  Text
pBudgetName_ =
    DescribeNotificationsForBudget' :: Maybe Text
-> Maybe Natural -> Text -> Text -> DescribeNotificationsForBudget
DescribeNotificationsForBudget'
      { $sel:nextToken:DescribeNotificationsForBudget' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribeNotificationsForBudget' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:accountId:DescribeNotificationsForBudget' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:DescribeNotificationsForBudget' :: Text
budgetName = Text
pBudgetName_
      }

-- | The pagination token that you include in your request to indicate the
-- next set of results that you want to retrieve.
describeNotificationsForBudget_nextToken :: Lens.Lens' DescribeNotificationsForBudget (Prelude.Maybe Prelude.Text)
describeNotificationsForBudget_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeNotificationsForBudget
-> f DescribeNotificationsForBudget
describeNotificationsForBudget_nextToken = (DescribeNotificationsForBudget -> Maybe Text)
-> (DescribeNotificationsForBudget
    -> Maybe Text -> DescribeNotificationsForBudget)
-> Lens
     DescribeNotificationsForBudget
     DescribeNotificationsForBudget
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudget' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeNotificationsForBudget
s@DescribeNotificationsForBudget' {} Maybe Text
a -> DescribeNotificationsForBudget
s {$sel:nextToken:DescribeNotificationsForBudget' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeNotificationsForBudget)

-- | An optional integer that represents how many entries a paginated
-- response contains. The maximum is 100.
describeNotificationsForBudget_maxResults :: Lens.Lens' DescribeNotificationsForBudget (Prelude.Maybe Prelude.Natural)
describeNotificationsForBudget_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeNotificationsForBudget
-> f DescribeNotificationsForBudget
describeNotificationsForBudget_maxResults = (DescribeNotificationsForBudget -> Maybe Natural)
-> (DescribeNotificationsForBudget
    -> Maybe Natural -> DescribeNotificationsForBudget)
-> Lens
     DescribeNotificationsForBudget
     DescribeNotificationsForBudget
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudget' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeNotificationsForBudget
s@DescribeNotificationsForBudget' {} Maybe Natural
a -> DescribeNotificationsForBudget
s {$sel:maxResults:DescribeNotificationsForBudget' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeNotificationsForBudget)

-- | The @accountId@ that is associated with the budget whose notifications
-- you want descriptions of.
describeNotificationsForBudget_accountId :: Lens.Lens' DescribeNotificationsForBudget Prelude.Text
describeNotificationsForBudget_accountId :: (Text -> f Text)
-> DescribeNotificationsForBudget
-> f DescribeNotificationsForBudget
describeNotificationsForBudget_accountId = (DescribeNotificationsForBudget -> Text)
-> (DescribeNotificationsForBudget
    -> Text -> DescribeNotificationsForBudget)
-> Lens
     DescribeNotificationsForBudget
     DescribeNotificationsForBudget
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudget' {Text
accountId :: Text
$sel:accountId:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Text
accountId} -> Text
accountId) (\s :: DescribeNotificationsForBudget
s@DescribeNotificationsForBudget' {} Text
a -> DescribeNotificationsForBudget
s {$sel:accountId:DescribeNotificationsForBudget' :: Text
accountId = Text
a} :: DescribeNotificationsForBudget)

-- | The name of the budget whose notifications you want descriptions of.
describeNotificationsForBudget_budgetName :: Lens.Lens' DescribeNotificationsForBudget Prelude.Text
describeNotificationsForBudget_budgetName :: (Text -> f Text)
-> DescribeNotificationsForBudget
-> f DescribeNotificationsForBudget
describeNotificationsForBudget_budgetName = (DescribeNotificationsForBudget -> Text)
-> (DescribeNotificationsForBudget
    -> Text -> DescribeNotificationsForBudget)
-> Lens
     DescribeNotificationsForBudget
     DescribeNotificationsForBudget
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudget' {Text
budgetName :: Text
$sel:budgetName:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Text
budgetName} -> Text
budgetName) (\s :: DescribeNotificationsForBudget
s@DescribeNotificationsForBudget' {} Text
a -> DescribeNotificationsForBudget
s {$sel:budgetName:DescribeNotificationsForBudget' :: Text
budgetName = Text
a} :: DescribeNotificationsForBudget)

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

instance
  Prelude.NFData
    DescribeNotificationsForBudget

instance
  Core.ToHeaders
    DescribeNotificationsForBudget
  where
  toHeaders :: DescribeNotificationsForBudget -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeNotificationsForBudget -> 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
"AWSBudgetServiceGateway.DescribeNotificationsForBudget" ::
                          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 DescribeNotificationsForBudget where
  toJSON :: DescribeNotificationsForBudget -> Value
toJSON DescribeNotificationsForBudget' {Maybe Natural
Maybe Text
Text
budgetName :: Text
accountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:budgetName:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Text
$sel:accountId:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Text
$sel:maxResults:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Maybe Natural
$sel:nextToken:DescribeNotificationsForBudget' :: DescribeNotificationsForBudget -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accountId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BudgetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
budgetName)
          ]
      )

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

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

-- | Response of GetNotificationsForBudget
--
-- /See:/ 'newDescribeNotificationsForBudgetResponse' smart constructor.
data DescribeNotificationsForBudgetResponse = DescribeNotificationsForBudgetResponse'
  { -- | The pagination token in the service response that indicates the next set
    -- of results that you can retrieve.
    DescribeNotificationsForBudgetResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of notifications that are associated with a budget.
    DescribeNotificationsForBudgetResponse -> Maybe [Notification]
notifications :: Prelude.Maybe [Notification],
    -- | The response's http status code.
    DescribeNotificationsForBudgetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeNotificationsForBudgetResponse
-> DescribeNotificationsForBudgetResponse -> Bool
(DescribeNotificationsForBudgetResponse
 -> DescribeNotificationsForBudgetResponse -> Bool)
-> (DescribeNotificationsForBudgetResponse
    -> DescribeNotificationsForBudgetResponse -> Bool)
-> Eq DescribeNotificationsForBudgetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNotificationsForBudgetResponse
-> DescribeNotificationsForBudgetResponse -> Bool
$c/= :: DescribeNotificationsForBudgetResponse
-> DescribeNotificationsForBudgetResponse -> Bool
== :: DescribeNotificationsForBudgetResponse
-> DescribeNotificationsForBudgetResponse -> Bool
$c== :: DescribeNotificationsForBudgetResponse
-> DescribeNotificationsForBudgetResponse -> Bool
Prelude.Eq, ReadPrec [DescribeNotificationsForBudgetResponse]
ReadPrec DescribeNotificationsForBudgetResponse
Int -> ReadS DescribeNotificationsForBudgetResponse
ReadS [DescribeNotificationsForBudgetResponse]
(Int -> ReadS DescribeNotificationsForBudgetResponse)
-> ReadS [DescribeNotificationsForBudgetResponse]
-> ReadPrec DescribeNotificationsForBudgetResponse
-> ReadPrec [DescribeNotificationsForBudgetResponse]
-> Read DescribeNotificationsForBudgetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNotificationsForBudgetResponse]
$creadListPrec :: ReadPrec [DescribeNotificationsForBudgetResponse]
readPrec :: ReadPrec DescribeNotificationsForBudgetResponse
$creadPrec :: ReadPrec DescribeNotificationsForBudgetResponse
readList :: ReadS [DescribeNotificationsForBudgetResponse]
$creadList :: ReadS [DescribeNotificationsForBudgetResponse]
readsPrec :: Int -> ReadS DescribeNotificationsForBudgetResponse
$creadsPrec :: Int -> ReadS DescribeNotificationsForBudgetResponse
Prelude.Read, Int -> DescribeNotificationsForBudgetResponse -> ShowS
[DescribeNotificationsForBudgetResponse] -> ShowS
DescribeNotificationsForBudgetResponse -> String
(Int -> DescribeNotificationsForBudgetResponse -> ShowS)
-> (DescribeNotificationsForBudgetResponse -> String)
-> ([DescribeNotificationsForBudgetResponse] -> ShowS)
-> Show DescribeNotificationsForBudgetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNotificationsForBudgetResponse] -> ShowS
$cshowList :: [DescribeNotificationsForBudgetResponse] -> ShowS
show :: DescribeNotificationsForBudgetResponse -> String
$cshow :: DescribeNotificationsForBudgetResponse -> String
showsPrec :: Int -> DescribeNotificationsForBudgetResponse -> ShowS
$cshowsPrec :: Int -> DescribeNotificationsForBudgetResponse -> ShowS
Prelude.Show, (forall x.
 DescribeNotificationsForBudgetResponse
 -> Rep DescribeNotificationsForBudgetResponse x)
-> (forall x.
    Rep DescribeNotificationsForBudgetResponse x
    -> DescribeNotificationsForBudgetResponse)
-> Generic DescribeNotificationsForBudgetResponse
forall x.
Rep DescribeNotificationsForBudgetResponse x
-> DescribeNotificationsForBudgetResponse
forall x.
DescribeNotificationsForBudgetResponse
-> Rep DescribeNotificationsForBudgetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeNotificationsForBudgetResponse x
-> DescribeNotificationsForBudgetResponse
$cfrom :: forall x.
DescribeNotificationsForBudgetResponse
-> Rep DescribeNotificationsForBudgetResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNotificationsForBudgetResponse' 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', 'describeNotificationsForBudgetResponse_nextToken' - The pagination token in the service response that indicates the next set
-- of results that you can retrieve.
--
-- 'notifications', 'describeNotificationsForBudgetResponse_notifications' - A list of notifications that are associated with a budget.
--
-- 'httpStatus', 'describeNotificationsForBudgetResponse_httpStatus' - The response's http status code.
newDescribeNotificationsForBudgetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeNotificationsForBudgetResponse
newDescribeNotificationsForBudgetResponse :: Int -> DescribeNotificationsForBudgetResponse
newDescribeNotificationsForBudgetResponse
  Int
pHttpStatus_ =
    DescribeNotificationsForBudgetResponse' :: Maybe Text
-> Maybe [Notification]
-> Int
-> DescribeNotificationsForBudgetResponse
DescribeNotificationsForBudgetResponse'
      { $sel:nextToken:DescribeNotificationsForBudgetResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:notifications:DescribeNotificationsForBudgetResponse' :: Maybe [Notification]
notifications = Maybe [Notification]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeNotificationsForBudgetResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The pagination token in the service response that indicates the next set
-- of results that you can retrieve.
describeNotificationsForBudgetResponse_nextToken :: Lens.Lens' DescribeNotificationsForBudgetResponse (Prelude.Maybe Prelude.Text)
describeNotificationsForBudgetResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeNotificationsForBudgetResponse
-> f DescribeNotificationsForBudgetResponse
describeNotificationsForBudgetResponse_nextToken = (DescribeNotificationsForBudgetResponse -> Maybe Text)
-> (DescribeNotificationsForBudgetResponse
    -> Maybe Text -> DescribeNotificationsForBudgetResponse)
-> Lens' DescribeNotificationsForBudgetResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudgetResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeNotificationsForBudgetResponse' :: DescribeNotificationsForBudgetResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeNotificationsForBudgetResponse
s@DescribeNotificationsForBudgetResponse' {} Maybe Text
a -> DescribeNotificationsForBudgetResponse
s {$sel:nextToken:DescribeNotificationsForBudgetResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeNotificationsForBudgetResponse)

-- | A list of notifications that are associated with a budget.
describeNotificationsForBudgetResponse_notifications :: Lens.Lens' DescribeNotificationsForBudgetResponse (Prelude.Maybe [Notification])
describeNotificationsForBudgetResponse_notifications :: (Maybe [Notification] -> f (Maybe [Notification]))
-> DescribeNotificationsForBudgetResponse
-> f DescribeNotificationsForBudgetResponse
describeNotificationsForBudgetResponse_notifications = (DescribeNotificationsForBudgetResponse -> Maybe [Notification])
-> (DescribeNotificationsForBudgetResponse
    -> Maybe [Notification] -> DescribeNotificationsForBudgetResponse)
-> Lens'
     DescribeNotificationsForBudgetResponse (Maybe [Notification])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationsForBudgetResponse' {Maybe [Notification]
notifications :: Maybe [Notification]
$sel:notifications:DescribeNotificationsForBudgetResponse' :: DescribeNotificationsForBudgetResponse -> Maybe [Notification]
notifications} -> Maybe [Notification]
notifications) (\s :: DescribeNotificationsForBudgetResponse
s@DescribeNotificationsForBudgetResponse' {} Maybe [Notification]
a -> DescribeNotificationsForBudgetResponse
s {$sel:notifications:DescribeNotificationsForBudgetResponse' :: Maybe [Notification]
notifications = Maybe [Notification]
a} :: DescribeNotificationsForBudgetResponse) ((Maybe [Notification] -> f (Maybe [Notification]))
 -> DescribeNotificationsForBudgetResponse
 -> f DescribeNotificationsForBudgetResponse)
-> ((Maybe [Notification] -> f (Maybe [Notification]))
    -> Maybe [Notification] -> f (Maybe [Notification]))
-> (Maybe [Notification] -> f (Maybe [Notification]))
-> DescribeNotificationsForBudgetResponse
-> f DescribeNotificationsForBudgetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Notification] [Notification] [Notification] [Notification]
-> Iso
     (Maybe [Notification])
     (Maybe [Notification])
     (Maybe [Notification])
     (Maybe [Notification])
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 [Notification] [Notification] [Notification] [Notification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeNotificationsForBudgetResponse