{-# 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.DescribeBudgetActionHistories
-- 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)
--
-- Describes a budget action history detail.
--
-- This operation returns paginated results.
module Amazonka.Budgets.DescribeBudgetActionHistories
  ( -- * Creating a Request
    DescribeBudgetActionHistories (..),
    newDescribeBudgetActionHistories,

    -- * Request Lenses
    describeBudgetActionHistories_timePeriod,
    describeBudgetActionHistories_nextToken,
    describeBudgetActionHistories_maxResults,
    describeBudgetActionHistories_accountId,
    describeBudgetActionHistories_budgetName,
    describeBudgetActionHistories_actionId,

    -- * Destructuring the Response
    DescribeBudgetActionHistoriesResponse (..),
    newDescribeBudgetActionHistoriesResponse,

    -- * Response Lenses
    describeBudgetActionHistoriesResponse_nextToken,
    describeBudgetActionHistoriesResponse_httpStatus,
    describeBudgetActionHistoriesResponse_actionHistories,
  )
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

-- | /See:/ 'newDescribeBudgetActionHistories' smart constructor.
data DescribeBudgetActionHistories = DescribeBudgetActionHistories'
  { DescribeBudgetActionHistories -> Maybe TimePeriod
timePeriod :: Prelude.Maybe TimePeriod,
    DescribeBudgetActionHistories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    DescribeBudgetActionHistories -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    DescribeBudgetActionHistories -> Text
accountId :: Prelude.Text,
    DescribeBudgetActionHistories -> Text
budgetName :: Prelude.Text,
    -- | A system-generated universally unique identifier (UUID) for the action.
    DescribeBudgetActionHistories -> Text
actionId :: Prelude.Text
  }
  deriving (DescribeBudgetActionHistories
-> DescribeBudgetActionHistories -> Bool
(DescribeBudgetActionHistories
 -> DescribeBudgetActionHistories -> Bool)
-> (DescribeBudgetActionHistories
    -> DescribeBudgetActionHistories -> Bool)
-> Eq DescribeBudgetActionHistories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBudgetActionHistories
-> DescribeBudgetActionHistories -> Bool
$c/= :: DescribeBudgetActionHistories
-> DescribeBudgetActionHistories -> Bool
== :: DescribeBudgetActionHistories
-> DescribeBudgetActionHistories -> Bool
$c== :: DescribeBudgetActionHistories
-> DescribeBudgetActionHistories -> Bool
Prelude.Eq, ReadPrec [DescribeBudgetActionHistories]
ReadPrec DescribeBudgetActionHistories
Int -> ReadS DescribeBudgetActionHistories
ReadS [DescribeBudgetActionHistories]
(Int -> ReadS DescribeBudgetActionHistories)
-> ReadS [DescribeBudgetActionHistories]
-> ReadPrec DescribeBudgetActionHistories
-> ReadPrec [DescribeBudgetActionHistories]
-> Read DescribeBudgetActionHistories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBudgetActionHistories]
$creadListPrec :: ReadPrec [DescribeBudgetActionHistories]
readPrec :: ReadPrec DescribeBudgetActionHistories
$creadPrec :: ReadPrec DescribeBudgetActionHistories
readList :: ReadS [DescribeBudgetActionHistories]
$creadList :: ReadS [DescribeBudgetActionHistories]
readsPrec :: Int -> ReadS DescribeBudgetActionHistories
$creadsPrec :: Int -> ReadS DescribeBudgetActionHistories
Prelude.Read, Int -> DescribeBudgetActionHistories -> ShowS
[DescribeBudgetActionHistories] -> ShowS
DescribeBudgetActionHistories -> String
(Int -> DescribeBudgetActionHistories -> ShowS)
-> (DescribeBudgetActionHistories -> String)
-> ([DescribeBudgetActionHistories] -> ShowS)
-> Show DescribeBudgetActionHistories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBudgetActionHistories] -> ShowS
$cshowList :: [DescribeBudgetActionHistories] -> ShowS
show :: DescribeBudgetActionHistories -> String
$cshow :: DescribeBudgetActionHistories -> String
showsPrec :: Int -> DescribeBudgetActionHistories -> ShowS
$cshowsPrec :: Int -> DescribeBudgetActionHistories -> ShowS
Prelude.Show, (forall x.
 DescribeBudgetActionHistories
 -> Rep DescribeBudgetActionHistories x)
-> (forall x.
    Rep DescribeBudgetActionHistories x
    -> DescribeBudgetActionHistories)
-> Generic DescribeBudgetActionHistories
forall x.
Rep DescribeBudgetActionHistories x
-> DescribeBudgetActionHistories
forall x.
DescribeBudgetActionHistories
-> Rep DescribeBudgetActionHistories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeBudgetActionHistories x
-> DescribeBudgetActionHistories
$cfrom :: forall x.
DescribeBudgetActionHistories
-> Rep DescribeBudgetActionHistories x
Prelude.Generic)

