handlers

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncProjectCommandOutputHandler

type AsyncProjectCommandOutputHandler struct {
	// contains filtered or unexported fields
}

AsyncProjectCommandOutputHandler is a handler to transport terraform client outputs to the front end.

func (*AsyncProjectCommandOutputHandler) CleanUp

func (p *AsyncProjectCommandOutputHandler) CleanUp(pull string)

func (*AsyncProjectCommandOutputHandler) Clear

func (*AsyncProjectCommandOutputHandler) Deregister

func (p *AsyncProjectCommandOutputHandler) Deregister(pull string, ch chan string)

Remove channel, so client no longer receives Terraform output

func (*AsyncProjectCommandOutputHandler) GetProjectOutputBuffer

func (p *AsyncProjectCommandOutputHandler) GetProjectOutputBuffer(pull string) []string

func (*AsyncProjectCommandOutputHandler) GetReceiverBufferForPull

func (p *AsyncProjectCommandOutputHandler) GetReceiverBufferForPull(pull string) map[chan string]bool

func (*AsyncProjectCommandOutputHandler) Handle

func (*AsyncProjectCommandOutputHandler) Register

func (p *AsyncProjectCommandOutputHandler) Register(projectInfo string, receiver chan string)

func (*AsyncProjectCommandOutputHandler) Send

func (*AsyncProjectCommandOutputHandler) SetJobURLWithStatus

type DefaultWebsocketHandler

type DefaultWebsocketHandler struct {
	Logger logging.SimpleLogging
	// contains filtered or unexported fields
}

func (*DefaultWebsocketHandler) SetCloseHandler

func (wh *DefaultWebsocketHandler) SetCloseHandler(w WebsocketConnectionWrapper, receiver chan string)

func (*DefaultWebsocketHandler) SetReadHandler

func (*DefaultWebsocketHandler) Upgrade

type NoopProjectOutputHandler

type NoopProjectOutputHandler struct{}

NoopProjectOutputHandler is a mock that doesn't do anything

func (*NoopProjectOutputHandler) CleanUp

func (p *NoopProjectOutputHandler) CleanUp(pull string)

func (*NoopProjectOutputHandler) Clear

func (*NoopProjectOutputHandler) Deregister

func (p *NoopProjectOutputHandler) Deregister(projectInfo string, receiver chan string)

func (*NoopProjectOutputHandler) Handle

func (p *NoopProjectOutputHandler) Handle()

func (*NoopProjectOutputHandler) Register

func (p *NoopProjectOutputHandler) Register(projectInfo string, receiver chan string)

func (*NoopProjectOutputHandler) Send

func (*NoopProjectOutputHandler) SetJobURLWithStatus

func (p *NoopProjectOutputHandler) SetJobURLWithStatus(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus) error

type ProjectCommandOutputHandler

type ProjectCommandOutputHandler interface {
	// Clear clears the buffer from previous terraform output lines
	Clear(ctx models.ProjectCommandContext)

	// Send will enqueue the msg and wait for Handle() to receive the message.
	Send(ctx models.ProjectCommandContext, msg string)

	// Register registers a channel and blocks until it is caught up. Callers should call this asynchronously when attempting
	// to read the channel in the same goroutine
	Register(projectInfo string, receiver chan string)

	// Deregister removes a channel from successive updates and closes it.
	Deregister(projectInfo string, receiver chan string)

	// Listens for msg from channel
	Handle()

	// SetJobURLWithStatus sets the commit status for the project represented by
	// ctx and updates the status with and url to a job.
	SetJobURLWithStatus(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus) error

	ResourceCleaner
}

func NewAsyncProjectCommandOutputHandler

func NewAsyncProjectCommandOutputHandler(
	projectCmdOutput chan *models.ProjectCmdOutputLine,
	projectStatusUpdater ProjectStatusUpdater,
	projectJobURLGenerator ProjectJobURLGenerator,
	logger logging.SimpleLogging,
) ProjectCommandOutputHandler

type ProjectJobURLGenerator

type ProjectJobURLGenerator interface {
	GenerateProjectJobURL(p models.ProjectCommandContext) (string, error)
}

ProjectJobURLGenerator generates urls to view project's progress.

type ProjectStatusUpdater

type ProjectStatusUpdater interface {
	// UpdateProject sets the commit status for the project represented by
	// ctx.
	UpdateProject(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus, url string) error
}

type ResourceCleaner

type ResourceCleaner interface {
	CleanUp(pull string)
}

type WebsocketConnectionWrapper

type WebsocketConnectionWrapper interface {
	ReadMessage() (messageType int, p []byte, err error)
	WriteMessage(messageType int, data []byte) error
	SetCloseHandler(h func(code int, text string) error)
}

type WebsocketHandler

type WebsocketHandler interface {
	Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (WebsocketConnectionWrapper, error)
	SetReadHandler(w WebsocketConnectionWrapper)
	SetCloseHandler(w WebsocketConnectionWrapper, receiver chan string)
}

func NewWebsocketHandler

func NewWebsocketHandler(logger logging.SimpleLogging) WebsocketHandler

Directories

Path Synopsis
matchers
Code generated by pegomock.
Code generated by pegomock.

Jump to

Keyboard shortcuts

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