db

package
v0.0.0-...-c867f56 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	gorm.Model

	Value string
}

type Configuration

type Configuration struct {
	UseCases []UseCaseConfiguration
}

type Credential

type Credential struct {
	gorm.Model

	Username    string
	Password    string
	AccessToken string
}

type Deployment

type Deployment struct {
	gorm.Model

	Canonical   string `gorm:"uniqueIndex"`
	Type        uint
	Instances   []Instance `gorm:"foreignKey:DeploymentCanonical;references:Canonical"`
	CallbackURL string
}

type Instance

type Instance struct {
	gorm.Model

	DeploymentCanonical string
	URL                 string `gorm:"uniqueIndex"`
	State               uint
	AdminCredentialID   *uint
	AdminCredential     Credential
	UserCredentialID    *uint
	UserCredential      Credential
}

type PluginInformation

type PluginInformation struct {
	gorm.Model

	Name    string
	Version string
}

type Querier

type Querier interface {
	// Configuration CRUD operations
	GetConfiguration(ctx context.Context) (*Configuration, error)
	GetUseCaseConfiguration(ctx context.Context, uc string) (*UseCaseConfiguration, error)
	GetServiceConfiguration(ctx context.Context, uc string, service uint) (*ServiceConfiguration, error)
	CreateUseCaseConfiguration(ctx context.Context, newUC UseCaseConfiguration) (*UseCaseConfiguration, error)
	CreateServiceConfiguration(ctx context.Context, newS ServiceConfiguration) (*ServiceConfiguration, error)
	UpdateConfiguration(ctx context.Context, updatedC Configuration) error
	UpdateUseCaseConfiguration(ctx context.Context, updatedUC UseCaseConfiguration) error
	UpdateServiceConfiguration(ctx context.Context, updatedS ServiceConfiguration) error
	DeleteUseCaseConfiguration(ctx context.Context, uc string) error
	DeleteServiceConfiguration(ctx context.Context, uc string, service uint) error

	// Deployment operations
	GetAllDeployments(ctx context.Context) ([]*Deployment, error)
	GetDeploymentByCanonical(ctx context.Context, can string) (*Deployment, error)
	CreateDeployment(ctx context.Context, newD Deployment) (*Deployment, error)
	UpdateDeployment(ctx context.Context, updatedD Deployment) error
	DeleteDeployment(ctx context.Context, can string) error

	// Instances operations
	BatchCreateInstances(ctx context.Context, instances []Instance) error
	UpdateInstance(ctx context.Context, updatedI Instance) error
}

func New

func New(cfg *config.Config) Querier

type ServiceConfiguration

type ServiceConfiguration struct {
	gorm.Model

	UseCase string
	Type    uint
	Version string
	Plugins []PluginInformation `gorm:"many2many:service_configuration_plugins;"`
}

type UseCaseConfiguration

type UseCaseConfiguration struct {
	gorm.Model

	Name     string                 `gorm:"uniqueIndex"`
	Services []ServiceConfiguration `gorm:"foreignKey:UseCase;references:Name"`
}

Jump to

Keyboard shortcuts

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