{-# 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.Nimble.GetStreamingSession
(
GetStreamingSession (..),
newGetStreamingSession,
getStreamingSession_studioId,
getStreamingSession_sessionId,
GetStreamingSessionResponse (..),
newGetStreamingSessionResponse,
getStreamingSessionResponse_session,
getStreamingSessionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetStreamingSession = GetStreamingSession'
{
GetStreamingSession -> Text
studioId :: Prelude.Text,
GetStreamingSession -> Text
sessionId :: Prelude.Text
}
deriving (GetStreamingSession -> GetStreamingSession -> Bool
(GetStreamingSession -> GetStreamingSession -> Bool)
-> (GetStreamingSession -> GetStreamingSession -> Bool)
-> Eq GetStreamingSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamingSession -> GetStreamingSession -> Bool
$c/= :: GetStreamingSession -> GetStreamingSession -> Bool
== :: GetStreamingSession -> GetStreamingSession -> Bool
$c== :: GetStreamingSession -> GetStreamingSession -> Bool
Prelude.Eq, ReadPrec [GetStreamingSession]
ReadPrec GetStreamingSession
Int -> ReadS GetStreamingSession
ReadS [GetStreamingSession]
(Int -> ReadS GetStreamingSession)
-> ReadS [GetStreamingSession]
-> ReadPrec GetStreamingSession
-> ReadPrec [GetStreamingSession]
-> Read GetStreamingSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStreamingSession]
$creadListPrec :: ReadPrec [GetStreamingSession]
readPrec :: ReadPrec GetStreamingSession
$creadPrec :: ReadPrec GetStreamingSession
readList :: ReadS [GetStreamingSession]
$creadList :: ReadS [GetStreamingSession]
readsPrec :: Int -> ReadS GetStreamingSession
$creadsPrec :: Int -> ReadS GetStreamingSession
Prelude.Read, Int -> GetStreamingSession -> ShowS
[GetStreamingSession] -> ShowS
GetStreamingSession -> String
(Int -> GetStreamingSession -> ShowS)
-> (GetStreamingSession -> String)
-> ([GetStreamingSession] -> ShowS)
-> Show GetStreamingSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamingSession] -> ShowS
$cshowList :: [GetStreamingSession] -> ShowS
show :: GetStreamingSession -> String
$cshow :: GetStreamingSession -> String
showsPrec :: Int -> GetStreamingSession -> ShowS
$cshowsPrec :: Int -> GetStreamingSession -> ShowS
Prelude.Show, (forall x. GetStreamingSession -> Rep GetStreamingSession x)
-> (forall x. Rep GetStreamingSession x -> GetStreamingSession)
-> Generic GetStreamingSession
forall x. Rep GetStreamingSession x -> GetStreamingSession
forall x. GetStreamingSession -> Rep GetStreamingSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStreamingSession x -> GetStreamingSession
$cfrom :: forall x. GetStreamingSession -> Rep GetStreamingSession x
Prelude.Generic)
newGetStreamingSession ::
Prelude.Text ->
Prelude.Text ->
GetStreamingSession
newGetStreamingSession :: Text -> Text -> GetStreamingSession
newGetStreamingSession Text
pStudioId_ Text
pSessionId_ =
GetStreamingSession' :: Text -> Text -> GetStreamingSession
GetStreamingSession'
{ $sel:studioId:GetStreamingSession' :: Text
studioId = Text
pStudioId_,
$sel:sessionId:GetStreamingSession' :: Text
sessionId = Text
pSessionId_
}
getStreamingSession_studioId :: Lens.Lens' GetStreamingSession Prelude.Text
getStreamingSession_studioId :: (Text -> f Text) -> GetStreamingSession -> f GetStreamingSession
getStreamingSession_studioId = (GetStreamingSession -> Text)
-> (GetStreamingSession -> Text -> GetStreamingSession)
-> Lens GetStreamingSession GetStreamingSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingSession' {Text
studioId :: Text
$sel:studioId:GetStreamingSession' :: GetStreamingSession -> Text
studioId} -> Text
studioId) (\s :: GetStreamingSession
s@GetStreamingSession' {} Text
a -> GetStreamingSession
s {$sel:studioId:GetStreamingSession' :: Text
studioId = Text
a} :: GetStreamingSession)
getStreamingSession_sessionId :: Lens.Lens' GetStreamingSession Prelude.Text
getStreamingSession_sessionId :: (Text -> f Text) -> GetStreamingSession -> f GetStreamingSession
getStreamingSession_sessionId = (GetStreamingSession -> Text)
-> (GetStreamingSession -> Text -> GetStreamingSession)
-> Lens GetStreamingSession GetStreamingSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingSession' {Text
sessionId :: Text
$sel:sessionId:GetStreamingSession' :: GetStreamingSession -> Text
sessionId} -> Text
sessionId) (\s :: GetStreamingSession
s@GetStreamingSession' {} Text
a -> GetStreamingSession
s {$sel:sessionId:GetStreamingSession' :: Text
sessionId = Text
a} :: GetStreamingSession)
instance Core.AWSRequest GetStreamingSession where
type
AWSResponse GetStreamingSession =
GetStreamingSessionResponse
request :: GetStreamingSession -> Request GetStreamingSession
request = Service -> GetStreamingSession -> Request GetStreamingSession
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetStreamingSession
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetStreamingSession)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStreamingSession))
-> Logger
-> Service
-> Proxy GetStreamingSession
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetStreamingSession)))
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 StreamingSession -> Int -> GetStreamingSessionResponse
GetStreamingSessionResponse'
(Maybe StreamingSession -> Int -> GetStreamingSessionResponse)
-> Either String (Maybe StreamingSession)
-> Either String (Int -> GetStreamingSessionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StreamingSession)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"session")
Either String (Int -> GetStreamingSessionResponse)
-> Either String Int -> Either String GetStreamingSessionResponse
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 GetStreamingSession
instance Prelude.NFData GetStreamingSession
instance Core.ToHeaders GetStreamingSession where
toHeaders :: GetStreamingSession -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStreamingSession -> 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 GetStreamingSession where
toPath :: GetStreamingSession -> ByteString
toPath GetStreamingSession' {Text
sessionId :: Text
studioId :: Text
$sel:sessionId:GetStreamingSession' :: GetStreamingSession -> Text
$sel:studioId:GetStreamingSession' :: GetStreamingSession -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-08-01/studios/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
ByteString
"/streaming-sessions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
sessionId
]
instance Core.ToQuery GetStreamingSession where
toQuery :: GetStreamingSession -> QueryString
toQuery = QueryString -> GetStreamingSession -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetStreamingSessionResponse = GetStreamingSessionResponse'
{
GetStreamingSessionResponse -> Maybe StreamingSession
session :: Prelude.Maybe StreamingSession,
GetStreamingSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStreamingSessionResponse -> GetStreamingSessionResponse -> Bool
(GetStreamingSessionResponse
-> GetStreamingSessionResponse -> Bool)
-> (GetStreamingSessionResponse
-> GetStreamingSessionResponse -> Bool)
-> Eq GetStreamingSessionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamingSessionResponse -> GetStreamingSessionResponse -> Bool
$c/= :: GetStreamingSessionResponse -> GetStreamingSessionResponse -> Bool
== :: GetStreamingSessionResponse -> GetStreamingSessionResponse -> Bool
$c== :: GetStreamingSessionResponse -> GetStreamingSessionResponse -> Bool
Prelude.Eq, ReadPrec [GetStreamingSessionResponse]
ReadPrec GetStreamingSessionResponse
Int -> ReadS GetStreamingSessionResponse
ReadS [GetStreamingSessionResponse]
(Int -> ReadS GetStreamingSessionResponse)
-> ReadS [GetStreamingSessionResponse]
-> ReadPrec GetStreamingSessionResponse
-> ReadPrec [GetStreamingSessionResponse]
-> Read GetStreamingSessionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStreamingSessionResponse]
$creadListPrec :: ReadPrec [GetStreamingSessionResponse]
readPrec :: ReadPrec GetStreamingSessionResponse
$creadPrec :: ReadPrec GetStreamingSessionResponse
readList :: ReadS [GetStreamingSessionResponse]
$creadList :: ReadS [GetStreamingSessionResponse]
readsPrec :: Int -> ReadS GetStreamingSessionResponse
$creadsPrec :: Int -> ReadS GetStreamingSessionResponse
Prelude.Read, Int -> GetStreamingSessionResponse -> ShowS
[GetStreamingSessionResponse] -> ShowS
GetStreamingSessionResponse -> String
(Int -> GetStreamingSessionResponse -> ShowS)
-> (GetStreamingSessionResponse -> String)
-> ([GetStreamingSessionResponse] -> ShowS)
-> Show GetStreamingSessionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamingSessionResponse] -> ShowS
$cshowList :: [GetStreamingSessionResponse] -> ShowS
show :: GetStreamingSessionResponse -> String
$cshow :: GetStreamingSessionResponse -> String
showsPrec :: Int -> GetStreamingSessionResponse -> ShowS
$cshowsPrec :: Int -> GetStreamingSessionResponse -> ShowS
Prelude.Show, (forall x.
GetStreamingSessionResponse -> Rep GetStreamingSessionResponse x)
-> (forall x.
Rep GetStreamingSessionResponse x -> GetStreamingSessionResponse)
-> Generic GetStreamingSessionResponse
forall x.
Rep GetStreamingSessionResponse x -> GetStreamingSessionResponse
forall x.
GetStreamingSessionResponse -> Rep GetStreamingSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetStreamingSessionResponse x -> GetStreamingSessionResponse
$cfrom :: forall x.
GetStreamingSessionResponse -> Rep GetStreamingSessionResponse x
Prelude.Generic)
newGetStreamingSessionResponse ::
Prelude.Int ->
GetStreamingSessionResponse
newGetStreamingSessionResponse :: Int -> GetStreamingSessionResponse
newGetStreamingSessionResponse Int
pHttpStatus_ =
GetStreamingSessionResponse' :: Maybe StreamingSession -> Int -> GetStreamingSessionResponse
GetStreamingSessionResponse'
{ $sel:session:GetStreamingSessionResponse' :: Maybe StreamingSession
session =
Maybe StreamingSession
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStreamingSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStreamingSessionResponse_session :: Lens.Lens' GetStreamingSessionResponse (Prelude.Maybe StreamingSession)
getStreamingSessionResponse_session :: (Maybe StreamingSession -> f (Maybe StreamingSession))
-> GetStreamingSessionResponse -> f GetStreamingSessionResponse
getStreamingSessionResponse_session = (GetStreamingSessionResponse -> Maybe StreamingSession)
-> (GetStreamingSessionResponse
-> Maybe StreamingSession -> GetStreamingSessionResponse)
-> Lens
GetStreamingSessionResponse
GetStreamingSessionResponse
(Maybe StreamingSession)
(Maybe StreamingSession)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingSessionResponse' {Maybe StreamingSession
session :: Maybe StreamingSession
$sel:session:GetStreamingSessionResponse' :: GetStreamingSessionResponse -> Maybe StreamingSession
session} -> Maybe StreamingSession
session) (\s :: GetStreamingSessionResponse
s@GetStreamingSessionResponse' {} Maybe StreamingSession
a -> GetStreamingSessionResponse
s {$sel:session:GetStreamingSessionResponse' :: Maybe StreamingSession
session = Maybe StreamingSession
a} :: GetStreamingSessionResponse)
getStreamingSessionResponse_httpStatus :: Lens.Lens' GetStreamingSessionResponse Prelude.Int
getStreamingSessionResponse_httpStatus :: (Int -> f Int)
-> GetStreamingSessionResponse -> f GetStreamingSessionResponse
getStreamingSessionResponse_httpStatus = (GetStreamingSessionResponse -> Int)
-> (GetStreamingSessionResponse
-> Int -> GetStreamingSessionResponse)
-> Lens
GetStreamingSessionResponse GetStreamingSessionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStreamingSessionResponse' :: GetStreamingSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStreamingSessionResponse
s@GetStreamingSessionResponse' {} Int
a -> GetStreamingSessionResponse
s {$sel:httpStatus:GetStreamingSessionResponse' :: Int
httpStatus = Int
a} :: GetStreamingSessionResponse)
instance Prelude.NFData GetStreamingSessionResponse