{-# 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_sessionId,
resumeSessionResponse_streamUrl,
resumeSessionResponse_tokenValue,
resumeSessionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:sessionId:ResumeSession' :: Text
sessionId = Text
pSessionId_}
resumeSession_sessionId :: Lens.Lens' ResumeSession Prelude.Text
resumeSession_sessionId :: Lens' ResumeSession Text
resumeSession_sessionId = 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 :: (Service -> Service) -> ResumeSession -> Request ResumeSession
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ResumeSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResumeSession)))
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 Text -> Maybe Text -> Int -> ResumeSessionResponse
ResumeSessionResponse'
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
"SessionId")
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
"StreamUrl")
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
"TokenValue")
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 ResumeSession where
hashWithSalt :: Int -> ResumeSession -> Int
hashWithSalt Int
_salt ResumeSession' {Text
sessionId :: Text
$sel:sessionId:ResumeSession' :: ResumeSession -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sessionId
instance Prelude.NFData ResumeSession where
rnf :: ResumeSession -> ()
rnf ResumeSession' {Text
sessionId :: Text
$sel:sessionId:ResumeSession' :: ResumeSession -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
sessionId
instance Data.ToHeaders ResumeSession where
toHeaders :: ResumeSession -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AmazonSSM.ResumeSession" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ResumeSession where
toJSON :: ResumeSession -> Value
toJSON ResumeSession' {Text
sessionId :: Text
$sel:sessionId:ResumeSession' :: ResumeSession -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"SessionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sessionId)]
)
instance Data.ToPath ResumeSession where
toPath :: ResumeSession -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ResumeSession where
toQuery :: ResumeSession -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ResumeSessionResponse = ResumeSessionResponse'
{
ResumeSessionResponse -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Maybe Text
streamUrl :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Maybe Text
tokenValue :: Prelude.Maybe Prelude.Text,
ResumeSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResumeSessionResponse -> ResumeSessionResponse -> Bool
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]
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
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. 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'
{ $sel:sessionId:ResumeSessionResponse' :: Maybe Text
sessionId = forall a. Maybe a
Prelude.Nothing,
$sel:streamUrl:ResumeSessionResponse' :: Maybe Text
streamUrl = forall a. Maybe a
Prelude.Nothing,
$sel:tokenValue:ResumeSessionResponse' :: Maybe Text
tokenValue = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResumeSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resumeSessionResponse_sessionId :: Lens.Lens' ResumeSessionResponse (Prelude.Maybe Prelude.Text)
resumeSessionResponse_sessionId :: Lens' ResumeSessionResponse (Maybe Text)
resumeSessionResponse_sessionId = 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_streamUrl :: Lens.Lens' ResumeSessionResponse (Prelude.Maybe Prelude.Text)
resumeSessionResponse_streamUrl :: Lens' ResumeSessionResponse (Maybe Text)
resumeSessionResponse_streamUrl = 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 :: Lens' ResumeSessionResponse (Maybe Text)
resumeSessionResponse_tokenValue = 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_httpStatus :: Lens.Lens' ResumeSessionResponse Prelude.Int
resumeSessionResponse_httpStatus :: Lens' ResumeSessionResponse Int
resumeSessionResponse_httpStatus = 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 where
rnf :: ResumeSessionResponse -> ()
rnf ResumeSessionResponse' {Int
Maybe Text
httpStatus :: Int
tokenValue :: Maybe Text
streamUrl :: Maybe Text
sessionId :: Maybe Text
$sel:httpStatus:ResumeSessionResponse' :: ResumeSessionResponse -> Int
$sel:tokenValue:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
$sel:streamUrl:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
$sel:sessionId:ResumeSessionResponse' :: ResumeSessionResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamUrl
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tokenValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus