{-# 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.Route53Domains.ViewBilling
-- 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 all the domain-related billing records for the current AWS
-- account for a specified period
--
-- This operation returns paginated results.
module Amazonka.Route53Domains.ViewBilling
  ( -- * Creating a Request
    ViewBilling (..),
    newViewBilling,

    -- * Request Lenses
    viewBilling_start,
    viewBilling_end,
    viewBilling_marker,
    viewBilling_maxItems,

    -- * Destructuring the Response
    ViewBillingResponse (..),
    newViewBillingResponse,

    -- * Response Lenses
    viewBillingResponse_nextPageMarker,
    viewBillingResponse_billingRecords,
    viewBillingResponse_httpStatus,
  )
where

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
import Amazonka.Route53Domains.Types

-- | The ViewBilling request includes the following elements.
--
-- /See:/ 'newViewBilling' smart constructor.
data ViewBilling = ViewBilling'
  { -- | The beginning date and time for the time period for which you want a
    -- list of billing records. Specify the date and time in Unix time format
    -- and Coordinated Universal time (UTC).
    ViewBilling -> Maybe POSIX
start :: Prelude.Maybe Core.POSIX,
    -- | The end date and time for the time period for which you want a list of
    -- billing records. Specify the date and time in Unix time format and
    -- Coordinated Universal time (UTC).
    ViewBilling -> Maybe POSIX
end :: Prelude.Maybe Core.POSIX,
    -- | For an initial request for a list of billing records, omit this element.
    -- If the number of billing records that are associated with the current
    -- AWS account during the specified period is greater than the value that
    -- you specified for @MaxItems@, you can use @Marker@ to return additional
    -- billing records. Get the value of @NextPageMarker@ from the previous
    -- response, and submit another request that includes the value of
    -- @NextPageMarker@ in the @Marker@ element.
    --
    -- Constraints: The marker must match the value of @NextPageMarker@ that
    -- was returned in the previous response.
    ViewBilling -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The number of billing records to be returned.
    --
    -- Default: 20
    ViewBilling -> Maybe Int
maxItems :: Prelude.Maybe Prelude.Int
  }
  deriving (ViewBilling -> ViewBilling -> Bool
(ViewBilling -> ViewBilling -> Bool)
-> (ViewBilling -> ViewBilling -> Bool) -> Eq ViewBilling
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViewBilling -> ViewBilling -> Bool
$c/= :: ViewBilling -> ViewBilling -> Bool
== :: ViewBilling -> ViewBilling -> Bool
$c== :: ViewBilling -> ViewBilling -> Bool
Prelude.Eq, ReadPrec [ViewBilling]
ReadPrec ViewBilling
Int -> ReadS ViewBilling
ReadS [ViewBilling]
(Int -> ReadS ViewBilling)
-> ReadS [ViewBilling]
-> ReadPrec ViewBilling
-> ReadPrec [ViewBilling]
-> Read ViewBilling
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ViewBilling]
$creadListPrec :: ReadPrec [ViewBilling]
readPrec :: ReadPrec ViewBilling
$creadPrec :: ReadPrec ViewBilling
readList :: ReadS [ViewBilling]
$creadList :: ReadS [ViewBilling]
readsPrec :: Int -> ReadS ViewBilling
$creadsPrec :: Int -> ReadS ViewBilling
Prelude.Read, Int -> ViewBilling -> ShowS
[ViewBilling] -> ShowS
ViewBilling -> String
(Int -> ViewBilling -> ShowS)
-> (ViewBilling -> String)
-> ([ViewBilling] -> ShowS)
-> Show ViewBilling
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ViewBilling] -> ShowS
$cshowList :: [ViewBilling] -> ShowS
show :: ViewBilling -> String
$cshow :: ViewBilling -> String
showsPrec :: Int -> ViewBilling -> ShowS
$cshowsPrec :: Int -> ViewBilling -> ShowS
Prelude.Show, (forall x. ViewBilling -> Rep ViewBilling x)
-> (forall x. Rep ViewBilling x -> ViewBilling)
-> Generic ViewBilling
forall x. Rep ViewBilling x -> ViewBilling
forall x. ViewBilling -> Rep ViewBilling x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ViewBilling x -> ViewBilling
$cfrom :: forall x. ViewBilling -> Rep ViewBilling x
Prelude.Generic)

