session

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package session starts the session.

Package session starts the session.

Index

Constants

View Source
const (
	LegacyArgumentLength  = 4
	ArgumentLength        = 7
	StartSessionOperation = "StartSession"
	VersionFile           = "VERSION"
)

Variables

View Source
var SessionRegistry = map[string]ISessionPlugin{}

Functions

func Register

func Register(session ISessionPlugin)

func ValidateInputAndStartSession

func ValidateInputAndStartSession(args []string, out io.Writer)

ValidateInputAndStartSession validates input sent from AWS CLI and starts a session if validation is successful. AWS CLI sends input in the order of args[0] will be path of executable (ignored) args[1] is session response args[2] is client region args[3] is operation name args[4] is profile name from aws credentials/config files args[5] is parameters input to aws cli for StartSession api args[6] is endpoint for ssm service

Types

type ISession

type ISession interface {
	Execute(log.T) error
	OpenDataChannel(log.T) error
	ProcessFirstMessage(log log.T, outputMessage message.ClientMessage) (isHandlerReady bool, err error)
	Stop()
	GetResumeSessionParams(log.T) (string, error)
	ResumeSessionHandler(log.T) error
	TerminateSession(log.T) error
}

type ISessionPlugin

type ISessionPlugin interface {
	SetSessionHandlers(log.T) error
	ProcessStreamMessagePayload(log log.T, streamDataMessage message.ClientMessage) (isHandlerReady bool, err error)
	Initialize(log log.T, sessionVar *Session)
	Stop()
	Name() string
}

type Session

type Session struct {
	DataChannel           datachannel.IDataChannel
	SessionId             string
	StreamUrl             string
	TokenValue            string
	IsAwsCliUpgradeNeeded bool
	Endpoint              string
	ClientId              string
	TargetId              string

	SessionType       string
	SessionProperties interface{}
	DisplayMode       sessionutil.DisplayMode
	// contains filtered or unexported fields
}

func (*Session) Execute

func (s *Session) Execute(log log.T) (err error)

Execute create data channel and start the session

func (*Session) GetResumeSessionParams

func (s *Session) GetResumeSessionParams(log log.T) (string, error)

GetResumeSessionParams calls ResumeSession API and gets tokenvalue for reconnecting

func (*Session) OpenDataChannel

func (s *Session) OpenDataChannel(log log.T) (err error)

OpenDataChannel initializes datachannel

func (*Session) ProcessFirstMessage

func (s *Session) ProcessFirstMessage(log log.T, outputMessage message.ClientMessage) (isHandlerReady bool, err error)

ProcessFirstMessage only processes messages with PayloadType Output to determine the sessionType of the session to be launched. This is a fallback for agent versions that do not support handshake, they immediately start sending shell output.

func (*Session) ResumeSessionHandler

func (s *Session) ResumeSessionHandler(log log.T) (err error)

ResumeSessionHandler gets token value and tries to Reconnect to datachannel

func (*Session) Stop

func (s *Session) Stop()

Stop will end the session

func (*Session) TerminateSession

func (s *Session) TerminateSession(log log.T) error

TerminateSession calls TerminateSession API

Directories

Path Synopsis
Package portsession starts port session.
Package portsession starts port session.
Package sessionutil contains utility methods required to start session.
Package sessionutil contains utility methods required to start session.
Package shellsession starts shell session.
Package shellsession starts shell session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL