storage

package
v0.0.0-...-dc8ed20 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0, Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbUser            = "admin"
	DbPass            = "nimda"
	DbName            = "broker"
	DbPort            = "5432"
	DockerUserNetwork = "test_network"
	EnvPipelineBuild  = "PIPELINE_BUILD"
)

Variables

This section is empty.

Functions

func CloseDatabase

func CloseDatabase(t *testing.T, connection *dbr.Connection)

func EnsureTestNetworkForDB

func EnsureTestNetworkForDB(t *testing.T, ctx context.Context) (func(), error)

func FixTables

func FixTables() map[string]string

func InitTestDBTables

func InitTestDBTables(t *testing.T, connectionURL string) (func(), error)

func SetupTestDBTables

func SetupTestDBTables(connectionURL string) (cleanupFunc func(), err error)

func SetupTestNetworkForDB

func SetupTestNetworkForDB(ctx context.Context) (cleanupFunc func(), err error)

Types

type BrokerStorage

type BrokerStorage interface {
	Instances() Instances
	Operations() Operations
	Provisioning() Provisioning
	Deprovisioning() Deprovisioning
	Orchestrations() Orchestrations
	RuntimeStates() RuntimeStates
}

func NewFromConfig

func NewFromConfig(cfg Config, cipher postgres.Cipher, log logrus.FieldLogger) (BrokerStorage, *dbr.Connection, error)

func NewMemoryStorage

func NewMemoryStorage() BrokerStorage

type Config

type Config struct {
	User     string `envconfig:"default=postgres"`
	Password string `envconfig:"default=password"`
	Host     string `envconfig:"default=localhost"`
	Port     string `envconfig:"default=5432"`
	Name     string `envconfig:"default=broker"`
	SSLMode  string `envconfig:"default=disable"`

	SecretKey string `envconfig:"optional"`

	MaxOpenConns    int           `envconfig:"default=8"`
	MaxIdleConns    int           `envconfig:"default=2"`
	ConnMaxLifetime time.Duration `envconfig:"default=30m"`
}

func InitTestDBContainer

func InitTestDBContainer(t *testing.T, ctx context.Context, hostname string) (func(), Config, error)

func SetupTestDBContainer

func SetupTestDBContainer(ctx context.Context, hostname string) (cleanupFunc func(), dbCfg Config, err error)

func (*Config) ConnectionURL

func (cfg *Config) ConnectionURL() string

type Deprovisioning

type Deprovisioning interface {
	InsertDeprovisioningOperation(operation internal.DeprovisioningOperation) error
	GetDeprovisioningOperationByID(operationID string) (*internal.DeprovisioningOperation, error)
	GetDeprovisioningOperationByInstanceID(instanceID string) (*internal.DeprovisioningOperation, error)
	UpdateDeprovisioningOperation(operation internal.DeprovisioningOperation) (*internal.DeprovisioningOperation, error)
	ListDeprovisioningOperationsByInstanceID(instanceID string) ([]internal.DeprovisioningOperation, error)
	ListDeprovisioningOperations() ([]internal.DeprovisioningOperation, error)
}

type Encrypter

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

func NewEncrypter

func NewEncrypter(secretKey string) *Encrypter

func (*Encrypter) Decrypt

func (e *Encrypter) Decrypt(obj []byte) ([]byte, error)

func (*Encrypter) DecryptBasicAuth

func (e *Encrypter) DecryptBasicAuth(pp *internal.ProvisioningParameters) error

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(obj []byte) ([]byte, error)

func (*Encrypter) EncryptBasicAuth

func (e *Encrypter) EncryptBasicAuth(pp *internal.ProvisioningParameters) error

type Instances