-- |
-- Create a value of 'ViewBilling' 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:
--
-- 'start', 'viewBilling_start' - The beginning date and time for the time period for which you want a
-- list of billing records. Specify the date and time in Unix time format
-- and Coordinated Universal time (UTC).
--
-- 'end', 'viewBilling_end' - The end date and time for the time period for which you want a list of
-- billing records. Specify the date and time in Unix time format and
-- Coordinated Universal time (UTC).
--
-- 'marker', 'viewBilling_marker' - For an initial request for a list of billing records, omit this element.
-- If the number of billing records that are associated with the current
-- AWS account during the specified period is greater than the value that
-- you specified for @MaxItems@, you can use @Marker@ to return additional
-- billing records. Get the value of @NextPageMarker@ from the previous
-- response, and submit another request that includes the value of
-- @NextPageMarker@ in the @Marker@ element.
--
-- Constraints: The marker must match the value of @NextPageMarker@ that
-- was returned in the previous response.
--
-- 'maxItems', 'viewBilling_maxItems' - The number of billing records to be returned.
--
-- Default: 20
newViewBilling ::
  ViewBilling
newViewBilling :: ViewBilling
newViewBilling =
  ViewBilling' :: Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Maybe Int -> ViewBilling
ViewBilling'
    { $sel:start:ViewBilling' :: Maybe POSIX
start = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:end:ViewBilling' :: Maybe POSIX
end = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ViewBilling' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ViewBilling' :: Maybe Int
maxItems = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The beginning date and time for the time period for which you want a
-- list of billing records. Specify the date and time in Unix time format
-- and Coordinated Universal time (UTC).
viewBilling_start :: Lens.Lens' ViewBilling (Prelude.Maybe Prelude.UTCTime)
viewBilling_start :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ViewBilling -> f ViewBilling
viewBilling_start = (ViewBilling -> Maybe POSIX)
-> (ViewBilling -> Maybe POSIX -> ViewBilling)
-> Lens ViewBilling ViewBilling (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBilling' {Maybe POSIX
start :: Maybe POSIX
$sel:start:ViewBilling' :: ViewBilling -> Maybe POSIX
start} -> Maybe POSIX
start) (\s :: ViewBilling
s@ViewBilling' {} Maybe POSIX
a -> ViewBilling
s {$sel:start:ViewBilling' :: Maybe POSIX
start = Maybe POSIX
a} :: ViewBilling) ((Maybe POSIX -> f (Maybe POSIX)) -> ViewBilling -> f ViewBilling)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ViewBilling
-> f ViewBilling
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The end date and time for the time period for which you want a list of
-- billing records. Specify the date and time in Unix time format and
-- Coordinated Universal time (UTC).
viewBilling_end :: Lens.Lens' ViewBilling (Prelude.Maybe Prelude.UTCTime)
viewBilling_end :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ViewBilling -> f ViewBilling
viewBilling_end = (ViewBilling -> Maybe POSIX)
-> (ViewBilling -> Maybe POSIX -> ViewBilling)
-> Lens ViewBilling ViewBilling (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBilling' {Maybe POSIX
end :: Maybe POSIX
$sel:end:ViewBilling' :: ViewBilling -> Maybe POSIX
end} -> Maybe POSIX
end) (\s :: ViewBilling
s@ViewBilling' {} Maybe POSIX
a -> ViewBilling
s {$sel:end:ViewBilling' :: Maybe POSIX
end = Maybe POSIX
a} :: ViewBilling) ((Maybe POSIX -> f (Maybe POSIX)) -> ViewBilling -> f ViewBilling)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ViewBilling
-> f ViewBilling
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | For an initial request for a list of billing records, omit this element.
-- If the number of billing records that are associated with the current
-- AWS account during the specified period is greater than the value that
-- you specified for @MaxItems@, you can use @Marker@ to return additional
-- billing records. Get the value of @NextPageMarker@ from the previous
-- response, and submit another request that includes the value of
-- @NextPageMarker@ in the @Marker@ element.
--
-- Constraints: The marker must match the value of @NextPageMarker@ that
-- was returned in the previous response.
viewBilling_marker :: Lens.Lens' ViewBilling (Prelude.Maybe Prelude.Text)
viewBilling_marker :: (Maybe Text -> f (Maybe Text)) -> ViewBilling -> f ViewBilling
viewBilling_marker = (ViewBilling -> Maybe Text)
-> (ViewBilling -> Maybe Text -> ViewBilling)
-> Lens ViewBilling ViewBilling (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBilling' {Maybe Text
marker :: Maybe Text
$sel:marker:ViewBilling' :: ViewBilling -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ViewBilling
s@ViewBilling' {} Maybe Text
a -> ViewBilling
s {$sel:marker:ViewBilling' :: Maybe Text
marker = Maybe Text
a} :: ViewBilling)

