admin

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const B3LBInstances = "instances:list"

B3LBInstances is the key for the list of instances

Variables

View Source
var (
	// ListInstanceManagerMockFunc is the function that will be called when the mock instance manager is used.
	ListInstanceManagerMockFunc func() ([]string, error)
	// AddInstanceManagerMockFunc is the function that will be called when the mock instance manager is used.
	AddInstanceManagerMockFunc func(instance api.BigBlueButtonInstance) error
	// GetInstanceManagerMockFunc is the function that will be called when the mock instance manager is used.
	GetInstanceManagerMockFunc func(URL string) (api.BigBlueButtonInstance, error)
	// ListInstancesInstanceManagerMockFunc is the function that will be called when the mock instance manager is used.
	ListInstancesInstanceManagerMockFunc func() ([]api.BigBlueButtonInstance, error)
	// SetInstancesInstanceManagerMockFunc is the function that will be called when the mock instance manager is used.
	SetInstancesInstanceManagerMockFunc func(instances map[string]string) error
)
View Source
var (
	// AddTenantTenantManagerMockFunc is the function that will be called when the mock tenant manager is used.
	AddTenantTenantManagerMockFunc func(tenant *Tenant) error
	// ListTenantsTenantManagerMockFunc is the function that will be called when the mock tenant manager is used
	ListTenantsTenantManagerMockFunc func() ([]TenantListObject, error)
	// DeleteTenantTenantManagerMockFunc is the function that will be called when the mock tenant manager is used
	DeleteTenantTenantManagerMockFunc func(hostname string) error
	// GetTenantTenantManagerMockFunc is the function that will be called when the mock tenant manager is used
	GetTenantTenantManagerMockFunc func(hostname string) (*Tenant, error)
)

Functions

This section is empty.

Types

type Admin

type Admin struct {
	InstanceManager InstanceManager
	TenantManager   TenantManager
	Balancer        balancer.Balancer
	Config          *config.Config
}

Admin struct manager b3lb administration

func CreateAdmin

func CreateAdmin(manager InstanceManager, tenantManager TenantManager, balancer balancer.Balancer, config *config.Config) *Admin

CreateAdmin creates a new admin based on given configuration

func (*Admin) APIKeyValidation

func (a *Admin) APIKeyValidation(c *gin.Context)

APIKeyValidation check that the request contains an api key provided by Authorization header

func (*Admin) ClusterStatus

func (a *Admin) ClusterStatus(c *gin.Context)

ClusterStatus send a status for the cluster. It contains all instances with their status

func (*Admin) CreateTenant

func (a *Admin) CreateTenant(c *gin.Context)

CreateTenant create a tenant from a configuraion YAML body

func (*Admin) DeleteTenant

func (a *Admin) DeleteTenant(c *gin.Context)

DeleteTenant delete a given tenant

func (*Admin) GetConfiguration

func (a *Admin) GetConfiguration(c *gin.Context)

GetConfiguration render configuration

func (*Admin) GetTenant

func (a *Admin) GetTenant(c *gin.Context)

GetTenant retrieve a tenant based on its hostname

func (*Admin) ListInstances

func (a *Admin) ListInstances(c *gin.Context)

ListInstances returns Bigbluebutton instance list

func (*Admin) ListTenants

func (a *Admin) ListTenants(c *gin.Context)

ListTenants list all tenants in system

func (*Admin) Routes

func (a *Admin) Routes() *[]api.EndpointGroup

Routes returns admin routes

func (*Admin) SetInstances

func (a *Admin) SetInstances(c *gin.Context)

SetInstances set all instances. It takes InstanceList object in body

type InstanceList

type InstanceList struct {
	Kind      string            `yaml:"kind" json:"kind"`
	Instances map[string]string `yaml:"instances" json:"instances"`
}

InstanceList represent the kind InstanceList configuration struct file

type InstanceManager

type InstanceManager interface {
	List() ([]string, error)
	ListInstances() ([]api.BigBlueButtonInstance, error)
	Add(instance api.BigBlueButtonInstance) error
	Get(URL string) (api.BigBlueButtonInstance, error)
	SetInstances(instances map[string]string) error
}

InstanceManager manager Bigbluebutton instances

func NewInstanceManager

func NewInstanceManager(rdb redis.Client) InstanceManager

NewInstanceManager creates a new instance manager

type InstanceManagerMock

type InstanceManagerMock struct{}

InstanceManagerMock is a mock implementation of the InstanceManager interface.

func (*InstanceManagerMock) Add

