tenant

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Namespace

type Namespace struct {
	ID     uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"`
	Name   string    `gorm:"not null;unique"`
	Config datatypes.JSON

	ProjectName string `json:"project_name"`

	CreatedAt time.Time `gorm:"not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
	DeletedAt gorm.DeletedAt
}

func NewNamespace

func NewNamespace(spec *tenant.Namespace) (Namespace, error)

func (Namespace) ToTenantNamespace

func (n Namespace) ToTenantNamespace() (*tenant.Namespace, error)

type NamespaceRepository

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

func NewNamespaceRepository

func NewNamespaceRepository(db *gorm.DB) *NamespaceRepository

func (*NamespaceRepository) GetAll

func (n *NamespaceRepository) GetAll(ctx context.Context, projectName tenant.ProjectName) ([]*tenant.Namespace, error)

func (*NamespaceRepository) GetByName

func (*NamespaceRepository) Save

func (n *NamespaceRepository) Save(ctx context.Context, tenantNamespace *tenant.Namespace) error

type Project

type Project struct {
	ID     uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"`
	Name   string    `gorm:"not null;unique"`
	Config datatypes.JSON

	CreatedAt time.Time `gorm:"not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
	DeletedAt gorm.DeletedAt
}

func NewProject

func NewProject(spec *tenant.Project) (Project, error)

func (Project) ToTenantProject

func (p Project) ToTenantProject() (*tenant.Project, error)

type ProjectRepository

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

func NewProjectRepository

func NewProjectRepository(db *gorm.DB) *ProjectRepository

func (ProjectRepository) GetAll

func (repo ProjectRepository) GetAll(ctx context.Context) ([]*tenant.Project, error)

func (ProjectRepository) GetByName

func (repo ProjectRepository) GetByName(ctx context.Context, name tenant.ProjectName) (*tenant.Project, error)

func (ProjectRepository) Save

func (repo ProjectRepository) Save(ctx context.Context, tenantProject *tenant.Project) error

type Secret

type Secret struct {
	ID uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"`

	Name  string `gorm:"not null;default:null"`
	Value string

	Type string

	ProjectName   string `json:"project_name"`
	NamespaceName string `json:"namespace_name"`

	CreatedAt time.Time `gorm:"not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
}

func NewSecret

func NewSecret(secret *tenant.Secret) Secret

func (Secret) ToSecretInfo

func (s Secret) ToSecretInfo() (*dto.SecretInfo, error)

func (Secret) ToTenantSecret

func (s Secret) ToTenantSecret() (*tenant.Secret, error)

type SecretRepository

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

func NewSecretRepository

func NewSecretRepository(db *gorm.DB) *SecretRepository

func (SecretRepository) Delete

func (s SecretRepository) Delete(ctx context.Context, projName tenant.ProjectName, nsName string, name tenant.SecretName) error

Delete will not support soft delete, once deleted it has to be created again

func (SecretRepository) Get

func (s SecretRepository) Get(ctx context.Context, projName tenant.ProjectName, nsName string, name tenant.SecretName) (*tenant.Secret, error)

Get is scoped to the tenant provided in the argument

func (SecretRepository) GetAll

func (s SecretRepository) GetAll(ctx context.Context, projName tenant.ProjectName, nsName string) ([]*tenant.Secret, error)

func (SecretRepository) GetSecretsInfo

func (s SecretRepository) GetSecretsInfo(ctx context.Context, projName tenant.ProjectName) ([]*dto.SecretInfo, error)

func (SecretRepository) Save

func (s SecretRepository) Save(ctx context.Context, tenantSecret *tenant.Secret) error

func (SecretRepository) Update

func (s SecretRepository) Update(ctx context.Context, tenantSecret *tenant.Secret) error

Jump to

Keyboard shortcuts

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