middleware

package
v0.0.0-...-116859e Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	GetEnvironment(ctx context.Context, id string) (*types.Environment, *utilsGoServer.Error)
	GetEnvironments(ctx context.Context) (*types.Environments, *utilsGoServer.Error)
	CreateEnvironment(ctx context.Context, name string) (*types.Environment, *utilsGoServer.Error)
	UpdateEnvironment(ctx context.Context, id string, name string) (*types.Environment, *utilsGoServer.Error)
	DeleteEnvironment(ctx context.Context, id string) *utilsGoServer.Error

	CreateBlock(
		ctx context.Context,
		envId, name string,
		buildConfig *types.BuildConfig,
		runConfig *types.RunConfig) (string, string, *utilsGoServer.Error)
	GetBlock(ctx context.Context, name, envId string) (*types.Block, *utilsGoServer.Error)
	GetBlocks(ctx context.Context, envId string) (*types.Blocks, *utilsGoServer.Error)
	DeployBlockUpdate(
		ctx context.Context,
		name, envId, baseReleaseId string,
		buildConfig *types.BuildConfig,
		runConfig *types.RunConfig) (string, string, *utilsGoServer.Error)
	TriggerDeploy(ctx context.Context, name, envId string) (string, string, *utilsGoServer.Error)
	RollbackBlock(ctx context.Context, name, envId, releaseId string) (string, string, *utilsGoServer.Error)
	DeleteBlock(ctx context.Context, name, envId string) *utilsGoServer.Error
	WatchReleasesStatus(ctx context.Context, blockName, envId string, statusChan chan *types.ReleasesStatus) *utilsGoServer.Error
	GetBlocksHealthStatus(ctx context.Context, envId string) (*types.BlockStatuses, *utilsGoServer.Error)
	WatchJobsStatus(
		ctx context.Context, blockName, envId string, sendClientLogs func(jobStatus *types.JobStatus) error) *utilsGoServer.Error
	GetBlocksMetrics(ctx context.Context, name, envId string) (*types.BlocksMetrics, *utilsGoServer.Error)
	KillBlockInstance(ctx context.Context, id, envId string) *utilsGoServer.Error
	// Scale down all the resources of a block down to 0
	// return blockName, releaseId, error if any
	SuspendBlock(ctx context.Context, blockName, envId string) (string, string, *utilsGoServer.Error)

	WatchBuildLogs(ctx context.Context, releaseId, blockName, envId string, logsChan chan *types.Logs) *utilsGoServer.Error
	UpdateBuildStatus(ctx context.Context, releaseId, blockName, envId string, buildState types.BuildStatus_State) (*types.Release, *utilsGoServer.Error)
	UpdateBuildCommitSha(ctx context.Context, releaseId, blockName, envId, commitSha string) *utilsGoServer.Error

	WatchConsoleLogs(ctx context.Context, blockName, envId string, logsChan chan *types.ConsoleLog) *utilsGoServer.Error

	GetKintoConfiguration(ctx context.Context) (*types.KintoConfiguration, error)

	AbortRelease(ctx context.Context, blockName, releaseId, envId string) *utilsGoServer.Error

	EnableExternalURL(ctx context.Context, name, envId, releaseId string) *utilsGoServer.Error
	DisableExternalURL(ctx context.Context, name, envId string) *utilsGoServer.Error

	CreateCustomDomainName(ctx context.Context, blockName, envId, domainName string, protocol types.RunConfig_Protocol) *utilsGoServer.Error
	DeleteCustomDomainName(ctx context.Context, blockName, envId, domainName string, protocol types.RunConfig_Protocol) *utilsGoServer.Error
	CheckCertificateReadiness(ctx context.Context, blockName, envId string) bool

	StartTeleport(
		ctx context.Context, envId, blockNameToTeleport string) (*types.TeleportServiceData, *utilsGoServer.Error)
	StopTeleport(ctx context.Context, envId, blockNameTeleported string) *utilsGoServer.Error

	TagRelease(ctx context.Context, tag, blockName, envId, releaseId string) *utilsGoServer.Error
	PromoteRelease(ctx context.Context, tag, releaseId, blockName, envId, targetEnvId string) *utilsGoServer.Error

	GenReleaseConfigFromKintoFile(
		ctx context.Context, org, repo, branch, envId, githubUserToken string, blockType types.Block_Type) (*types.ReleaseConfig, *utilsGoServer.Error)
	// contains filtered or unexported methods
}

This is a wrapper that allows adapter implementations of Middleware be able to be passed in as middleware reference Composition in go does not allow composition to be = to the base type you are composing. This interface bridges that gap.

func NewControllerMiddlewareOrDie

func NewControllerMiddlewareOrDie(middlewares ...Interface) Interface

type Middleware

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

Implements middleware pattern + Implements controller.ControllerInterface for Adapter Pattern All functions implemented for the Controller interface by default forward the request to `next` To override the function as middleware, create a struct and insert Middleware as composition and override each function as you please. see test file for example

func (*Middleware) AbortRelease

func (m *Middleware) AbortRelease(ctx context.Context, blockName, releaseId, envId string) *utilsGoServer.Error

func (*Middleware) CheckCertificateReadiness

func (m *Middleware) CheckCertificateReadiness(ctx context.Context, blockName, envId string) bool

func (*Middleware) CreateBlock

func (m *Middleware) CreateBlock(
	ctx context.Context,
	envId, displayName string,
	buildConfig *types.BuildConfig,
	runConfig *types.RunConfig) (string, string, *utilsGoServer.Error)

func (*Middleware) CreateCustomDomainName

func (m *Middleware) CreateCustomDomainName(
	ctx context.Context, blockName, envId, domainName string, protocol types.RunConfig_Protocol) *utilsGoServer.Error

