{-# 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.MediaConnect.ListReservations
-- 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)
--
-- Displays a list of all reservations that have been purchased by this
-- account in the current AWS Region. This list includes all reservations
-- in all states (such as active and expired).
--
-- This operation returns paginated results.
module Amazonka.MediaConnect.ListReservations
  ( -- * Creating a Request
    ListReservations (..),
    newListReservations,

    -- * Request Lenses
    listReservations_nextToken,
    listReservations_maxResults,

    -- * Destructuring the Response
    ListReservationsResponse (..),
    newListReservationsResponse,

    -- * Response Lenses
    listReservationsResponse_nextToken,
    listReservationsResponse_reservations,
    listReservationsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListReservations' smart constructor.
data ListReservations = ListReservations'
  { -- | The token that identifies which batch of results that you want to see.
    -- For example, you submit a ListReservations request with MaxResults set
    -- at 5. The service returns the first batch of results (up to 5) and a
    -- NextToken value. To see the next batch of results, you can submit the
    -- ListOfferings request a second time and specify the NextToken value.
    ListReservations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per API request. For example,
    -- you submit a ListReservations request with MaxResults set at 5. Although
    -- 20 items match your request, the service returns no more than the first
    -- 5 items. (The service also returns a NextToken value that you can use to
    -- fetch the next batch of results.) The service might return fewer results
    -- than the MaxResults value. If MaxResults is not included in the request,
    -- the service defaults to pagination with a maximum of 10 results per
    -- page.
    ListReservations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListReservations -> ListReservations -> Bool
(ListReservations -> ListReservations -> Bool)
-> (ListReservations -> ListReservations -> Bool)
-> Eq ListReservations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReservations -> ListReservations -> Bool
$c/= :: ListReservations -> ListReservations -> Bool
== :: ListReservations -> ListReservations -> Bool
$c== :: ListReservations -> ListReservations -> Bool
Prelude.Eq, ReadPrec [ListReservations]
ReadPrec ListReservations
Int -> ReadS ListReservations
ReadS [ListReservations]
(Int -> ReadS ListReservations)
-> ReadS [ListReservations]
-> ReadPrec ListReservations
-> ReadPrec [ListReservations]
-> Read ListReservations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReservations]
$creadListPrec :: ReadPrec [ListReservations]
readPrec :: ReadPrec ListReservations
$creadPrec :: ReadPrec ListReservations
readList :: ReadS [ListReservations]
$creadList :: ReadS [ListReservations]
readsPrec :: Int -> ReadS ListReservations
$creadsPrec :: Int -> ReadS ListReservations
Prelude.Read, Int -> ListReservations -> ShowS
[ListReservations] -> ShowS
ListReservations -> String
(Int -> ListReservations -> ShowS)
-> (ListReservations -> String)
-> ([ListReservations] -> ShowS)
-> Show ListReservations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReservations] -> ShowS
$cshowList :: [ListReservations] -> ShowS
show :: ListReservations -> String
$cshow :: ListReservations -> String
showsPrec :: Int -> ListReservations -> ShowS
$cshowsPrec :: Int -> ListReservations -> ShowS
Prelude.Show, (forall x. ListReservations -> Rep ListReservations x)
-> (forall x. Rep ListReservations x -> ListReservations)
-> Generic ListReservations
forall x. Rep ListReservations x -> ListReservations
forall x. ListReservations -> Rep ListReservations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListReservations x -> ListReservations
$cfrom :: forall x. ListReservations -> Rep ListReservations x
Prelude.Generic)

-- |
-- Create a value of 'ListReservations' 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', 'listReservations_nextToken' - The token that identifies which batch of results that you want to see.
-- For example, you submit a ListReservations request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListOfferings request a second time and specify the NextToken value.
--
-- 'maxResults', 'listReservations_maxResults' - The maximum number of results to return per API request. For example,
-- you submit a ListReservations request with MaxResults set at 5. Although
-- 20 items match your request, the service returns no more than the first
-- 5 items. (The service also returns a NextToken value that you can use to
-- fetch the next batch of results.) The service might return fewer results
-- than the MaxResults value. If MaxResults is not included in the request,
-- the service defaults to pagination with a maximum of 10 results per
-- page.
newListReservations ::
  ListReservations
newListReservations :: ListReservations
newListReservations =
  ListReservations' :: Maybe Text -> Maybe Natural -> ListReservations