type Instances interface {
	FindAllJoinedWithOperations(prct ...predicate.Predicate) ([]internal.InstanceWithOperation, error)
	FindAllInstancesForRuntimes(runtimeIdList []string) ([]internal.Instance, error)
	FindAllInstancesForSubAccounts(subAccountslist []string) ([]internal.Instance, error)
	GetByID(instanceID string) (*internal.Instance, error)
	Insert(instance internal.Instance) error
	Update(instance internal.Instance) (*internal.Instance, error)
	Delete(instanceID string) error
	GetInstanceStats() (internal.InstanceStats, error)
	GetNumberOfInstancesForGlobalAccountID(globalAccountID string) (int, error)
	List(dbmodel.InstanceFilter) ([]internal.Instance, int, int, error)

	// todo: remove after instances parameters migration is done
	InsertWithoutEncryption(instance internal.Instance) error
	UpdateWithoutEncryption(instance internal.Instance) (*internal.Instance, error)
	ListWithoutDecryption(dbmodel.InstanceFilter) ([]internal.Instance, int, int, error)
}

type Operations

type Operations interface {
	Provisioning
	Deprovisioning
	UpgradeKyma
	UpgradeCluster

	GetLastOperation(instanceID string) (*internal.Operation, error)
	GetOperationByID(operationID string) (*internal.Operation, error)
	GetNotFinishedOperationsByType(operationType internal.OperationType) ([]internal.Operation, error)
	GetOperationStatsByPlan() (map[string]internal.OperationStats, error)
	GetOperationsForIDs(operationIDList []string) ([]internal.Operation, error)
	GetOperationStatsForOrchestration(orchestrationID string) (map[string]int, error)
	ListOperations(filter dbmodel.OperationFilter) ([]internal.Operation, int, int, error)
}

type Orchestrations

type Orchestrations interface {
	Insert(orchestration internal.Orchestration) error
	Update(orchestration internal.Orchestration) error
	GetByID(orchestrationID string) (*internal.Orchestration, error)
	List(filter dbmodel.OrchestrationFilter) ([]internal.Orchestration, int, int, error)
}

type Provisioning

type Provisioning interface {
	InsertProvisioningOperation(operation internal.ProvisioningOperation) error
	GetProvisioningOperationByID(operationID string) (*internal.ProvisioningOperation, error)
	GetProvisioningOperationByInstanceID(instanceID string) (*internal.ProvisioningOperation, error)
	UpdateProvisioningOperation(operation internal.ProvisioningOperation) (*internal.ProvisioningOperation, error)
	ListProvisioningOperationsByInstanceID(instanceID string) ([]internal.ProvisioningOperation, error)
}

type RuntimeStates

type RuntimeStates interface {
	Insert(runtimeState internal.RuntimeState) error
	GetByOperationID(operationID string) (internal.RuntimeState, error)
	ListByRuntimeID(runtimeID string) ([]internal.RuntimeState, error)
}

type UpgradeCluster

type UpgradeCluster interface {
	InsertUpgradeClusterOperation(operation internal.UpgradeClusterOperation) error
	UpdateUpgradeClusterOperation(operation internal.UpgradeClusterOperation) (*internal.UpgradeClusterOperation, error)
	GetUpgradeClusterOperationByID(operationID string) (*internal.UpgradeClusterOperation, error)
	ListUpgradeClusterOperationsByInstanceID(instanceID string) ([]internal.UpgradeClusterOperation, error)
	ListUpgradeClusterOperationsByOrchestrationID(orchestrationID string, filter dbmodel.OperationFilter) ([]internal.UpgradeClusterOperation, int, int, error)
}

type UpgradeKyma

type UpgradeKyma interface {
	InsertUpgradeKymaOperation(operation internal.UpgradeKymaOperation) error
	UpdateUpgradeKymaOperation(operation internal.UpgradeKymaOperation) (*internal.UpgradeKymaOperation, error)
	GetUpgradeKymaOperationByID(operationID string) (*internal.UpgradeKymaOperation, error)
	GetUpgradeKymaOperationByInstanceID(instanceID string) (*internal.UpgradeKymaOperation, error)
	ListUpgradeKymaOperations() ([]internal.UpgradeKymaOperation, error)
	ListUpgradeKymaOperationsByInstanceID(instanceID string) ([]internal.UpgradeKymaOperation, error)
	ListUpgradeKymaOperationsByOrchestrationID(orchestrationID string, filter dbmodel.OperationFilter) ([]internal.UpgradeKymaOperation, int, int, error)
}

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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