tenant

package
v0.0.0-...-4cfaa68 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBService

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

func (DBService) Exists

func (s DBService) Exists(tenantID uuid.UUID) bool

func (DBService) GetNamespaces

func (s DBService) GetNamespaces(tenantID uuid.UUID) ([]*Namespace, error)

func (DBService) GetTenant

func (s DBService) GetTenant(tenantID uuid.UUID) (*Tenant, error)

func (DBService) UpdateNamespace

func (s DBService) UpdateNamespace(namespace *Namespace) error

func (DBService) UpdateTenant

func (s DBService) UpdateTenant(tenant *Tenant) error

type Namespace

type Namespace struct {
	ID        uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
	TenantID  uuid.UUID `sql:"type:uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
	Name      string
	MasterURL string
	Type      NamespaceType
	Version   string
	State     string
}

Namespace represent a single namespace owned by an Tenant

func (Namespace) TableName

func (m Namespace) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type NamespaceType

type NamespaceType string

NamespaceType describes which type of namespace this is

const (
	TypeChe     NamespaceType = "che"
	TypeJenkins NamespaceType = "jenkins"
	TypeTest    NamespaceType = "test"
	TypeStage   NamespaceType = "stage"
	TypeRun     NamespaceType = "run"
	TypeUser    NamespaceType = "user"
)

Represents the namespace type

func GetNamespaceType

func GetNamespaceType(name string) NamespaceType

GetNamespaceType attempts to extract the namespace type based on namespace name

func (*NamespaceType) Scan

func (ns *NamespaceType) Scan(value interface{}) error

Scan - Implement the database/sql scanner interface

func (NamespaceType) Value

func (ns NamespaceType) Value() (driver.Value, error)

Value - Implementation of valuer for database/sql

type NilService

type NilService struct {
}

func (NilService) Exists

func (s NilService) Exists(tenantID uuid.UUID) bool

func (NilService) GetNamespaces

func (s NilService) GetNamespaces(tenantID uuid.UUID) ([]*Namespace, error)

func (NilService) GetTenant

func (s NilService) GetTenant(tenantID uuid.UUID) (*Tenant, error)

func (NilService) UpdateNamespace

func (s NilService) UpdateNamespace(namespace *Namespace) error

func (NilService) UpdateTenant

func (s NilService) UpdateTenant(tenant *Tenant) error

type Service

type Service interface {
	Exists(tenantID uuid.UUID) bool
	GetTenant(tenantID uuid.UUID) (*Tenant, error)
	GetNamespaces(tenantID uuid.UUID) ([]*Namespace, error)
	UpdateTenant(tenant *Tenant) error
	UpdateNamespace(namespace *Namespace) error
}

func NewDBService

func NewDBService(db *gorm.DB) Service

type Tenant

type Tenant struct {
	ID        uuid.UUID `sql:"type:uuid" gorm:"primary_key"` // This is the ID PK field
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
	Email     string
}

Tenant is the owning OpenShift account

func (Tenant) TableName

func (m Tenant) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

Jump to

Keyboard shortcuts

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