Add is a mock implementation that adds a new instance.

func (*InstanceManagerMock) Get

Get is a mock implementation that returns an instance.

func (*InstanceManagerMock) List

func (m *InstanceManagerMock) List() ([]string, error)

List is a mock implementation that returns a list of all instances.

func (*InstanceManagerMock) ListInstances

func (m *InstanceManagerMock) ListInstances() ([]api.BigBlueButtonInstance, error)

ListInstances is a mock implementation that returns all instances.

func (*InstanceManagerMock) SetInstances

func (m *InstanceManagerMock) SetInstances(instances map[string]string) error

SetInstances is a mock implementation that set all instances.

type RedisInstanceManager

type RedisInstanceManager struct {
	RDB *redis.Client
}

RedisInstanceManager is the redis implementation of InstanceManager

func (*RedisInstanceManager) Add

Add adds an instance to the manager

func (*RedisInstanceManager) Get

Get retrieve a BigBlueButton instance based on its url

func (*RedisInstanceManager) List

func (m *RedisInstanceManager) List() ([]string, error)

List returns the list of instances

func (*RedisInstanceManager) ListInstances

func (m *RedisInstanceManager) ListInstances() ([]api.BigBlueButtonInstance, error)

ListInstances retrieve all instance as a BigBlueButtonInstance array

func (*RedisInstanceManager) SetInstances

func (m *RedisInstanceManager) SetInstances(instances map[string]string) error

SetInstances set instances map

type RedisTenantManager

type RedisTenantManager struct {
	RDB *redis.Client
}

RedisTenantManager is the redis implementation of TenantManager

func (*RedisTenantManager) AddTenant

func (r *RedisTenantManager) AddTenant(tenant *Tenant) error

AddTenant store tenant in redis

func (*RedisTenantManager) DeleteTenant

func (r *RedisTenantManager) DeleteTenant(hostname string) error

DeleteTenant delete a specific tenant based on tenant hostname

func (*RedisTenantManager) GetTenant

func (r *RedisTenantManager) GetTenant(hostname string) (*Tenant, error)

GetTenant retrieve a tenant from a hostname

func (*RedisTenantManager) ListTenants

func (r *RedisTenantManager) ListTenants() ([]TenantListObject, error)

ListTenants list all tenants in the system

type Tenant

type Tenant struct {
	Kind      string            `yaml:"kind" json:"kind"`
	Spec      map[string]string `yaml:"spec" json:"spec"`
	Instances []string          `yaml:"instances" json:"instances"`
}

Tenant represents the kind Tenant configuration struct file

type TenantList

type TenantList struct {
	Kind    string             `yaml:"kind" json:"kind"`
	Tenants []TenantListObject `yaml:"tenants" json:"tenants"`
}

TenantList represents the system tenant list

type TenantListObject

type TenantListObject struct {
	Hostname      string `json:"hostname"`
	InstanceCount int    `json:"instance_count"`
}

TenantListObject represents a Tenant in a TenantList

type TenantManager

type TenantManager interface {
	// AddTenant add a tenant in the manager
	AddTenant(tenant *Tenant) error
	// ListTenants list all tenants in the system
	ListTenants() ([]TenantListObject, error)
	// DeleteTenant delete a specific tenant based on tenant hostname
	DeleteTenant(hostname string) error
	// GetTenant retrieve a tenant from a hostname
	GetTenant(hostname string) (*Tenant, error)
}

TenantManager is a struct manager b3lb tenants

func NewTenantManager

func NewTenantManager(redis redis.Client) TenantManager

NewTenantManager initialize a new tenant manager

type TenantManagerMock

type TenantManagerMock struct{}

TenantManagerMock is a mock implementation of the TenantManager interface.

func (*TenantManagerMock) AddTenant

func (t *TenantManagerMock) AddTenant(tenant *Tenant) error

AddTenant is a mock implementation that add a tenant

func (*TenantManagerMock) DeleteTenant

func (t *TenantManagerMock) DeleteTenant(hostname string) error

DeleteTenant is a mock implementation that will delete a given tenant

func (*TenantManagerMock) GetTenant

func (t *TenantManagerMock) GetTenant(hostname string) (*Tenant, error)

GetTenant is a mock implementation that retrieve a tenant from a hostname

func (*TenantManagerMock) ListTenants

func (t *TenantManagerMock) ListTenants() ([]TenantListObject, error)

ListTenants is a mock implementation that list all tenants

Jump to

Keyboard shortcuts

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