-- |
-- Create a value of 'DescribeBudgetActionHistories' 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:
--
-- 'timePeriod', 'describeBudgetActionHistories_timePeriod' - Undocumented member.
--
-- 'nextToken', 'describeBudgetActionHistories_nextToken' - Undocumented member.
--
-- 'maxResults', 'describeBudgetActionHistories_maxResults' - Undocumented member.
--
-- 'accountId', 'describeBudgetActionHistories_accountId' - Undocumented member.
--
-- 'budgetName', 'describeBudgetActionHistories_budgetName' - Undocumented member.
--
-- 'actionId', 'describeBudgetActionHistories_actionId' - A system-generated universally unique identifier (UUID) for the action.
newDescribeBudgetActionHistories ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'actionId'
  Prelude.Text ->
  DescribeBudgetActionHistories
newDescribeBudgetActionHistories :: Text -> Text -> Text -> DescribeBudgetActionHistories
newDescribeBudgetActionHistories
  Text
pAccountId_
  Text
pBudgetName_
  Text
pActionId_ =
    DescribeBudgetActionHistories' :: Maybe TimePeriod
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> Text
-> DescribeBudgetActionHistories
DescribeBudgetActionHistories'
      { $sel:timePeriod:DescribeBudgetActionHistories' :: Maybe TimePeriod
timePeriod =
          Maybe TimePeriod
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeBudgetActionHistories' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribeBudgetActionHistories' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:accountId:DescribeBudgetActionHistories' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:DescribeBudgetActionHistories' :: Text
budgetName = Text
pBudgetName_,
        $sel:actionId:DescribeBudgetActionHistories' :: Text
actionId = Text
pActionId_
      }

-- | Undocumented member.
describeBudgetActionHistories_timePeriod :: Lens.Lens' DescribeBudgetActionHistories (Prelude.Maybe TimePeriod)
describeBudgetActionHistories_timePeriod :: (Maybe TimePeriod -> f (Maybe TimePeriod))
-> DescribeBudgetActionHistories -> f DescribeBudgetActionHistories
describeBudgetActionHistories_timePeriod = (DescribeBudgetActionHistories -> Maybe TimePeriod)
-> (DescribeBudgetActionHistories
    -> Maybe TimePeriod -> DescribeBudgetActionHistories)
-> Lens
     DescribeBudgetActionHistories
     DescribeBudgetActionHistories
     (Maybe TimePeriod)
     (Maybe TimePeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistories' {Maybe TimePeriod
timePeriod :: Maybe TimePeriod
$sel:timePeriod:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Maybe TimePeriod
timePeriod} -> Maybe TimePeriod
timePeriod) (\s :: DescribeBudgetActionHistories
s@DescribeBudgetActionHistories' {} Maybe TimePeriod
a -> DescribeBudgetActionHistories
s {$sel:timePeriod:DescribeBudgetActionHistories' :: Maybe TimePeriod
timePeriod = Maybe TimePeriod
a} :: DescribeBudgetActionHistories)

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

-- | Undocumented member.
describeBudgetActionHistories_maxResults :: Lens.Lens' DescribeBudgetActionHistories (Prelude.Maybe Prelude.Natural)
describeBudgetActionHistories_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeBudgetActionHistories -> f DescribeBudgetActionHistories
describeBudgetActionHistories_maxResults = (DescribeBudgetActionHistories -> Maybe Natural)
-> (DescribeBudgetActionHistories
    -> Maybe Natural -> DescribeBudgetActionHistories)
-> Lens
     DescribeBudgetActionHistories
     DescribeBudgetActionHistories
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistories' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeBudgetActionHistories
s@DescribeBudgetActionHistories' {} Maybe Natural
a -> DescribeBudgetActionHistories
s {$sel:maxResults:DescribeBudgetActionHistories' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeBudgetActionHistories)

-- | Undocumented member.
describeBudgetActionHistories_accountId :: Lens.Lens' DescribeBudgetActionHistories Prelude.Text
describeBudgetActionHistories_accountId :: (Text -> f Text)
-> DescribeBudgetActionHistories -> f DescribeBudgetActionHistories
describeBudgetActionHistories_accountId = (DescribeBudgetActionHistories -> Text)
-> (DescribeBudgetActionHistories
    -> Text -> DescribeBudgetActionHistories)
-> Lens
     DescribeBudgetActionHistories
     DescribeBudgetActionHistories
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistories' {Text
accountId :: Text
$sel:accountId:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
accountId} -> Text
accountId) (\s :: DescribeBudgetActionHistories
s@DescribeBudgetActionHistories' {} Text
a -> DescribeBudgetActionHistories
s {$sel:accountId:DescribeBudgetActionHistories' :: Text
accountId = Text
a} :: DescribeBudgetActionHistories)

