{-# 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_target,
StartSessionResponse (..),
newStartSessionResponse,
startSessionResponse_streamUrl,
startSessionResponse_tokenValue,
startSessionResponse_sessionId,
startSessionResponse_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 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 -> Text
target :: Prelude.Text
}
deriving (StartSession -> StartSession -> Bool
(StartSession -> StartSession -> Bool)
-> (StartSession -> StartSession -> Bool) -> Eq StartSession
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]
(Int -> ReadS StartSession)
-> ReadS [StartSession]
-> ReadPrec StartSession
-> ReadPrec [StartSession]
-> Read 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
(Int -> StartSession -> ShowS)
-> (StartSession -> String)
-> ([StartSession] -> ShowS)
-> Show StartSession
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. StartSession -> Rep StartSession x)
-> (forall x. Rep StartSession x -> StartSession)
-> Generic StartSession
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' :: Maybe Text -> Maybe (HashMap Text [Text]) -> Text -> StartSession
StartSession'
{ $sel:documentName:StartSession' :: Maybe Text
documentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:StartSession' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:target:StartSession' :: Text
target = Text
pTarget_
}
startSession_documentName :: Lens.Lens' StartSession (Prelude.Maybe Prelude.Text)
startSession_documentName :: (Maybe Text -> f (Maybe Text)) -> StartSession -> f StartSession
startSession_documentName = (StartSession -> Maybe Text)
-> (StartSession -> Maybe Text -> StartSession)
-> Lens StartSession StartSession (Maybe Text) (Maybe Text)
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 :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> StartSession -> f StartSession
startSession_parameters = (StartSession -> Maybe (HashMap Text [Text]))
-> (StartSession -> Maybe (HashMap Text [Text]) -> StartSession)
-> Lens
StartSession
StartSession
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
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) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> StartSession -> f StartSession)
-> ((Maybe (HashMap Text [Text])
-> f (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> StartSession
-> f StartSession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
-> Iso
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
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 AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startSession_target :: Lens.Lens' StartSession Prelude.Text
startSession_target :: (Text -> f Text) -> StartSession -> f StartSession
startSession_target = (StartSession -> Text)
-> (StartSession -> Text -> StartSession)
-> Lens StartSession StartSession Text Text
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 :: StartSession -> Request StartSession
request = Service -> StartSession -> Request StartSession
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartSession)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartSession))
-> Logger
-> Service
-> Proxy StartSession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartSession)))
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 -> StartSessionResponse
StartSessionResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> StartSessionResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> StartSessionResponse)
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 -> StartSessionResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> StartSessionResponse)
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 -> StartSessionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartSessionResponse)
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 -> StartSessionResponse)
-> Either String Int -> Either String StartSessionResponse
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 StartSession
instance Prelude.NFData StartSession
instance Core.ToHeaders StartSession where
toHeaders :: StartSession -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartSession -> 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.StartSession" :: 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 StartSession where
toJSON :: StartSession -> Value
toJSON StartSession' {Maybe Text
Maybe (HashMap Text [Text])
Text
target :: Text
parameters :: Maybe (HashMap Text [Text])
documentName :: Maybe Text
$sel:target:StartSession' :: StartSession -> Text
$sel:parameters:StartSession' :: StartSession -> Maybe (HashMap Text [Text])
$sel:documentName:StartSession' :: StartSession -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DocumentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentName,
(Text
"Parameters" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
parameters,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Target" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
target)
]
)
instance Core.ToPath StartSession where
toPath :: StartSession -> ByteString
toPath = ByteString -> StartSession -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartSession where
toQuery :: StartSession -> QueryString
toQuery = QueryString -> StartSession -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartSessionResponse = StartSessionResponse'
{
StartSessionResponse -> Maybe Text
streamUrl :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Maybe Text
tokenValue :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text,
StartSessionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartSessionResponse -> StartSessionResponse -> Bool
(StartSessionResponse -> StartSessionResponse -> Bool)
-> (StartSessionResponse -> StartSessionResponse -> Bool)
-> Eq StartSessionResponse
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]
(Int -> ReadS StartSessionResponse)
-> ReadS [StartSessionResponse]
-> ReadPrec StartSessionResponse
-> ReadPrec [StartSessionResponse]
-> Read 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
(Int -> StartSessionResponse -> ShowS)
-> (StartSessionResponse -> String)
-> ([StartSessionResponse] -> ShowS)
-> Show StartSessionResponse
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. StartSessionResponse -> Rep StartSessionResponse x)
-> (forall x. Rep StartSessionResponse x -> StartSessionResponse)
-> Generic StartSessionResponse
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' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> StartSessionResponse
StartSessionResponse'
{ $sel:streamUrl:StartSessionResponse' :: Maybe Text
streamUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tokenValue:StartSessionResponse' :: Maybe Text
tokenValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sessionId:StartSessionResponse' :: Maybe Text
sessionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startSessionResponse_streamUrl :: Lens.Lens' StartSessionResponse (Prelude.Maybe Prelude.Text)
startSessionResponse_streamUrl :: (Maybe Text -> f (Maybe Text))
-> StartSessionResponse -> f StartSessionResponse
startSessionResponse_streamUrl = (StartSessionResponse -> Maybe Text)
-> (StartSessionResponse -> Maybe Text -> StartSessionResponse)
-> Lens
StartSessionResponse StartSessionResponse (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> StartSessionResponse -> f StartSessionResponse
startSessionResponse_tokenValue = (StartSessionResponse -> Maybe Text)
-> (StartSessionResponse -> Maybe Text -> StartSessionResponse)
-> Lens
StartSessionResponse StartSessionResponse (Maybe Text) (Maybe Text)
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_sessionId :: Lens.Lens' StartSessionResponse (Prelude.Maybe Prelude.Text)
startSessionResponse_sessionId :: (Maybe Text -> f (Maybe Text))
-> StartSessionResponse -> f StartSessionResponse
startSessionResponse_sessionId = (StartSessionResponse -> Maybe Text)
-> (StartSessionResponse -> Maybe Text -> StartSessionResponse)
-> Lens
StartSessionResponse StartSessionResponse (Maybe Text) (Maybe Text)
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_httpStatus :: Lens.Lens' StartSessionResponse Prelude.Int
startSessionResponse_httpStatus :: (Int -> f Int) -> StartSessionResponse -> f StartSessionResponse
startSessionResponse_httpStatus = (StartSessionResponse -> Int)
-> (StartSessionResponse -> Int -> StartSessionResponse)
-> Lens StartSessionResponse StartSessionResponse Int Int
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