ListReservations'
    { $sel:nextToken:ListReservations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListReservations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token that identifies which batch of results that you want to see.
-- For example, you submit a ListReservations request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListOfferings request a second time and specify the NextToken value.
listReservations_nextToken :: Lens.Lens' ListReservations (Prelude.Maybe Prelude.Text)
listReservations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReservations -> f ListReservations
listReservations_nextToken = (ListReservations -> Maybe Text)
-> (ListReservations -> Maybe Text -> ListReservations)
-> Lens ListReservations ListReservations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReservations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReservations' :: ListReservations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReservations
s@ListReservations' {} Maybe Text
a -> ListReservations
s {$sel:nextToken:ListReservations' :: Maybe Text
nextToken = Maybe Text
a} :: ListReservations)

-- | The maximum number of results to return per API request. For example,
-- you submit a ListReservations request with MaxResults set at 5. Although
-- 20 items match your request, the service returns no more than the first
-- 5 items. (The service also returns a NextToken value that you can use to
-- fetch the next batch of results.) The service might return fewer results
-- than the MaxResults value. If MaxResults is not included in the request,
-- the service defaults to pagination with a maximum of 10 results per
-- page.
listReservations_maxResults :: Lens.Lens' ListReservations (Prelude.Maybe Prelude.Natural)
listReservations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListReservations -> f ListReservations
listReservations_maxResults = (ListReservations -> Maybe Natural)
-> (ListReservations -> Maybe Natural -> ListReservations)
-> Lens
     ListReservations ListReservations (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReservations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListReservations' :: ListReservations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListReservations
s@ListReservations' {} Maybe Natural
a -> ListReservations
s {$sel:maxResults:ListReservations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListReservations)

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

instance Prelude.NFData ListReservations

instance Core.ToHeaders ListReservations where
  toHeaders :: ListReservations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListReservations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Core.ToQuery ListReservations where
  toQuery :: ListReservations -> QueryString
toQuery ListReservations' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListReservations' :: ListReservations -> Maybe Natural
$sel:nextToken:ListReservations' :: ListReservations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListReservationsResponse' smart constructor.
data ListReservationsResponse = ListReservationsResponse'
  { -- | The token that identifies which batch of results that you want to see.
    -- For example, you submit a ListReservations request with MaxResults set
    -- at 5. The service returns the first batch of results (up to 5) and a
    -- NextToken value. To see the next batch of results, you can submit the
    -- ListReservations request a second time and specify the NextToken value.
    ListReservationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of all reservations that have been purchased by this account in
    -- the current AWS Region.
    ListReservationsResponse -> Maybe [Reservation]
reservations :: Prelude.Maybe [Reservation],
    -- | The response's http status code.
    ListReservationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListReservationsResponse -> ListReservationsResponse -> Bool
(ListReservationsResponse -> ListReservationsResponse -> Bool)
-> (ListReservationsResponse -> ListReservationsResponse -> Bool)
-> Eq ListReservationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReservationsResponse -> ListReservationsResponse -> Bool
$c/= :: ListReservationsResponse -> ListReservationsResponse -> Bool
== :: ListReservationsResponse -> ListReservationsResponse -> Bool
$c== :: ListReservationsResponse -> ListReservationsResponse -> Bool
Prelude.Eq, ReadPrec [ListReservationsResponse]
ReadPrec ListReservationsResponse
Int -> ReadS ListReservationsResponse
ReadS [ListReservationsResponse]
(Int -> ReadS ListReservationsResponse)
-> ReadS [ListReservationsResponse]
-> ReadPrec ListReservationsResponse
-> ReadPrec [ListReservationsResponse]
-> Read ListReservationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReservationsResponse]
$creadListPrec :: ReadPrec [ListReservationsResponse]
readPrec :: ReadPrec ListReservationsResponse
$creadPrec :: ReadPrec ListReservationsResponse
readList :: ReadS [ListReservationsResponse]
$creadList :: ReadS [ListReservationsResponse]
readsPrec :: Int -> ReadS ListReservationsResponse
$creadsPrec :: Int -> ReadS ListReservationsResponse
Prelude.Read, Int -> ListReservationsResponse -> ShowS
[ListReservationsResponse] -> ShowS
ListReservationsResponse -> String
(Int -> ListReservationsResponse -> ShowS)
-> (ListReservationsResponse -> String)
-> ([ListReservationsResponse] -> ShowS)
-> Show ListReservationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReservationsResponse] -> ShowS
$cshowList :: [ListReservationsResponse] -> ShowS
show :: ListReservationsResponse -> String
$cshow :: ListReservationsResponse -> String
showsPrec :: Int -> ListReservationsResponse -> ShowS
$cshowsPrec :: Int -> ListReservationsResponse -> ShowS
Prelude.Show, (forall x.
 ListReservationsResponse -> Rep ListReservationsResponse x)
