{-# 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.DescribeReservation
(
DescribeReservation (..),
newDescribeReservation,
describeReservation_reservationArn,
DescribeReservationResponse (..),
newDescribeReservationResponse,
describeReservationResponse_reservation,
describeReservationResponse_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
data DescribeReservation = DescribeReservation'
{
DescribeReservation -> Text
reservationArn :: Prelude.Text
}
deriving (DescribeReservation -> DescribeReservation -> Bool
(DescribeReservation -> DescribeReservation -> Bool)
-> (DescribeReservation -> DescribeReservation -> Bool)
-> Eq DescribeReservation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservation -> DescribeReservation -> Bool
$c/= :: DescribeReservation -> DescribeReservation -> Bool
== :: DescribeReservation -> DescribeReservation -> Bool
$c== :: DescribeReservation -> DescribeReservation -> Bool
Prelude.Eq, ReadPrec [DescribeReservation]
ReadPrec DescribeReservation
Int -> ReadS DescribeReservation
ReadS [DescribeReservation]
(Int -> ReadS DescribeReservation)
-> ReadS [DescribeReservation]
-> ReadPrec DescribeReservation
-> ReadPrec [DescribeReservation]
-> Read DescribeReservation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservation]
$creadListPrec :: ReadPrec [DescribeReservation]
readPrec :: ReadPrec DescribeReservation
$creadPrec :: ReadPrec DescribeReservation
readList :: ReadS [DescribeReservation]
$creadList :: ReadS [DescribeReservation]
readsPrec :: Int -> ReadS DescribeReservation
$creadsPrec :: Int -> ReadS DescribeReservation
Prelude.Read, Int -> DescribeReservation -> ShowS
[DescribeReservation] -> ShowS
DescribeReservation -> String
(Int -> DescribeReservation -> ShowS)
-> (DescribeReservation -> String)
-> ([DescribeReservation] -> ShowS)
-> Show DescribeReservation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservation] -> ShowS
$cshowList :: [DescribeReservation] -> ShowS
show :: DescribeReservation -> String
$cshow :: DescribeReservation -> String
showsPrec :: Int -> DescribeReservation -> ShowS
$cshowsPrec :: Int -> DescribeReservation -> ShowS
Prelude.Show, (forall x. DescribeReservation -> Rep DescribeReservation x)
-> (forall x. Rep DescribeReservation x -> DescribeReservation)
-> Generic DescribeReservation
forall x. Rep DescribeReservation x -> DescribeReservation
forall x. DescribeReservation -> Rep DescribeReservation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeReservation x -> DescribeReservation
$cfrom :: forall x. DescribeReservation -> Rep DescribeReservation x
Prelude.Generic)
newDescribeReservation ::
Prelude.Text ->
DescribeReservation
newDescribeReservation :: Text -> DescribeReservation
newDescribeReservation Text
pReservationArn_ =
DescribeReservation' :: Text -> DescribeReservation
DescribeReservation'
{ $sel:reservationArn:DescribeReservation' :: Text
reservationArn =
Text
pReservationArn_
}
describeReservation_reservationArn :: Lens.Lens' DescribeReservation Prelude.Text
describeReservation_reservationArn :: (Text -> f Text) -> DescribeReservation -> f DescribeReservation
describeReservation_reservationArn = (DescribeReservation -> Text)
-> (DescribeReservation -> Text -> DescribeReservation)
-> Lens DescribeReservation DescribeReservation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservation' {Text
reservationArn :: Text
$sel:reservationArn:DescribeReservation' :: DescribeReservation -> Text
reservationArn} -> Text
reservationArn) (\s :: DescribeReservation
s@DescribeReservation' {} Text
a -> DescribeReservation
s {$sel:reservationArn:DescribeReservation' :: Text
reservationArn = Text
a} :: DescribeReservation)
instance Core.AWSRequest DescribeReservation where
type
AWSResponse DescribeReservation =
DescribeReservationResponse
request :: DescribeReservation -> Request DescribeReservation
request = Service -> DescribeReservation -> Request DescribeReservation
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeReservation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReservation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeReservation))
-> Logger
-> Service
-> Proxy DescribeReservation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReservation)))
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 Reservation -> Int -> DescribeReservationResponse
DescribeReservationResponse'
(Maybe Reservation -> Int -> DescribeReservationResponse)
-> Either String (Maybe Reservation)
-> Either String (Int -> DescribeReservationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Reservation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"reservation")
Either String (Int -> DescribeReservationResponse)
-> Either String Int -> Either String DescribeReservationResponse
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 DescribeReservation
instance Prelude.NFData DescribeReservation
instance Core.ToHeaders DescribeReservation where
toHeaders :: DescribeReservation -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeReservation -> 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 DescribeReservation where
toPath :: DescribeReservation -> ByteString
toPath DescribeReservation' {Text
reservationArn :: Text
$sel:reservationArn:DescribeReservation' :: DescribeReservation -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/reservations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
reservationArn]
instance Core.ToQuery DescribeReservation where
toQuery :: DescribeReservation -> QueryString
toQuery = QueryString -> DescribeReservation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeReservationResponse = DescribeReservationResponse'
{ DescribeReservationResponse -> Maybe Reservation
reservation :: Prelude.Maybe Reservation,
DescribeReservationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeReservationResponse -> DescribeReservationResponse -> Bool
(DescribeReservationResponse
-> DescribeReservationResponse -> Bool)
-> (DescribeReservationResponse
-> DescribeReservationResponse -> Bool)
-> Eq DescribeReservationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservationResponse -> DescribeReservationResponse -> Bool
$c/= :: DescribeReservationResponse -> DescribeReservationResponse -> Bool
== :: DescribeReservationResponse -> DescribeReservationResponse -> Bool
$c== :: DescribeReservationResponse -> DescribeReservationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReservationResponse]
ReadPrec DescribeReservationResponse
Int -> ReadS DescribeReservationResponse
ReadS [DescribeReservationResponse]
(Int -> ReadS DescribeReservationResponse)
-> ReadS [DescribeReservationResponse]
-> ReadPrec DescribeReservationResponse
-> ReadPrec [DescribeReservationResponse]
-> Read DescribeReservationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservationResponse]
$creadListPrec :: ReadPrec [DescribeReservationResponse]
readPrec :: ReadPrec DescribeReservationResponse
$creadPrec :: ReadPrec DescribeReservationResponse
readList :: ReadS [DescribeReservationResponse]
$creadList :: ReadS [DescribeReservationResponse]
readsPrec :: Int -> ReadS DescribeReservationResponse
$creadsPrec :: Int -> ReadS DescribeReservationResponse
Prelude.Read, Int -> DescribeReservationResponse -> ShowS
[DescribeReservationResponse] -> ShowS
DescribeReservationResponse -> String
(Int -> DescribeReservationResponse -> ShowS)
-> (DescribeReservationResponse -> String)
-> ([DescribeReservationResponse] -> ShowS)
-> Show DescribeReservationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservationResponse] -> ShowS
$cshowList :: [DescribeReservationResponse] -> ShowS
show :: DescribeReservationResponse -> String
$cshow :: DescribeReservationResponse -> String
showsPrec :: Int -> DescribeReservationResponse -> ShowS
$cshowsPrec :: Int -> DescribeReservationResponse -> ShowS
Prelude.Show, (forall x.
DescribeReservationResponse -> Rep DescribeReservationResponse x)
-> (forall x.
Rep DescribeReservationResponse x -> DescribeReservationResponse)
-> Generic DescribeReservationResponse
forall x.
Rep DescribeReservationResponse x -> DescribeReservationResponse
forall x.
DescribeReservationResponse -> Rep DescribeReservationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservationResponse x -> DescribeReservationResponse
$cfrom :: forall x.
DescribeReservationResponse -> Rep DescribeReservationResponse x
Prelude.Generic)
newDescribeReservationResponse ::
Prelude.Int ->
DescribeReservationResponse
newDescribeReservationResponse :: Int -> DescribeReservationResponse
newDescribeReservationResponse Int
pHttpStatus_ =
DescribeReservationResponse' :: Maybe Reservation -> Int -> DescribeReservationResponse
DescribeReservationResponse'
{ $sel:reservation:DescribeReservationResponse' :: Maybe Reservation
reservation =
Maybe Reservation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeReservationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeReservationResponse_reservation :: Lens.Lens' DescribeReservationResponse (Prelude.Maybe Reservation)
describeReservationResponse_reservation :: (Maybe Reservation -> f (Maybe Reservation))
-> DescribeReservationResponse -> f DescribeReservationResponse
describeReservationResponse_reservation = (DescribeReservationResponse -> Maybe Reservation)
-> (DescribeReservationResponse
-> Maybe Reservation -> DescribeReservationResponse)
-> Lens
DescribeReservationResponse
DescribeReservationResponse
(Maybe Reservation)
(Maybe Reservation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservationResponse' {Maybe Reservation
reservation :: Maybe Reservation
$sel:reservation:DescribeReservationResponse' :: DescribeReservationResponse -> Maybe Reservation
reservation} -> Maybe Reservation
reservation) (\s :: DescribeReservationResponse
s@DescribeReservationResponse' {} Maybe Reservation
a -> DescribeReservationResponse
s {$sel:reservation:DescribeReservationResponse' :: Maybe Reservation
reservation = Maybe Reservation
a} :: DescribeReservationResponse)
describeReservationResponse_httpStatus :: Lens.Lens' DescribeReservationResponse Prelude.Int
describeReservationResponse_httpStatus :: (Int -> f Int)
-> DescribeReservationResponse -> f DescribeReservationResponse
describeReservationResponse_httpStatus = (DescribeReservationResponse -> Int)
-> (DescribeReservationResponse
-> Int -> DescribeReservationResponse)
-> Lens
DescribeReservationResponse DescribeReservationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeReservationResponse' :: DescribeReservationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeReservationResponse
s@DescribeReservationResponse' {} Int
a -> DescribeReservationResponse
s {$sel:httpStatus:DescribeReservationResponse' :: Int
httpStatus = Int
a} :: DescribeReservationResponse)
instance Prelude.NFData DescribeReservationResponse