{-# 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 #-}
module Amazonka.MediaConnect.ListReservations
(
ListReservations (..),
newListReservations,
listReservations_maxResults,
listReservations_nextToken,
ListReservationsResponse (..),
newListReservationsResponse,
listReservationsResponse_nextToken,
listReservationsResponse_reservations,
listReservationsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListReservations = ListReservations'
{
ListReservations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListReservations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListReservations -> ListReservations -> Bool
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]
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
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. 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)
newListReservations ::
ListReservations
newListReservations :: ListReservations
newListReservations =
ListReservations'
{ $sel:maxResults:ListReservations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListReservations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listReservations_maxResults :: Lens.Lens' ListReservations (Prelude.Maybe Prelude.Natural)
listReservations_maxResults :: Lens' ListReservations (Maybe Natural)
listReservations_maxResults = 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)
listReservations_nextToken :: Lens.Lens' ListReservations (Prelude.Maybe Prelude.Text)
listReservations_nextToken :: Lens' ListReservations (Maybe Text)
listReservations_nextToken = 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)
instance Core.AWSPager ListReservations where
page :: ListReservations
-> AWSResponse ListReservations -> Maybe ListReservations
page ListReservations
rq AWSResponse ListReservations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListReservations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReservationsResponse (Maybe Text)
listReservationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListReservations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReservationsResponse (Maybe [Reservation])
listReservationsResponse_reservations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListReservations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListReservations (Maybe Text)
listReservations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListReservations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReservationsResponse (Maybe Text)
listReservationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListReservations where
type
AWSResponse ListReservations =
ListReservationsResponse
request :: (Service -> Service)
-> ListReservations -> Request ListReservations
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListReservations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListReservations)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"reservations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListReservations where
hashWithSalt :: Int -> ListReservations -> Int
hashWithSalt Int
_salt ListReservations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReservations' :: ListReservations -> Maybe Text
$sel:maxResults:ListReservations' :: ListReservations -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListReservations where
rnf :: ListReservations -> ()
rnf ListReservations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReservations' :: ListReservations -> Maybe Text
$sel:maxResults:ListReservations' :: ListReservations -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListReservations where
toHeaders :: ListReservations -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListReservations where
toPath :: ListReservations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/reservations"
instance Data.ToQuery ListReservations where
toQuery :: ListReservations -> QueryString
toQuery ListReservations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReservations' :: ListReservations -> Maybe Text
$sel:maxResults:ListReservations' :: ListReservations -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListReservationsResponse = ListReservationsResponse'
{
ListReservationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListReservationsResponse -> Maybe [Reservation]
reservations :: Prelude.Maybe [Reservation],
ListReservationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListReservationsResponse -> ListReservationsResponse -> Bool
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]
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
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.
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)
newListReservationsResponse ::
Prelude.Int ->
ListReservationsResponse
newListReservationsResponse :: Int -> ListReservationsResponse
newListReservationsResponse Int
pHttpStatus_ =
ListReservationsResponse'
{ $sel:nextToken:ListReservationsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:reservations:ListReservationsResponse' :: Maybe [Reservation]
reservations = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListReservationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listReservationsResponse_nextToken :: Lens.Lens' ListReservationsResponse (Prelude.Maybe Prelude.Text)
listReservationsResponse_nextToken :: Lens' ListReservationsResponse (Maybe Text)
listReservationsResponse_nextToken = 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)
listReservationsResponse_reservations :: Lens.Lens' ListReservationsResponse (Prelude.Maybe [Reservation])
listReservationsResponse_reservations :: Lens' ListReservationsResponse (Maybe [Reservation])
listReservationsResponse_reservations = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listReservationsResponse_httpStatus :: Lens.Lens' ListReservationsResponse Prelude.Int
listReservationsResponse_httpStatus :: Lens' ListReservationsResponse Int
listReservationsResponse_httpStatus = 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 where
rnf :: ListReservationsResponse -> ()
rnf ListReservationsResponse' {Int
Maybe [Reservation]
Maybe Text
httpStatus :: Int
reservations :: Maybe [Reservation]
nextToken :: Maybe Text
$sel:httpStatus:ListReservationsResponse' :: ListReservationsResponse -> Int
$sel:reservations:ListReservationsResponse' :: ListReservationsResponse -> Maybe [Reservation]
$sel:nextToken:ListReservationsResponse' :: ListReservationsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Reservation]
reservations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus