api

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterInstallationsForMigration added in v0.48.0

func GetClusterInstallationsForMigration(c *Context, request model.MigrateClusterInstallationRequest) ([]*model.ClusterInstallation, int)

GetClusterInstallationsForMigration compare , filter already migrated installations & returns actual set of CIs for migration

func Register

func Register(rootRouter *mux.Router, context *Context)

Register registers the API endpoints on the given router.

Types

type AwsClient added in v0.46.1

type AwsClient interface {
	SwitchClusterTags(clusterID string, targetClusterID string, logger logrus.FieldLogger) error
}

AwsClient describes the interface required to communicate with the AWS

type Context

type Context struct {
	Store         Store
	Supervisor    Supervisor
	Provisioner   Provisioner
	DBProvider    DBProvider
	EventProducer EventProducer
	RequestID     string
	Environment   string
	Logger        logrus.FieldLogger
	AwsClient     AwsClient
}

Context provides the API with all necessary data and interfaces for responding to requests.

It is cloned before each request, allowing per-request changes such as logger annotations.

func (*Context) Clone

func (c *Context) Clone() *Context

Clone creates a shallow copy of context, allowing clones to apply per-request changes.

type DBProvider added in v0.46.1

type DBProvider interface {
	GetDatabase(installationID, dbType string) model.Database
}

DBProvider describes the interface required to get database for specific installation and specified type.

type EventProducer added in v0.50.0

type EventProducer interface {
	ProduceInstallationStateChangeEvent(installation *model.Installation, oldState string, extraDataFields ...events.DataField) error
	ProduceClusterStateChangeEvent(cluster *model.Cluster, oldState string, extraDataFields ...events.DataField) error
}

EventProducer produces Provisioners' state change events.

type Provisioner added in v0.2.0

type Provisioner interface {
	ExecClusterInstallationCLI(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) ([]byte, error)
	ExecMattermostCLI(cluster *model.Cluster, clusterInstallation *model.ClusterInstallation, args ...string) ([]byte, error)
	GetClusterResources(*model.Cluster, bool) (*k8s.ClusterResources, error)
}

Provisioner describes the interface required to communicate with the Kubernetes cluster.

type Store

