{-# 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.SSM.ResumeSession
(
ResumeSession (..),
newResumeSession,
resumeSession_sessionId,
ResumeSessionResponse (..),
newResumeSessionResponse,
resumeSessionResponse_streamUrl,
resumeSessionResponse_tokenValue,
resumeSessionResponse_sessionId,
resumeSessionResponse_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.SSM.Types
data ResumeSession = ResumeSession'
{
ResumeSession -> Text
sessionId :: Prelude.Text
}
deriving (ResumeSession -> ResumeSession -> Bool
(ResumeSession -> ResumeSession -> Bool)
-> (ResumeSession -> ResumeSession -> Bool) -> Eq ResumeSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResumeSession -> ResumeSession -> Bool
$c/= :: ResumeSession -> ResumeSession -> Bool
== :: ResumeSession -> ResumeSession -> Bool
$c== :: ResumeSession -> ResumeSession -> Bool
Prelude.Eq, ReadPrec [ResumeSession]
ReadPrec ResumeSession
Int -> ReadS ResumeSession
ReadS [ResumeSession]
(Int -> ReadS ResumeSession)
-> ReadS [ResumeSession]
-> ReadPrec ResumeSession
-> ReadPrec [ResumeSession]
-> Read ResumeSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResumeSession]
$creadListPrec :: ReadPrec [ResumeSession]
readPrec :: ReadPrec ResumeSession
$creadPrec :: ReadPrec ResumeSession
readList :: ReadS [ResumeSession]
$creadList :: ReadS [ResumeSession]
readsPrec :: Int -> ReadS ResumeSession
$creadsPrec :: Int -> ReadS ResumeSession
Prelude.Read, Int -> ResumeSession -> ShowS
[ResumeSession] -> ShowS
ResumeSession -> String
(Int -> ResumeSession -> ShowS)
-> (ResumeSession -> String)
-> ([ResumeSession] -> ShowS)
-> Show ResumeSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResumeSession] -> ShowS
$cshowList :: [ResumeSession] -> ShowS
show :: ResumeSession -> String
$cshow :: ResumeSession -> String
showsPrec :: Int -> ResumeSession -> ShowS
$cshowsPrec :: Int -> ResumeSession -> ShowS
Prelude.Show, (forall x. ResumeSession -> Rep ResumeSession x)
-> (forall x. Rep ResumeSession x -> ResumeSession)
-> Generic ResumeSession
forall x. Rep ResumeSession x -> ResumeSession
forall x. ResumeSession -> Rep ResumeSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResumeSession x -> ResumeSession
$cfrom :: forall x. ResumeSession -> Rep ResumeSession x
Prelude.Generic)
newResumeSession ::
Prelude.Text ->
ResumeSession
newResumeSession :: Text -> ResumeSession
newResumeSession Text
pSessionId_ =
ResumeSession' :: Text -> ResumeSession
ResumeSession' {$sel:sessionId:ResumeSession' :: Text
sessionId = Text
pSessionId_}
resumeSession_sessionId :: Lens.Lens' ResumeSession Prelude.Text
resumeSession_sessionId :: (Text -> f Text) -> ResumeSession -> f ResumeSession
resumeSession_sessionId = (ResumeSession -> Text)
-> (ResumeSession -> Text -> ResumeSession)
-> Lens ResumeSession ResumeSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeSession' {Text
sessionId :: Text
$sel:sessionId:ResumeSession' :: ResumeSession -> Text
sessionId} -> Text
sessionId) (\s :: ResumeSession
s@ResumeSession' {} Text
a -> ResumeSession
s {$sel:sessionId:ResumeSession' :: Text
sessionId = Text
a} :: ResumeSession)
instance Core.AWSRequest ResumeSession where
type
AWSResponse ResumeSession =
ResumeSessionResponse
request :: ResumeSession -> Request ResumeSession
request = Service -> ResumeSession -> Request ResumeSession
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResumeSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResumeSession)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResumeSession))
-> Logger
-> Service
-> Proxy ResumeSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResumeSession)))
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 Text -> Maybe Text -> Int -> ResumeSessionResponse
ResumeSessionResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ResumeSessionResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> ResumeSessionResponse)
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
"StreamUrl")
Either
String (Maybe Text -> Maybe Text -> Int -> ResumeSessionResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ResumeSessionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"TokenValue")
Either String (Maybe Text -> Int -> ResumeSessionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResumeSessionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"SessionId")
Either String (Int -> ResumeSessionResponse)
-> Either String Int -> Either String ResumeSessionResponse
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 ResumeSession
instance Prelude.NFData ResumeSession
instance Core.ToHeaders ResumeSession where
toHeaders :: ResumeSession -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResumeSession -> 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
"AmazonSSM.ResumeSession" :: 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 ResumeSession where
toJSON :: ResumeSession -> Value
toJSON ResumeSession' {Text
sessionId :: Text
$sel:sessionId:ResumeSession' :: ResumeSession -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SessionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sessionId)]
)
instance Core.ToPath ResumeSession where
toPath :: ResumeSession -> ByteString
toPath = ByteString -> ResumeSession -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResumeSession where
toQuery :: ResumeSession -> QueryString
toQuery = QueryString -> ResumeSession -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResumeSessionResponse = ResumeSessionResponse'
{
ResumeSessionResponse -> Maybe Text
streamUrl :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Maybe Text
tokenValue :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResumeSessionResponse -> ResumeSessionResponse -> Bool
(ResumeSessionResponse -> ResumeSessionResponse -> Bool)
-> (ResumeSessionResponse -> ResumeSessionResponse -> Bool)
-> Eq ResumeSessionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResumeSessionResponse -> ResumeSessionResponse -> Bool
$c/= :: ResumeSessionResponse -> ResumeSessionResponse -> Bool
== :: ResumeSessionResponse -> ResumeSessionResponse -> Bool
$c== :: ResumeSessionResponse -> ResumeSessionResponse -> Bool
Prelude.Eq, ReadPrec [ResumeSessionResponse]
ReadPrec ResumeSessionResponse
Int -> ReadS ResumeSessionResponse
ReadS [ResumeSessionResponse]
(Int -> ReadS ResumeSessionResponse)
-> ReadS [ResumeSessionResponse]
-> ReadPrec ResumeSessionResponse
-> ReadPrec [ResumeSessionResponse]
-> Read ResumeSessionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResumeSessionResponse]
$creadListPrec :: ReadPrec [ResumeSessionResponse]
readPrec :: ReadPrec ResumeSessionResponse
$creadPrec :: ReadPrec ResumeSessionResponse
readList :: ReadS [ResumeSessionResponse]
$creadList :: ReadS [ResumeSessionResponse]
readsPrec :: Int -> ReadS ResumeSessionResponse
$creadsPrec :: Int -> ReadS ResumeSessionResponse
Prelude.Read, Int -> ResumeSessionResponse -> ShowS
[ResumeSessionResponse] -> ShowS
ResumeSessionResponse -> String
(Int -> ResumeSessionResponse -> ShowS)
-> (ResumeSessionResponse -> String)
-> ([ResumeSessionResponse] -> ShowS)
-> Show ResumeSessionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResumeSessionResponse] -> ShowS
$cshowList :: [ResumeSessionResponse] -> ShowS
show :: ResumeSessionResponse -> String
$cshow :: ResumeSessionResponse -> String
showsPrec :: Int -> ResumeSessionResponse -> ShowS
$cshowsPrec :: Int -> ResumeSessionResponse -> ShowS
Prelude.Show, (forall x. ResumeSessionResponse -> Rep ResumeSessionResponse x)
-> (forall x. Rep ResumeSessionResponse x -> ResumeSessionResponse)
-> Generic ResumeSessionResponse
forall x. Rep ResumeSessionResponse x -> ResumeSessionResponse
forall x. ResumeSessionResponse -> Rep ResumeSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResumeSessionResponse x -> ResumeSessionResponse
$cfrom :: forall x. ResumeSessionResponse -> Rep ResumeSessionResponse x
Prelude.Generic)
newResumeSessionResponse ::
Prelude.Int ->
ResumeSessionResponse
newResumeSessionResponse :: Int -> ResumeSessionResponse
newResumeSessionResponse Int
pHttpStatus_ =
ResumeSessionResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ResumeSessionResponse
ResumeSessionResponse'
{ $sel:streamUrl:ResumeSessionResponse' :: Maybe Text
streamUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tokenValue:ResumeSessionResponse' :: Maybe Text
tokenValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sessionId:ResumeSessionResponse' :: Maybe Text
sessionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResumeSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resumeSessionResponse_streamUrl :: Lens.Lens' ResumeSessionResponse (Prelude.Maybe Prelude.Text)
resumeSessionResponse_streamUrl :: (Maybe Text -> f (Maybe Text))
-> ResumeSessionResponse -> f ResumeSessionResponse
resumeSessionResponse_streamUrl = (ResumeSessionResponse -> Maybe Text)
-> (ResumeSessionResponse -> Maybe Text -> ResumeSessionResponse)
-> Lens
ResumeSessionResponse
ResumeSessionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeSessionResponse' {Maybe Text
streamUrl :: Maybe Text
$sel:streamUrl:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
streamUrl} -> Maybe Text
streamUrl) (\s :: ResumeSessionResponse
s@ResumeSessionResponse' {} Maybe Text
a -> ResumeSessionResponse
s {$sel:streamUrl:ResumeSessionResponse' :: Maybe Text
streamUrl = Maybe Text
a} :: ResumeSessionResponse)
resumeSessionResponse_tokenValue :: Lens.Lens' ResumeSessionResponse (Prelude.Maybe Prelude.Text)
resumeSessionResponse_tokenValue :: (Maybe Text -> f (Maybe Text))
-> ResumeSessionResponse -> f ResumeSessionResponse
resumeSessionResponse_tokenValue = (ResumeSessionResponse -> Maybe Text)
-> (ResumeSessionResponse -> Maybe Text -> ResumeSessionResponse)
-> Lens
ResumeSessionResponse
ResumeSessionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeSessionResponse' {Maybe Text
tokenValue :: Maybe Text
$sel:tokenValue:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
tokenValue} -> Maybe Text
tokenValue) (\s :: ResumeSessionResponse
s@ResumeSessionResponse' {} Maybe Text
a -> ResumeSessionResponse
s {$sel:tokenValue:ResumeSessionResponse' :: Maybe Text
tokenValue = Maybe Text
a} :: ResumeSessionResponse)
resumeSessionResponse_sessionId :: Lens.Lens' ResumeSessionResponse (Prelude.Maybe Prelude.Text)
resumeSessionResponse_sessionId :: (Maybe Text -> f (Maybe Text))
-> ResumeSessionResponse -> f ResumeSessionResponse
resumeSessionResponse_sessionId = (ResumeSessionResponse -> Maybe Text)
-> (ResumeSessionResponse -> Maybe Text -> ResumeSessionResponse)
-> Lens
ResumeSessionResponse
ResumeSessionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeSessionResponse' {Maybe Text
sessionId :: Maybe Text
$sel:sessionId:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
sessionId} -> Maybe Text
sessionId) (\s :: ResumeSessionResponse
s@ResumeSessionResponse' {} Maybe Text
a -> ResumeSessionResponse
s {$sel:sessionId:ResumeSessionResponse' :: Maybe Text
sessionId = Maybe Text
a} :: ResumeSessionResponse)
resumeSessionResponse_httpStatus :: Lens.Lens' ResumeSessionResponse Prelude.Int
resumeSessionResponse_httpStatus :: (Int -> f Int) -> ResumeSessionResponse -> f ResumeSessionResponse
resumeSessionResponse_httpStatus = (ResumeSessionResponse -> Int)
-> (ResumeSessionResponse -> Int -> ResumeSessionResponse)
-> Lens ResumeSessionResponse ResumeSessionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResumeSessionResponse' :: ResumeSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResumeSessionResponse
s@ResumeSessionResponse' {} Int
a -> ResumeSessionResponse
s {$sel:httpStatus:ResumeSessionResponse' :: Int
httpStatus = Int
a} :: ResumeSessionResponse)
instance Prelude.NFData ResumeSessionResponse