{-# 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.StartSession
(
StartSession (..),
newStartSession,
startSession_documentName,
startSession_parameters,
startSession_reason,
startSession_target,
StartSessionResponse (..),
newStartSessionResponse,
startSessionResponse_sessionId,
startSessionResponse_streamUrl,
startSessionResponse_tokenValue,
startSessionResponse_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 StartSession = StartSession'
{
StartSession -> Maybe Text
documentName :: Prelude.Maybe Prelude.Text,
StartSession -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
StartSession -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
StartSession -> Text
target :: Prelude.Text
}
deriving (StartSession -> StartSession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSession -> StartSession -> Bool
$c/= :: StartSession -> StartSession -> Bool
== :: StartSession -> StartSession -> Bool
$c== :: StartSession -> StartSession -> Bool
Prelude.Eq, ReadPrec [StartSession]
ReadPrec StartSession
Int -> ReadS StartSession
ReadS [StartSession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSession]
$creadListPrec :: ReadPrec [StartSession]
readPrec :: ReadPrec StartSession
$creadPrec :: ReadPrec StartSession
readList :: ReadS [StartSession]
$creadList :: ReadS [StartSession]
readsPrec :: Int -> ReadS StartSession
$creadsPrec :: Int -> ReadS StartSession
Prelude.Read, Int -> StartSession -> ShowS
[StartSession] -> ShowS
StartSession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSession] -> ShowS
$cshowList :: [StartSession] -> ShowS
show :: StartSession -> String
$cshow :: StartSession -> String
showsPrec :: Int -> StartSession -> ShowS
$cshowsPrec :: Int -> StartSession -> ShowS
Prelude.Show, forall x. Rep StartSession x -> StartSession
forall x. StartSession -> Rep StartSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSession x -> StartSession
$cfrom :: forall x. StartSession -> Rep StartSession x
Prelude.Generic)
newStartSession ::
Prelude.Text ->
StartSession
newStartSession :: Text -> StartSession
newStartSession Text
pTarget_ =
StartSession'
{ $sel:documentName:StartSession' :: Maybe Text
documentName = forall a. Maybe a
Prelude.Nothing,
$sel:parameters:StartSession' :: Maybe (HashMap Text [Text])
parameters = forall a. Maybe a
Prelude.Nothing,
$sel:reason:StartSession' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing,
$sel:target:StartSession' :: Text
target = Text
pTarget_
}
startSession_documentName :: Lens.Lens' StartSession (Prelude.Maybe Prelude.Text)
startSession_documentName :: Lens' StartSession (Maybe Text)
startSession_documentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSession' {Maybe Text
documentName :: Maybe Text
$sel:documentName:StartSession' :: StartSession -> Maybe Text
documentName} -> Maybe Text
documentName) (\s :: StartSession
s@StartSession' {} Maybe Text
a -> StartSession
s {$sel:documentName:StartSession' :: Maybe Text
documentName = Maybe Text
a} :: StartSession)
startSession_parameters :: Lens.Lens' StartSession (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
startSession_parameters :: Lens' StartSession (Maybe (HashMap Text [Text]))
startSession_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSession' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:StartSession' :: StartSession -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: StartSession
s@StartSession' {} Maybe (HashMap Text [Text])
a -> StartSession
s {$sel:parameters:StartSession' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: StartSession) 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
startSession_reason :: Lens.Lens' StartSession (Prelude.Maybe Prelude.Text)
startSession_reason :: Lens' StartSession (Maybe Text)
startSession_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSession' {Maybe Text
reason :: Maybe Text
$sel:reason:StartSession' :: StartSession -> Maybe Text
reason} -> Maybe Text
reason) (\s :: StartSession
s@StartSession' {} Maybe Text
a -> StartSession
s {$sel:reason:StartSession' :: Maybe Text
reason = Maybe Text
a} :: StartSession)
startSession_target :: Lens.Lens' StartSession Prelude.Text
startSession_target :: Lens' StartSession Text
startSession_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSession' {Text
target :: Text
$sel:target:StartSession' :: StartSession -> Text
target} -> Text
target) (\s :: StartSession
s@StartSession' {} Text
a -> StartSession
s {$sel:target:StartSession' :: Text
target = Text
a} :: StartSession)
instance Core.AWSRequest StartSession where
type AWSResponse StartSession = StartSessionResponse
request :: (Service -> Service) -> StartSession -> Request StartSession
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 StartSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartSession)))
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 -> StartSessionResponse
StartSessionResponse'
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 StartSession where
hashWithSalt :: Int -> StartSession -> Int
hashWithSalt Int
_salt StartSession' {Maybe Text
Maybe (HashMap Text [Text])
Text
target :: Text
reason :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
documentName :: Maybe Text
$sel:target:StartSession' :: StartSession -> Text
$sel:reason:StartSession' :: StartSession -> Maybe Text
$sel:parameters:StartSession' :: StartSession -> Maybe (HashMap Text [Text])
$sel:documentName:StartSession' :: StartSession -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text [Text])
parameters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
target
instance Prelude.NFData StartSession where
rnf :: StartSession -> ()
rnf StartSession' {Maybe Text
Maybe (HashMap Text [Text])
Text
target :: Text
reason :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
documentName :: Maybe Text
$sel:target:StartSession' :: StartSession -> Text
$sel:reason:StartSession' :: StartSession -> Maybe Text
$sel:parameters:StartSession' :: StartSession -> Maybe (HashMap Text [Text])
$sel:documentName:StartSession' :: StartSession -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text [Text])
parameters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
target
instance Data.ToHeaders StartSession where
toHeaders :: StartSession -> 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.StartSession" :: 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 StartSession where
toJSON :: StartSession -> Value
toJSON StartSession' {Maybe Text
Maybe (HashMap Text [Text])
Text
target :: Text
reason :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
documentName :: Maybe Text
$sel:target:StartSession' :: StartSession -> Text
$sel:reason:StartSession' :: StartSession -> Maybe Text
$sel:parameters:StartSession' :: StartSession -> Maybe (HashMap Text [Text])
$sel:documentName:StartSession' :: StartSession -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DocumentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentName,
(Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
parameters,
(Key
"Reason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
reason,
forall a. a -> Maybe a
Prelude.Just (Key
"Target" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
target)
]
)
instance Data.ToPath StartSession where
toPath :: StartSession -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartSession where
toQuery :: StartSession -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartSessionResponse = StartSessionResponse'
{
StartSessionResponse -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Maybe Text
streamUrl :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Maybe Text
tokenValue :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartSessionResponse -> StartSessionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSessionResponse -> StartSessionResponse -> Bool
$c/= :: StartSessionResponse -> StartSessionResponse -> Bool
== :: StartSessionResponse -> StartSessionResponse -> Bool
$c== :: StartSessionResponse -> StartSessionResponse -> Bool
Prelude.Eq, ReadPrec [StartSessionResponse]
ReadPrec StartSessionResponse
Int -> ReadS StartSessionResponse
ReadS [StartSessionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSessionResponse]
$creadListPrec :: ReadPrec [StartSessionResponse]
readPrec :: ReadPrec StartSessionResponse
$creadPrec :: ReadPrec StartSessionResponse
readList :: ReadS [StartSessionResponse]
$creadList :: ReadS [StartSessionResponse]
readsPrec :: Int -> ReadS StartSessionResponse
$creadsPrec :: Int -> ReadS StartSessionResponse
Prelude.Read, Int -> StartSessionResponse -> ShowS
[StartSessionResponse] -> ShowS
StartSessionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSessionResponse] -> ShowS
$cshowList :: [StartSessionResponse] -> ShowS
show :: StartSessionResponse -> String
$cshow :: StartSessionResponse -> String
showsPrec :: Int -> StartSessionResponse -> ShowS
$cshowsPrec :: Int -> StartSessionResponse -> ShowS
Prelude.Show, forall x. Rep StartSessionResponse x -> StartSessionResponse
forall x. StartSessionResponse -> Rep StartSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSessionResponse x -> StartSessionResponse
$cfrom :: forall x. StartSessionResponse -> Rep StartSessionResponse x
Prelude.Generic)
newStartSessionResponse ::
Prelude.Int ->
StartSessionResponse
newStartSessionResponse :: Int -> StartSessionResponse
newStartSessionResponse Int
pHttpStatus_ =
StartSessionResponse'
{ $sel:sessionId:StartSessionResponse' :: Maybe Text
sessionId = forall a. Maybe a
Prelude.Nothing,
$sel:streamUrl:StartSessionResponse' :: Maybe Text
streamUrl = forall a. Maybe a
Prelude.Nothing,
$sel:tokenValue:StartSessionResponse' :: Maybe Text
tokenValue = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startSessionResponse_sessionId :: Lens.Lens' StartSessionResponse (Prelude.Maybe Prelude.Text)
startSessionResponse_sessionId :: Lens' StartSessionResponse (Maybe Text)
startSessionResponse_sessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResponse' {Maybe Text
sessionId :: Maybe Text
$sel:sessionId:StartSessionResponse' :: StartSessionResponse -> Maybe Text
sessionId} -> Maybe Text
sessionId) (\s :: StartSessionResponse
s@StartSessionResponse' {} Maybe Text
a -> StartSessionResponse
s {$sel:sessionId:StartSessionResponse' :: Maybe Text
sessionId = Maybe Text
a} :: StartSessionResponse)
startSessionResponse_streamUrl :: Lens.Lens' StartSessionResponse (Prelude.Maybe Prelude.Text)
startSessionResponse_streamUrl :: Lens' StartSessionResponse (Maybe Text)
startSessionResponse_streamUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResponse' {Maybe Text
streamUrl :: Maybe Text
$sel:streamUrl:StartSessionResponse' :: StartSessionResponse -> Maybe Text
streamUrl} -> Maybe Text
streamUrl) (\s :: StartSessionResponse
s@StartSessionResponse' {} Maybe Text
a -> StartSessionResponse
s {$sel:streamUrl:StartSessionResponse' :: Maybe Text
streamUrl = Maybe Text
a} :: StartSessionResponse)
startSessionResponse_tokenValue :: Lens.Lens' StartSessionResponse (Prelude.Maybe Prelude.Text)
startSessionResponse_tokenValue :: Lens' StartSessionResponse (Maybe Text)
startSessionResponse_tokenValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResponse' {Maybe Text
tokenValue :: Maybe Text
$sel:tokenValue:StartSessionResponse' :: StartSessionResponse -> Maybe Text
tokenValue} -> Maybe Text
tokenValue) (\s :: StartSessionResponse
s@StartSessionResponse' {} Maybe Text
a -> StartSessionResponse
s {$sel:tokenValue:StartSessionResponse' :: Maybe Text
tokenValue = Maybe Text
a} :: StartSessionResponse)
startSessionResponse_httpStatus :: Lens.Lens' StartSessionResponse Prelude.Int
startSessionResponse_httpStatus :: Lens' StartSessionResponse Int
startSessionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartSessionResponse' :: StartSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartSessionResponse
s@StartSessionResponse' {} Int
a -> StartSessionResponse
s {$sel:httpStatus:StartSessionResponse' :: Int
httpStatus = Int
a} :: StartSessionResponse)
instance Prelude.NFData StartSessionResponse where
rnf :: StartSessionResponse -> ()
rnf StartSessionResponse' {Int
Maybe Text
httpStatus :: Int
tokenValue :: Maybe Text
streamUrl :: Maybe Text
sessionId :: Maybe Text
$sel:httpStatus:StartSessionResponse' :: StartSessionResponse -> Int
$sel:tokenValue:StartSessionResponse' :: StartSessionResponse -> Maybe Text
$sel:streamUrl:StartSessionResponse' :: StartSessionResponse -> Maybe Text
$sel:sessionId:StartSessionResponse' :: StartSessionResponse -> 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