type Store interface {
	model.InstallationDatabaseStoreInterface

	CreateCluster(cluster *model.Cluster, annotations []*model.Annotation) error
	GetCluster(clusterID string) (*model.Cluster, error)
	GetClusterDTO(clusterID string) (*model.ClusterDTO, error)
	GetClusters(filter *model.ClusterFilter) ([]*model.Cluster, error)
	GetClusterDTOs(filter *model.ClusterFilter) ([]*model.ClusterDTO, error)
	UpdateCluster(cluster *model.Cluster) error
	LockCluster(clusterID, lockerID string) (bool, error)
	UnlockCluster(clusterID, lockerID string, force bool) (bool, error)
	LockClusterAPI(clusterID string) error
	UnlockClusterAPI(clusterID string) error
	DeleteCluster(clusterID string) error

	CreateInstallation(installation *model.Installation, annotations []*model.Annotation) error
	GetInstallation(installationID string, includeGroupConfig, includeGroupConfigOverrides bool) (*model.Installation, error)
	GetInstallationDTO(installationID string, includeGroupConfig, includeGroupConfigOverrides bool) (*model.InstallationDTO, error)
	GetInstallations(filter *model.InstallationFilter, includeGroupConfig, includeGroupConfigOverrides bool) ([]*model.Installation, error)
	GetInstallationDTOs(filter *model.InstallationFilter, includeGroupConfig, includeGroupConfigOverrides bool) ([]*model.InstallationDTO, error)
	GetInstallationsCount(includeDeleted bool) (int64, error)
	GetInstallationsStatus() (*model.InstallationsStatus, error)
	UpdateInstallation(installation *model.Installation) error
	UpdateInstallationState(installation *model.Installation) error
	LockInstallation(installationID, lockerID string) (bool, error)
	UnlockInstallation(installationID, lockerID string, force bool) (bool, error)
	LockInstallationAPI(installationID string) error
	UnlockInstallationAPI(installationID string) error
	DeleteInstallation(installationID string) error

	GetClusterInstallation(clusterInstallationID string) (*model.ClusterInstallation, error)
	GetClusterInstallations(filter *model.ClusterInstallationFilter) ([]*model.ClusterInstallation, error)
	LockClusterInstallationAPI(clusterInstallationID string) error
	UnlockClusterInstallationAPI(clusterInstallationID string) error

	CreateGroup(group *model.Group) error
	GetGroup(groupID string) (*model.Group, error)
	GetGroups(filter *model.GroupFilter) ([]*model.Group, error)
	UpdateGroup(group *model.Group, forceSequenceUpdate bool) error
	LockGroup(groupID, lockerID string) (bool, error)
	UnlockGroup(groupID, lockerID string, force bool) (bool, error)
	LockGroupAPI(groupID string) error
	UnlockGroupAPI(groupID string) error
	DeleteGroup(groupID string) error
	GetGroupStatus(groupID string) (*model.GroupStatus, error)

	CreateWebhook(webhook *model.Webhook) error
	GetWebhook(webhookID string) (*model.Webhook, error)
	GetWebhooks(filter *model.WebhookFilter) ([]*model.Webhook, error)
	DeleteWebhook(webhookID string) error

	GetOrCreateAnnotations(annotations []*model.Annotation) ([]*model.Annotation, error)

	CreateClusterAnnotations(clusterID string, annotations []*model.Annotation) ([]*model.Annotation, error)
	DeleteClusterAnnotation(clusterID string, annotationName string) error

	CreateInstallationAnnotations(installationID string, annotations []*model.Annotation) ([]*model.Annotation, error)
	DeleteInstallationAnnotation(installationID string, annotationName string) error

	IsInstallationBackupRunning(installationID string) (bool, error)
	IsInstallationBackupBeingUsed(backupID string) (bool, error)
	CreateInstallationBackup(backupMeta *model.InstallationBackup) error
	UpdateInstallationBackupState(backupMeta *model.InstallationBackup) error
	GetInstallationBackup(id string) (*model.InstallationBackup, error)
	GetInstallationBackups(filter *model.InstallationBackupFilter) ([]*model.InstallationBackup, error)
	LockInstallationBackup(backupMetadataID, lockerID string) (bool, error)
	UnlockInstallationBackup(backupMetadataID, lockerID string, force bool) (bool, error)
	LockInstallationBackupAPI(backupID string) error
	UnlockInstallationBackupAPI(backupID string) error

	TriggerInstallationRestoration(installation *model.Installation, backup *model.InstallationBackup) (*model.InstallationDBRestorationOperation, error)
	GetInstallationDBRestorationOperation(id string) (*model.InstallationDBRestorationOperation, error)
	GetInstallationDBRestorationOperations(filter *model.InstallationDBRestorationFilter) ([]*model.InstallationDBRestorationOperation, error)

	MigrateClusterInstallations(clusterInstallations []*model.ClusterInstallation, targetCluster string) error
	SwitchDNS(oldCIsIDs, newCIsIDs, installationIDs []string, hibernatingInstallationIDs []string) error
	DeleteClusterInstallation(id string) error
	DeleteInActiveClusterInstallationByClusterID(clusterID string) (int64, error)
	LockInstallations(installationIDs []string, lockerID string) (bool, error)
	UnlockInstallations(installationIDs []string, lockerID string, force bool) (bool, error)
	UpdateClusterInstallation(clusterInstallation *model.ClusterInstallation) error
	TriggerInstallationDBMigration(dbMigrationOp *model.InstallationDBMigrationOperation, installation *model.Installation) (*model.InstallationDBMigrationOperation, error)
	TriggerInstallationDBMigrationRollback(dbMigrationOp *model.InstallationDBMigrationOperation, installation *model.Installation) error
	GetInstallationDBMigrationOperations(filter *model.InstallationDBMigrationFilter) ([]*model.InstallationDBMigrationOperation, error)
	GetInstallationDBMigrationOperation(id string) (*model.InstallationDBMigrationOperation, error)
	UpdateInstallationDBMigrationOperationState(dbMigration *model.InstallationDBMigrationOperation) error
	LockInstallationDBMigrationOperation(id, lockerID string) (bool, error)
	UnlockInstallationDBMigrationOperation(id, lockerID string, force bool) (bool, error)

	CreateSubscription(sub *model.Subscription) error
	GetSubscriptions(filter *model.SubscriptionsFilter) ([]*model.Subscription, error)
	GetSubscription(subID string) (*model.Subscription, error)
	DeleteSubscription(subID string) error

	GetStateChangeEvents(filter *model.StateChangeEventFilter) ([]*model.StateChangeEventData, error)
}

Store describes the interface required to persist changes made via API requests.

type Supervisor

type Supervisor interface {
	Do() error
}

Supervisor describes the interface to notify the background jobs of an actionable change.

Jump to

Keyboard shortcuts

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