-> (forall x.
    Rep ListReservationsResponse x -> ListReservationsResponse)
-> Generic ListReservationsResponse
forall x.
Rep ListReservationsResponse x -> ListReservationsResponse
forall x.
ListReservationsResponse -> Rep ListReservationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListReservationsResponse x -> ListReservationsResponse
$cfrom :: forall x.
ListReservationsResponse -> Rep ListReservationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListReservationsResponse' 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', 'listReservationsResponse_nextToken' - The token that identifies which batch of results that you want to see.
-- For example, you submit a ListReservations request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListReservations request a second time and specify the NextToken value.
--
-- 'reservations', 'listReservationsResponse_reservations' - A list of all reservations that have been purchased by this account in
-- the current AWS Region.
--
-- 'httpStatus', 'listReservationsResponse_httpStatus' - The response's http status code.
newListReservationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListReservationsResponse
newListReservationsResponse :: Int -> ListReservationsResponse
newListReservationsResponse Int
pHttpStatus_ =
  ListReservationsResponse' :: Maybe Text
-> Maybe [Reservation] -> Int -> ListReservationsResponse
ListReservationsResponse'
    { $sel:nextToken:ListReservationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reservations:ListReservationsResponse' :: Maybe [Reservation]
reservations = Maybe [Reservation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListReservationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token that identifies which batch of results that you want to see.
-- For example, you submit a ListReservations request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListReservations request a second time and specify the NextToken value.
listReservationsResponse_nextToken :: Lens.Lens' ListReservationsResponse (Prelude.Maybe Prelude.Text)
listReservationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReservationsResponse -> f ListReservationsResponse
listReservationsResponse_nextToken = (ListReservationsResponse -> Maybe Text)
-> (ListReservationsResponse
    -> Maybe Text -> ListReservationsResponse)
-> Lens' ListReservationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReservationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReservationsResponse' :: ListReservationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReservationsResponse
s@ListReservationsResponse' {} Maybe Text
a -> ListReservationsResponse
s {$sel:nextToken:ListReservationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListReservationsResponse)

-- | A list of all reservations that have been purchased by this account in
-- the current AWS Region.
listReservationsResponse_reservations :: Lens.Lens' ListReservationsResponse (Prelude.Maybe [Reservation])
listReservationsResponse_reservations :: (Maybe [Reservation] -> f (Maybe [Reservation]))
-> ListReservationsResponse -> f ListReservationsResponse
listReservationsResponse_reservations = (ListReservationsResponse -> Maybe [Reservation])
-> (ListReservationsResponse
    -> Maybe [Reservation] -> ListReservationsResponse)
-> Lens' ListReservationsResponse (Maybe [Reservation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReservationsResponse' {Maybe [Reservation]
reservations :: Maybe [Reservation]
$sel:reservations:ListReservationsResponse' :: ListReservationsResponse -> Maybe [Reservation]
reservations} -> Maybe [Reservation]
reservations) (\s :: ListReservationsResponse
s@ListReservationsResponse' {} Maybe [Reservation]
a -> ListReservationsResponse
s {$sel:reservations:ListReservationsResponse' :: Maybe [Reservation]
reservations = Maybe [Reservation]
a} :: ListReservationsResponse) ((Maybe [Reservation] -> f (Maybe [Reservation]))
 -> ListReservationsResponse -> f ListReservationsResponse)
-> ((Maybe [Reservation] -> f (Maybe [Reservation]))
    -> Maybe [Reservation] -> f (Maybe [Reservation]))
-> (Maybe [Reservation] -> f (Maybe [Reservation]))
-> ListReservationsResponse
-> f ListReservationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Reservation] [Reservation] [Reservation] [Reservation]
-> Iso
     (Maybe [Reservation])
     (Maybe [Reservation])
     (Maybe [Reservation])
     (Maybe [Reservation])
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 [Reservation] [Reservation] [Reservation] [Reservation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListReservationsResponse