agent/acs/handler/acs_handler.go
func NewSession(ctx context.Context,
	config *config.Config,
	deregisterInstanceEventStream *eventstream.EventStream,
	containerInstanceArn string,
	credentialsProvider *credentials.Credentials,
	ecsClient api.ECSClient,
	taskEngineState dockerstate.TaskEngineState,
	stateManager statemanager.StateManager,
	taskEngine engine.TaskEngine,
	credentialsManager rolecredentials.Manager,
	taskHandler *eventhandler.TaskHandler) Session {
	resources := newSessionResources(credentialsProvider)
	backoff := retry.NewExponentialBackoff(connectionBackoffMin, connectionBackoffMax,
		connectionBackoffJitter, connectionBackoffMultiplier)
	derivedContext, cancel := context.WithCancel(ctx)

	return &session{
		agentConfig:                     config,
		deregisterInstanceEventStream:   deregisterInstanceEventStream,
		containerInstanceARN:            containerInstanceArn,
		credentialsProvider:             credentialsProvider,
		ecsClient:                       ecsClient,
		state:                           taskEngineState,
		stateManager:                    stateManager,
		taskEngine:                      taskEngine,
		credentialsManager:              credentialsManager,
		taskHandler:                     taskHandler,
		ctx:                             derivedContext,
		cancel:                          cancel,
		backoff:                         backoff,
		resources:                       resources,
		_heartbeatTimeout:               heartbeatTimeout,
		_heartbeatJitter:                heartbeatJitter,
		_inactiveInstanceReconnectDelay: inactiveInstanceReconnectDelay,
	}
}
func NewSession(ctx context.Context,
	config *config.Config,
	deregisterInstanceEventStream *eventstream.EventStream,
	containerInstanceArn string,
	credentialsProvider *credentials.Credentials,
	ecsClient api.ECSClient,
	taskEngineState dockerstate.TaskEngineState,
	stateManager statemanager.StateManager,
	taskEngine engine.TaskEngine,
	credentialsManager rolecredentials.Manager,
	taskHandler *eventhandler.TaskHandler) Session {
	resources := newSessionResources(credentialsProvider)
	backoff := retry.NewExponentialBackoff(connectionBackoffMin, connectionBackoffMax,
		connectionBackoffJitter, connectionBackoffMultiplier)
	derivedContext, cancel := context.WithCancel(ctx)

	return &session{
		agentConfig:                     config,
		deregisterInstanceEventStream:   deregisterInstanceEventStream,
		containerInstanceARN:            containerInstanceArn,
		credentialsProvider:             credentialsProvider,
		ecsClient:                       ecsClient,
		state:                           taskEngineState,
		stateManager:                    stateManager,
		taskEngine:                      taskEngine,
		credentialsManager:              credentialsManager,
		taskHandler:                     taskHandler,
		ctx:                             derivedContext,
		cancel:                          cancel,
		backoff:                         backoff,
		resources:                       resources,
		_heartbeatTimeout:               heartbeatTimeout,
		_heartbeatJitter:                heartbeatJitter,
		_inactiveInstanceReconnectDelay: inactiveInstanceReconnectDelay,
	}
}
func NewSession ( ctx context . Context , config * config . Config , deregisterInstanceEventStream * eventstream . EventStream , containerInstanceArn string , credentialsProvider * credentials . Credentials , ecsClient api . ECSClient , taskEngineState dockerstate . TaskEngineState , stateManager statemanager . StateManager , taskEngine engine . TaskEngine , credentialsManager rolecredentials . Manager , taskHandler * eventhandler . TaskHandler ) Session { resources := newSessionResources ( credentialsProvider ) backoff := retry . NewExponentialBackoff ( connectionBackoffMin , connectionBackoffMax , connectionBackoffJitter , connectionBackoffMultiplier ) derivedContext , cancel := context . WithCancel ( ctx ) return & session { agentConfig : config , deregisterInstanceEventStream : deregisterInstanceEventStream , containerInstanceARN : containerInstanceArn , credentialsProvider : credentialsProvider , ecsClient : ecsClient , state : taskEngineState , stateManager : stateManager , taskEngine : taskEngine , credentialsManager : credentialsManager , taskHandler : taskHandler , ctx : derivedContext , cancel : cancel , backoff : backoff , resources : resources , _heartbeatTimeout : heartbeatTimeout , _heartbeatJitter : heartbeatJitter , _inactiveInstanceReconnectDelay : inactiveInstanceReconnectDelay , } }
// NewSession creates a new Session object
NewSession creates a new Session object