{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSM.StartSession
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Initiates a connection to a target (for example, a managed node) for a
-- Session Manager session. Returns a URL and token that can be used to
-- open a WebSocket connection for sending input and receiving outputs.
--
-- Amazon Web Services CLI usage: @start-session@ is an interactive command
-- that requires the Session Manager plugin to be installed on the client
-- machine making the call. For information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html Install the Session Manager plugin for the Amazon Web Services CLI>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- Amazon Web Services Tools for PowerShell usage: Start-SSMSession isn\'t
-- currently supported by Amazon Web Services Tools for PowerShell on
-- Windows local machines.
module Amazonka.SSM.StartSession
  ( -- * Creating a Request
    StartSession (..),
    newStartSession,

    -- * Request Lenses
    startSession_documentName,
    startSession_parameters,
    startSession_reason,
    startSession_target,

    -- * Destructuring the Response
    StartSessionResponse (..),
    newStartSessionResponse,

    -- * Response Lenses
    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

-- | /See:/ 'newStartSession' smart constructor.
data StartSession = StartSession'
  { -- | The name of the SSM document you want to use to define the type of
    -- session, input parameters, or preferences for the session. For example,
    -- @SSM-SessionManagerRunShell@. You can call the GetDocument API to verify
    -- the document exists before attempting to start a session. If no document
    -- name is provided, a shell to the managed node is launched by default.
    -- For more information, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html Start a session>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    StartSession -> Maybe Text
documentName :: Prelude.Maybe Prelude.Text,
    -- | The values you want to specify for the parameters defined in the Session
    -- document.
    StartSession -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The reason for connecting to the instance. This value is included in the
    -- details for the Amazon CloudWatch Events event created when you start
    -- the session.
    StartSession -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The managed node to connect to for the session.
    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)

-- |
-- Create a value of 'StartSession' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'documentName', 'startSession_documentName' - The name of the SSM document you want to use to define the type of
-- session, input parameters, or preferences for the session. For example,
-- @SSM-SessionManagerRunShell@. You can call the GetDocument API to verify
-- the document exists before attempting to start a session. If no document
-- name is provided, a shell to the managed node is launched by default.
-- For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html Start a session>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'parameters', 'startSession_parameters' - The values you want to specify for the parameters defined in the Session
-- document.
--
-- 'reason', 'startSession_reason' - The reason for connecting to the instance. This value is included in the
-- details for the Amazon CloudWatch Events event created when you start
-- the session.
--
-- 'target', 'startSession_target' - The managed node to connect to for the session.
newStartSession ::
  -- | 'target'
  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_
    }

-- | The name of the SSM document you want to use to define the type of
-- session, input parameters, or preferences for the session. For example,
-- @SSM-SessionManagerRunShell@. You can call the GetDocument API to verify
-- the document exists before attempting to start a session. If no document
-- name is provided, a shell to the managed node is launched by default.
-- For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html Start a session>
-- in the /Amazon Web Services Systems Manager User Guide/.
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)

-- | The values you want to specify for the parameters defined in the Session
-- document.
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

-- | The reason for connecting to the instance. This value is included in the
-- details for the Amazon CloudWatch Events event created when you start
-- the session.
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)

-- | The managed node to connect to for the session.
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

-- | /See:/ 'newStartSessionResponse' smart constructor.
data StartSessionResponse = StartSessionResponse'
  { -- | The ID of the session.
    StartSessionResponse -> Maybe Text
sessionId :: Prelude.Maybe Prelude.Text,
    -- | A URL back to SSM Agent on the managed node that the Session Manager
    -- client uses to send commands and receive output from the node. Format:
    -- @wss:\/\/ssmmessages.@__@region@__@.amazonaws.com\/v1\/data-channel\/@__@session-id@__@?stream=(input|output)@
    --
    -- __region__ represents the Region identifier for an Amazon Web Services
    -- Region supported by Amazon Web Services Systems Manager, such as
    -- @us-east-2@ for the US East (Ohio) Region. For a list of supported
    -- __region__ values, see the __Region__ column in
    -- <https://docs.aws.amazon.com/general/latest/gr/ssm.html#ssm_region Systems Manager service endpoints>
    -- in the /Amazon Web Services General Reference/.
    --
    -- __session-id__ represents the ID of a Session Manager session, such as
    -- @1a2b3c4dEXAMPLE@.
    StartSessionResponse -> Maybe Text
streamUrl :: Prelude.Maybe Prelude.Text,
    -- | An encrypted token value containing session and caller information. This
    -- token is used to authenticate the connection to the managed node, and is
    -- valid only long enough to ensure the connection is successful. Never
    -- share your session\'s token.
    StartSessionResponse -> Maybe Text
tokenValue :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'StartSessionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'sessionId', 'startSessionResponse_sessionId' - The ID of the session.
--
-- 'streamUrl', 'startSessionResponse_streamUrl' - A URL back to SSM Agent on the managed node that the Session Manager
-- client uses to send commands and receive output from the node. Format:
-- @wss:\/\/ssmmessages.@__@region@__@.amazonaws.com\/v1\/data-channel\/@__@session-id@__@?stream=(input|output)@
--
-- __region__ represents the Region identifier for an Amazon Web Services
-- Region supported by Amazon Web Services Systems Manager, such as
-- @us-east-2@ for the US East (Ohio) Region. For a list of supported
-- __region__ values, see the __Region__ column in
-- <https://docs.aws.amazon.com/general/latest/gr/ssm.html#ssm_region Systems Manager service endpoints>
-- in the /Amazon Web Services General Reference/.
--
-- __session-id__ represents the ID of a Session Manager session, such as
-- @1a2b3c4dEXAMPLE@.
--
-- 'tokenValue', 'startSessionResponse_tokenValue' - An encrypted token value containing session and caller information. This
-- token is used to authenticate the connection to the managed node, and is
-- valid only long enough to ensure the connection is successful. Never
-- share your session\'s token.
--
-- 'httpStatus', 'startSessionResponse_httpStatus' - The response's http status code.
newStartSessionResponse ::
  -- | 'httpStatus'
  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_
    }

-- | The ID of the session.
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)

-- | A URL back to SSM Agent on the managed node that the Session Manager
-- client uses to send commands and receive output from the node. Format:
-- @wss:\/\/ssmmessages.@__@region@__@.amazonaws.com\/v1\/data-channel\/@__@session-id@__@?stream=(input|output)@
--
-- __region__ represents the Region identifier for an Amazon Web Services
-- Region supported by Amazon Web Services Systems Manager, such as
-- @us-east-2@ for the US East (Ohio) Region. For a list of supported
-- __region__ values, see the __Region__ column in
-- <https://docs.aws.amazon.com/general/latest/gr/ssm.html#ssm_region Systems Manager service endpoints>
-- in the /Amazon Web Services General Reference/.
--
-- __session-id__ represents the ID of a Session Manager session, such as
-- @1a2b3c4dEXAMPLE@.
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)

-- | An encrypted token value containing session and caller information. This
-- token is used to authenticate the connection to the managed node, and is
-- valid only long enough to ensure the connection is successful. Never
-- share your session\'s token.
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)

-- | The response's http status code.
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