-- | The number of billing records to be returned.
--
-- Default: 20
viewBilling_maxItems :: Lens.Lens' ViewBilling (Prelude.Maybe Prelude.Int)
viewBilling_maxItems :: (Maybe Int -> f (Maybe Int)) -> ViewBilling -> f ViewBilling
viewBilling_maxItems = (ViewBilling -> Maybe Int)
-> (ViewBilling -> Maybe Int -> ViewBilling)
-> Lens ViewBilling ViewBilling (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBilling' {Maybe Int
maxItems :: Maybe Int
$sel:maxItems:ViewBilling' :: ViewBilling -> Maybe Int
maxItems} -> Maybe Int
maxItems) (\s :: ViewBilling
s@ViewBilling' {} Maybe Int
a -> ViewBilling
s {$sel:maxItems:ViewBilling' :: Maybe Int
maxItems = Maybe Int
a} :: ViewBilling)

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

instance Prelude.NFData ViewBilling

instance Core.ToHeaders ViewBilling where
  toHeaders :: ViewBilling -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ViewBilling -> 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
"Route53Domains_v20140515.ViewBilling" ::
                          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 ViewBilling where
  toJSON :: ViewBilling -> Value
toJSON ViewBilling' {Maybe Int
Maybe Text
Maybe POSIX
maxItems :: Maybe Int
marker :: Maybe Text
end :: Maybe POSIX
start :: Maybe POSIX
$sel:maxItems:ViewBilling' :: ViewBilling -> Maybe Int
$sel:marker:ViewBilling' :: ViewBilling -> Maybe Text
$sel:end:ViewBilling' :: ViewBilling -> Maybe POSIX
$sel:start:ViewBilling' :: ViewBilling -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Start" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
start,
            (Text
"End" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
end,
            (Text
"Marker" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
marker,
            (Text
"MaxItems" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxItems
          ]
      )

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

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

-- | The ViewBilling response includes the following elements.
--
-- /See:/ 'newViewBillingResponse' smart constructor.
data ViewBillingResponse = ViewBillingResponse'
  { -- | If there are more billing records than you specified for @MaxItems@ in
    -- the request, submit another request and include the value of
    -- @NextPageMarker@ in the value of @Marker@.
    ViewBillingResponse -> Maybe Text
nextPageMarker :: Prelude.Maybe Prelude.Text,
    -- | A summary of billing records.
    ViewBillingResponse -> Maybe [BillingRecord]
billingRecords :: Prelude.Maybe [BillingRecord],
    -- | The response's http status code.
    ViewBillingResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ViewBillingResponse -> ViewBillingResponse -> Bool
(ViewBillingResponse -> ViewBillingResponse -> Bool)
-> (ViewBillingResponse -> ViewBillingResponse -> Bool)
-> Eq ViewBillingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViewBillingResponse -> ViewBillingResponse -> Bool
$c/= :: ViewBillingResponse -> ViewBillingResponse -> Bool
== :: ViewBillingResponse -> ViewBillingResponse -> Bool
$c== :: ViewBillingResponse -> ViewBillingResponse -> Bool
Prelude.Eq, ReadPrec [ViewBillingResponse]
ReadPrec ViewBillingResponse
Int -> ReadS ViewBillingResponse
ReadS [ViewBillingResponse]
(Int -> ReadS ViewBillingResponse)
-> ReadS [ViewBillingResponse]
-> ReadPrec ViewBillingResponse
-> ReadPrec [ViewBillingResponse]
-> Read ViewBillingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ViewBillingResponse]
$creadListPrec :: ReadPrec [ViewBillingResponse]
readPrec :: ReadPrec ViewBillingResponse
$creadPrec :: ReadPrec ViewBillingResponse
readList :: ReadS [ViewBillingResponse]
$creadList :: ReadS [ViewBillingResponse]
readsPrec :: Int -> ReadS ViewBillingResponse
$creadsPrec :: Int -> ReadS ViewBillingResponse
Prelude.Read, Int -> ViewBillingResponse -> ShowS
[ViewBillingResponse] -> ShowS
ViewBillingResponse -> String
(Int -> ViewBillingResponse -> ShowS)
-> (ViewBillingResponse -> String)
-> ([ViewBillingResponse] -> ShowS)
-> Show ViewBillingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ViewBillingResponse] -> ShowS
$cshowList :: [ViewBillingResponse] -> ShowS
show :: ViewBillingResponse -> String
$cshow :: ViewBillingResponse -> String
showsPrec :: Int -> ViewBillingResponse -> ShowS
$cshowsPrec :: Int -> ViewBillingResponse -> ShowS
Prelude.Show, (forall x. ViewBillingResponse -> Rep ViewBillingResponse x)
-> (forall x. Rep ViewBillingResponse x -> ViewBillingResponse)
-> Generic ViewBillingResponse
forall x. Rep ViewBillingResponse x -> ViewBillingResponse
forall x. ViewBillingResponse -> Rep ViewBillingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ViewBillingResponse x -> ViewBillingResponse
$cfrom :: forall x. ViewBillingResponse -> Rep ViewBillingResponse x
Prelude.Generic)