func (*Middleware) CreateEnvironment

func (m *Middleware) CreateEnvironment(ctx context.Context, name string) (*types.Environment, *utilsGoServer.Error)

func (*Middleware) DeleteBlock

func (m *Middleware) DeleteBlock(ctx context.Context, name, envId string) *utilsGoServer.Error

func (*Middleware) DeleteCustomDomainName

func (m *Middleware) DeleteCustomDomainName(
	ctx context.Context, blockName, envId, domainName string, protocol types.RunConfig_Protocol) *utilsGoServer.Error

func (*Middleware) DeleteEnvironment

func (m *Middleware) DeleteEnvironment(ctx context.Context, id string) *utilsGoServer.Error

func (*Middleware) DeployBlockUpdate

func (m *Middleware) DeployBlockUpdate(
	ctx context.Context,
	name, envId, baseReleaseId string,
	buildConfig *types.BuildConfig,
	runConfig *types.RunConfig) (string, string, *utilsGoServer.Error)

func (*Middleware) DisableExternalURL

func (m *Middleware) DisableExternalURL(ctx context.Context, name, envId string) *utilsGoServer.Error

func (*Middleware) EnableExternalURL

func (m *Middleware) EnableExternalURL(ctx context.Context, name, envId, releaseId string) *utilsGoServer.Error

func (*Middleware) GenReleaseConfigFromKintoFile

func (m *Middleware) GenReleaseConfigFromKintoFile(
	ctx context.Context, org, repo, branch, envId, githubUserToken string, blockType types.Block_Type) (*types.ReleaseConfig, *utilsGoServer.Error)

func (*Middleware) GetBlock

func (m *Middleware) GetBlock(ctx context.Context, name, envId string) (*types.Block, *utilsGoServer.Error)

func (*Middleware) GetBlocks

func (m *Middleware) GetBlocks(ctx context.Context, envId string) (*types.Blocks, *utilsGoServer.Error)

func (*Middleware) GetBlocksHealthStatus

func (m *Middleware) GetBlocksHealthStatus(ctx context.Context, envId string) (*types.BlockStatuses, *utilsGoServer.Error)

func (*Middleware) GetBlocksMetrics

func (m *Middleware) GetBlocksMetrics(ctx context.Context, name, envId string) (*types.BlocksMetrics, *utilsGoServer.Error)

func (*Middleware) GetEnvironment

func (m *Middleware) GetEnvironment(ctx context.Context, id string) (*types.Environment, *utilsGoServer.Error)

func (*Middleware) GetEnvironments

func (m *Middleware) GetEnvironments(ctx context.Context) (*types.Environments, *utilsGoServer.Error)

func (*Middleware) GetKintoConfiguration

func (m *Middleware) GetKintoConfiguration(ctx context.Context) (*types.KintoConfiguration, error)

func (*Middleware) KillBlockInstance

func (m *Middleware) KillBlockInstance(ctx context.Context, id, envId string) *utilsGoServer.Error

func (*Middleware) PromoteRelease

func (m *Middleware) PromoteRelease(ctx context.Context, tag, releaseId, blockName, envId, targetEnvId string) *utilsGoServer.Error

func (*Middleware) RollbackBlock

func (m *Middleware) RollbackBlock(ctx context.Context, name, envId, releaseId string) (string, string, *utilsGoServer.Error)

func (*Middleware) StartTeleport

func (m *Middleware) StartTeleport(ctx context.Context, envId, blockName string) (*types.TeleportServiceData, *utilsGoServer.Error)

func (*Middleware) StopTeleport

func (m *Middleware) StopTeleport(ctx context.Context, envId, blockName string) *utilsGoServer.Error

func (*Middleware) SuspendBlock

func (m *Middleware) SuspendBlock(ctx context.Context, blockName, envId string) (string, string, *utilsGoServer.Error)

func (*Middleware) TagRelease

func (m *Middleware) TagRelease(ctx context.Context, tag, blockName, envId, releaseId string) *utilsGoServer.Error

func (*Middleware) TriggerDeploy

func (m *Middleware) TriggerDeploy(ctx context.Context, name, envId string) (string, string, *utilsGoServer.Error)

func (*Middleware) UpdateBuildCommitSha

func (m *Middleware) UpdateBuildCommitSha(ctx context.Context, releaseId, blockName, envId, commitSha string) *utilsGoServer.Error

func (*Middleware) UpdateBuildStatus

func (m *Middleware) UpdateBuildStatus(
	ctx context.Context, releaseId, blockName, envId string, buildState types.BuildStatus_State) (*types.Release, *utilsGoServer.Error)

func (*Middleware) UpdateEnvironment

func (m *Middleware) UpdateEnvironment(ctx context.Context, id string, name string) (*types.Environment, *utilsGoServer.Error)

func (*Middleware) WatchBuildLogs

func (m *Middleware) WatchBuildLogs(ctx context.Context, releaseId, blockName, envId string, logsChan chan *types.Logs) *utilsGoServer.Error

func (*Middleware) WatchConsoleLogs

func (m *Middleware) WatchConsoleLogs(
	ctx context.Context, blockName, envId string, logsChan chan *types.ConsoleLog) *utilsGoServer.Error

func (*Middleware) WatchJobsStatus

func (m *Middleware) WatchJobsStatus(
	ctx context.Context, blockName, envId string, sendClientLogs func(jobStatus *types.JobStatus) error) *utilsGoServer.Error

func (*Middleware) WatchReleasesStatus

func (m *Middleware) WatchReleasesStatus(
	ctx context.Context, blockName, envId string, statusChan chan *types.ReleasesStatus) *utilsGoServer.Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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