-- | Undocumented member.
describeBudgetActionHistories_budgetName :: Lens.Lens' DescribeBudgetActionHistories Prelude.Text
describeBudgetActionHistories_budgetName :: (Text -> f Text)
-> DescribeBudgetActionHistories -> f DescribeBudgetActionHistories
describeBudgetActionHistories_budgetName = (DescribeBudgetActionHistories -> Text)
-> (DescribeBudgetActionHistories
    -> Text -> DescribeBudgetActionHistories)
-> Lens
     DescribeBudgetActionHistories
     DescribeBudgetActionHistories
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistories' {Text
budgetName :: Text
$sel:budgetName:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
budgetName} -> Text
budgetName) (\s :: DescribeBudgetActionHistories
s@DescribeBudgetActionHistories' {} Text
a -> DescribeBudgetActionHistories
s {$sel:budgetName:DescribeBudgetActionHistories' :: Text
budgetName = Text
a} :: DescribeBudgetActionHistories)

-- | A system-generated universally unique identifier (UUID) for the action.
describeBudgetActionHistories_actionId :: Lens.Lens' DescribeBudgetActionHistories Prelude.Text
describeBudgetActionHistories_actionId :: (Text -> f Text)
-> DescribeBudgetActionHistories -> f DescribeBudgetActionHistories
describeBudgetActionHistories_actionId = (DescribeBudgetActionHistories -> Text)
-> (DescribeBudgetActionHistories
    -> Text -> DescribeBudgetActionHistories)
-> Lens
     DescribeBudgetActionHistories
     DescribeBudgetActionHistories
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistories' {Text
actionId :: Text
$sel:actionId:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
actionId} -> Text
actionId) (\s :: DescribeBudgetActionHistories
s@DescribeBudgetActionHistories' {} Text
a -> DescribeBudgetActionHistories
s {$sel:actionId:DescribeBudgetActionHistories' :: Text
actionId = Text
a} :: DescribeBudgetActionHistories)

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

instance
  Prelude.Hashable
    DescribeBudgetActionHistories

instance Prelude.NFData DescribeBudgetActionHistories

instance Core.ToHeaders DescribeBudgetActionHistories where
  toHeaders :: DescribeBudgetActionHistories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeBudgetActionHistories -> 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.DescribeBudgetActionHistories" ::
                          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 DescribeBudgetActionHistories where
  toJSON :: DescribeBudgetActionHistories -> Value
toJSON DescribeBudgetActionHistories' {Maybe Natural
Maybe Text
Maybe TimePeriod
Text
actionId :: Text
budgetName :: Text
accountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
timePeriod :: Maybe TimePeriod
$sel:actionId:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
$sel:budgetName:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
$sel:accountId:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Text
$sel:maxResults:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Maybe Natural
$sel:nextToken:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Maybe Text
$sel:timePeriod:DescribeBudgetActionHistories' :: DescribeBudgetActionHistories -> Maybe TimePeriod
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TimePeriod" Text -> TimePeriod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TimePeriod -> Pair) -> Maybe TimePeriod -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimePeriod
timePeriod,
            (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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ActionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
actionId)
          ]
      )

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

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

-- | /See:/ 'newDescribeBudgetActionHistoriesResponse' smart constructor.
data DescribeBudgetActionHistoriesResponse = DescribeBudgetActionHistoriesResponse'
  { DescribeBudgetActionHistoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeBudgetActionHistoriesResponse -> Int
httpStatus :: Prelude.Int,
    -- | The historical record of the budget action resource.
    DescribeBudgetActionHistoriesResponse -> [ActionHistory]
actionHistories :: [ActionHistory]
  }
  deriving (DescribeBudgetActionHistoriesResponse
-> DescribeBudgetActionHistoriesResponse -> Bool
(DescribeBudgetActionHistoriesResponse
 -> DescribeBudgetActionHistoriesResponse -> Bool)
-> (DescribeBudgetActionHistoriesResponse
    -> DescribeBudgetActionHistoriesResponse -> Bool)
-> Eq DescribeBudgetActionHistoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBudgetActionHistoriesResponse
-> DescribeBudgetActionHistoriesResponse -> Bool
$c/= :: DescribeBudgetActionHistoriesResponse
-> DescribeBudgetActionHistoriesResponse -> Bool
== :: DescribeBudgetActionHistoriesResponse
-> DescribeBudgetActionHistoriesResponse -> Bool
$c== :: DescribeBudgetActionHistoriesResponse
-> DescribeBudgetActionHistoriesResponse -> Bool
Prelude.Eq, Int -> DescribeBudgetActionHistoriesResponse -> ShowS
[DescribeBudgetActionHistoriesResponse] -> ShowS
DescribeBudgetActionHistoriesResponse -> String
(Int -> DescribeBudgetActionHistoriesResponse -> ShowS)
-> (DescribeBudgetActionHistoriesResponse -> String)
-> ([DescribeBudgetActionHistoriesResponse] -> ShowS)
-> Show DescribeBudgetActionHistoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBudgetActionHistoriesResponse] -> ShowS
$cshowList :: [DescribeBudgetActionHistoriesResponse] -> ShowS
show :: DescribeBudgetActionHistoriesResponse -> String
$cshow :: DescribeBudgetActionHistoriesResponse -> String
showsPrec :: Int -> DescribeBudgetActionHistoriesResponse -> ShowS
$cshowsPrec :: Int -> DescribeBudgetActionHistoriesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeBudgetActionHistoriesResponse
 -> Rep DescribeBudgetActionHistoriesResponse x)