-- |
-- Create a value of 'ViewBillingResponse' 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:
--
-- 'nextPageMarker', 'viewBillingResponse_nextPageMarker' - If there are more billing records than you specified for @MaxItems@ in
-- the request, submit another request and include the value of
-- @NextPageMarker@ in the value of @Marker@.
--
-- 'billingRecords', 'viewBillingResponse_billingRecords' - A summary of billing records.
--
-- 'httpStatus', 'viewBillingResponse_httpStatus' - The response's http status code.
newViewBillingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ViewBillingResponse
newViewBillingResponse :: Int -> ViewBillingResponse
newViewBillingResponse Int
pHttpStatus_ =
  ViewBillingResponse' :: Maybe Text -> Maybe [BillingRecord] -> Int -> ViewBillingResponse
ViewBillingResponse'
    { $sel:nextPageMarker:ViewBillingResponse' :: Maybe Text
nextPageMarker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:billingRecords:ViewBillingResponse' :: Maybe [BillingRecord]
billingRecords = Maybe [BillingRecord]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ViewBillingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If there are more billing records than you specified for @MaxItems@ in
-- the request, submit another request and include the value of
-- @NextPageMarker@ in the value of @Marker@.
viewBillingResponse_nextPageMarker :: Lens.Lens' ViewBillingResponse (Prelude.Maybe Prelude.Text)
viewBillingResponse_nextPageMarker :: (Maybe Text -> f (Maybe Text))
-> ViewBillingResponse -> f ViewBillingResponse
viewBillingResponse_nextPageMarker = (ViewBillingResponse -> Maybe Text)
-> (ViewBillingResponse -> Maybe Text -> ViewBillingResponse)
-> Lens' ViewBillingResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBillingResponse' {Maybe Text
nextPageMarker :: Maybe Text
$sel:nextPageMarker:ViewBillingResponse' :: ViewBillingResponse -> Maybe Text
nextPageMarker} -> Maybe Text
nextPageMarker) (\s :: ViewBillingResponse
s@ViewBillingResponse' {} Maybe Text
a -> ViewBillingResponse
s {$sel:nextPageMarker:ViewBillingResponse' :: Maybe Text
nextPageMarker = Maybe Text
a} :: ViewBillingResponse)

-- | A summary of billing records.
viewBillingResponse_billingRecords :: Lens.Lens' ViewBillingResponse (Prelude.Maybe [BillingRecord])
viewBillingResponse_billingRecords :: (Maybe [BillingRecord] -> f (Maybe [BillingRecord]))
-> ViewBillingResponse -> f ViewBillingResponse
viewBillingResponse_billingRecords = (ViewBillingResponse -> Maybe [BillingRecord])
-> (ViewBillingResponse
    -> Maybe [BillingRecord] -> ViewBillingResponse)
-> Lens' ViewBillingResponse (Maybe [BillingRecord])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViewBillingResponse' {Maybe [BillingRecord]
billingRecords :: Maybe [BillingRecord]
$sel:billingRecords:ViewBillingResponse' :: ViewBillingResponse -> Maybe [BillingRecord]
billingRecords} -> Maybe [BillingRecord]
billingRecords) (\s :: ViewBillingResponse
s@ViewBillingResponse' {} Maybe [BillingRecord]
a -> ViewBillingResponse
s {$sel:billingRecords:ViewBillingResponse' :: Maybe [BillingRecord]
billingRecords = Maybe [BillingRecord]
a} :: ViewBillingResponse) ((Maybe [BillingRecord] -> f (Maybe [BillingRecord]))
 -> ViewBillingResponse -> f ViewBillingResponse)
-> ((Maybe [BillingRecord] -> f (Maybe [BillingRecord]))
    -> Maybe [BillingRecord] -> f (Maybe [BillingRecord]))
-> (Maybe [BillingRecord] -> f (Maybe [BillingRecord]))
-> ViewBillingResponse
-> f ViewBillingResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [BillingRecord] [BillingRecord] [BillingRecord] [BillingRecord]
-> Iso
     (Maybe [BillingRecord])
     (Maybe [BillingRecord])
     (Maybe [BillingRecord])
     (Maybe [BillingRecord])
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
  [BillingRecord] [BillingRecord] [BillingRecord] [BillingRecord]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ViewBillingResponse