-> (forall x.
    Rep DescribeBudgetActionHistoriesResponse x
    -> DescribeBudgetActionHistoriesResponse)
-> Generic DescribeBudgetActionHistoriesResponse
forall x.
Rep DescribeBudgetActionHistoriesResponse x
-> DescribeBudgetActionHistoriesResponse
forall x.
DescribeBudgetActionHistoriesResponse
-> Rep DescribeBudgetActionHistoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeBudgetActionHistoriesResponse x
-> DescribeBudgetActionHistoriesResponse
$cfrom :: forall x.
DescribeBudgetActionHistoriesResponse
-> Rep DescribeBudgetActionHistoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeBudgetActionHistoriesResponse' 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', 'describeBudgetActionHistoriesResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'describeBudgetActionHistoriesResponse_httpStatus' - The response's http status code.
--
-- 'actionHistories', 'describeBudgetActionHistoriesResponse_actionHistories' - The historical record of the budget action resource.
newDescribeBudgetActionHistoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeBudgetActionHistoriesResponse
newDescribeBudgetActionHistoriesResponse :: Int -> DescribeBudgetActionHistoriesResponse
newDescribeBudgetActionHistoriesResponse Int
pHttpStatus_ =
  DescribeBudgetActionHistoriesResponse' :: Maybe Text
-> Int -> [ActionHistory] -> DescribeBudgetActionHistoriesResponse
DescribeBudgetActionHistoriesResponse'
    { $sel:nextToken:DescribeBudgetActionHistoriesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeBudgetActionHistoriesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:actionHistories:DescribeBudgetActionHistoriesResponse' :: [ActionHistory]
actionHistories = [ActionHistory]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | The historical record of the budget action resource.
describeBudgetActionHistoriesResponse_actionHistories :: Lens.Lens' DescribeBudgetActionHistoriesResponse [ActionHistory]
describeBudgetActionHistoriesResponse_actionHistories :: ([ActionHistory] -> f [ActionHistory])
-> DescribeBudgetActionHistoriesResponse
-> f DescribeBudgetActionHistoriesResponse
describeBudgetActionHistoriesResponse_actionHistories = (DescribeBudgetActionHistoriesResponse -> [ActionHistory])
-> (DescribeBudgetActionHistoriesResponse
    -> [ActionHistory] -> DescribeBudgetActionHistoriesResponse)
-> Lens' DescribeBudgetActionHistoriesResponse [ActionHistory]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBudgetActionHistoriesResponse' {[ActionHistory]
actionHistories :: [ActionHistory]
$sel:actionHistories:DescribeBudgetActionHistoriesResponse' :: DescribeBudgetActionHistoriesResponse -> [ActionHistory]
actionHistories} -> [ActionHistory]
actionHistories) (\s :: DescribeBudgetActionHistoriesResponse
s@DescribeBudgetActionHistoriesResponse' {} [ActionHistory]
a -> DescribeBudgetActionHistoriesResponse
s {$sel:actionHistories:DescribeBudgetActionHistoriesResponse' :: [ActionHistory]
actionHistories = [ActionHistory]
a} :: DescribeBudgetActionHistoriesResponse) (([ActionHistory] -> f [ActionHistory])
 -> DescribeBudgetActionHistoriesResponse
 -> f DescribeBudgetActionHistoriesResponse)
-> (([ActionHistory] -> f [ActionHistory])
    -> [ActionHistory] -> f [ActionHistory])
-> ([ActionHistory] -> f [ActionHistory])
-> DescribeBudgetActionHistoriesResponse
-> f DescribeBudgetActionHistoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ActionHistory] -> f [ActionHistory])
-> [ActionHistory] -> f [ActionHistory]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    DescribeBudgetActionHistoriesResponse