biz

package
v1.0.56 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package biz @author <chengjiang@buffalo-robot.com> @date 2023-06-28 @note

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type BackupBiz added in v1.0.55

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

func NewBackupBiz added in v1.0.55

func NewBackupBiz(serverRepo ServerRepo,
	serverUseCase *ServerUsecase,
	backupRepo BackupRepo,
	logger *zap.Logger) *BackupBiz

func (*BackupBiz) CronRun added in v1.0.55

func (b *BackupBiz) CronRun()

func (*BackupBiz) ListBackup added in v1.0.55

func (b *BackupBiz) ListBackup() ([]*model.BackupData, error)

func (*BackupBiz) UploadToOss added in v1.0.55

func (b *BackupBiz) UploadToOss(client *minio.Client, backupFilePath string) error

type BackupRepo added in v1.0.55

type BackupRepo interface {
	GetBackupList(ctx context.Context) ([]*model.BackupData, error)
	CreateBackup(ctx context.Context, data *model.BackupData) error
	DeleteBackup(ctx context.Context, idList []int64) error
}

type ConfigRepo

type ConfigRepo interface {
	// RegisterConfigByWeb RegisterConfig(config *configs.FormatAppConfig) error
	// 通过http进行配置注册,写入到配置中心。
	RegisterConfigByWeb(config *configs.FormatAppConfig, nameSpace, dir string) error
	// ReadConfigFiles 根据命名空间读取所有的配置文件。
	ReadConfigFiles(nameSpace string) ([]*configs.AppConfig, error)
	// 读取指定的配置服务配置。
	GetConfig(nameSpace, appId string) (*configs.AppConfig, error)
	// GetFormatConfig 格式化了的配置信息,将字符串的json序列化为map。dir:环境(如:Data,Public)。
	GetFormatConfig(nameSpace, appId string, dir string) (*configs.FormatAppConfig, error)
	// CreateNameSpace 创建域,查询域。
	CreateNameSpace(nameSpace string) error
	QueryNameSpace(nameSpace string) (*configs.NameSpace, error)
	QueryNameSpaceList() ([]*configs.NameSpace, error)
}

type ConfigUseCase

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

func NewConfigUseCase

func NewConfigUseCase(configRepo ConfigRepo) *ConfigUseCase

func (*ConfigUseCase) CreateNameSpace

func (c *ConfigUseCase) CreateNameSpace(nameSpace string) error

func (*ConfigUseCase) GetConfig

func (c *ConfigUseCase) GetConfig(nameSpace, appId string) (*configs.AppConfig, error)

func (*ConfigUseCase) GetFormatConfig

func (c *ConfigUseCase) GetFormatConfig(nameSpace, appId string, dir string) (*configs.FormatAppConfig, error)

func (*ConfigUseCase) QueryNameSpace

func (c *ConfigUseCase) QueryNameSpace(nameSpace string) (*configs.NameSpace, error)

func (*ConfigUseCase) QueryNameSpaceList

func (c *ConfigUseCase) QueryNameSpaceList() ([]*configs.NameSpace, error)

func (*ConfigUseCase) ReadConfigFiles

func (c *ConfigUseCase) ReadConfigFiles(nameSpace string) ([]*configs.AppConfig, error)

func (*ConfigUseCase) RegisterConfigByWeb

func (c *ConfigUseCase) RegisterConfigByWeb(config *configs.FormatAppConfig, nameSpace, dir string) error

type DependInfo added in v1.0.55

type DependInfo struct {
	Code         string
	Running      bool
	HasInstalled bool
}

type DependStatus added in v1.0.55

type DependStatus struct {
	ServerID     int64
	ServerIP     string
	Code         string
	ServerDesc   string
	Running      bool
	HasInstalled bool
}

type DirDesc added in v1.0.55

type DirDesc struct {
	Name           string
	IsDir          bool
	LastUpdateTime string
	Size           string
}

ls 文件描述

type ServerRepo added in v1.0.55

type ServerRepo interface {
	GetServerList(ctx context.Context) ([]*model.Server, error)
	CreateServer(ctx context.Context, srv *model.Server) error
	UpdateServer(ctx context.Context, id int64, srv *model.Server) error
	GetServerByIp(ctx context.Context, ip string) (*model.Server, error)
	GetServerByID(ctx context.Context, id int64) (*model.Server, error)
	GetServerClient(ctx context.Context, server *model.Server) (*ssh.SSHClient, error)
}

type ServerServiceRepo added in v1.0.55

type ServerServiceRepo interface {
	CreateServerService(context.Context, []*model.ServerServiceBind) error
	ListServerService(context.Context, int64) ([]*model.ServerServiceBind, error)
	UpdateServerService(ctx context.Context,
		serverID int64, code string, bind *model.ServerServiceBind) error
	GetServerService(ctx context.Context, serverID int64, serviceCode string) (*model.ServerServiceBind, error)
	GetServerServiceByID(context.Context, int64) (*model.ServerServiceBind, error)
}

type ServerServiceUseCase added in v1.0.55

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

func NewServerServiceUseCase added in v1.0.55

func NewServerServiceUseCase(serverServiceRepo ServerServiceRepo,
	serviceVersionRepo ServiceVersionRepo,
	serverUseCase *ServerUsecase,
	serverRepo ServerRepo,
	logger *zap.Logger,
) *ServerServiceUseCase

func (*ServerServiceUseCase) ListProduct added in v1.0.55

func (s *ServerServiceUseCase) ListProduct(ctx context.Context) []component.Product

func (*ServerServiceUseCase) ListServerServices added in v1.0.55

func (s *ServerServiceUseCase) ListServerServices(ctx context.Context, serverID int64) ([]*model.ServerServiceBind, map[string]*DependStatus, error)

func (*ServerServiceUseCase) ListServiceVersion added in v1.0.55

func (s *ServerServiceUseCase) ListServiceVersion(ctx context.Context, versionIDList []int64) (map[int64]*model.ServiceVersion, error)

func (*ServerServiceUseCase) ProductDependIPPut added in v1.0.55

func (s *ServerServiceUseCase) ProductDependIPPut(ctx context.Context, serverID int64, Ip string, componentCode string) error

func (*ServerServiceUseCase) ProductInstall added in v1.0.55

func (s *ServerServiceUseCase) ProductInstall(ctx context.Context, serverID int64,
	productCode string,
	depends *component.ProductDepends,
) error

func (*ServerServiceUseCase) ServiceInit added in v1.0.55

func (s *ServerServiceUseCase) ServiceInit(ctx context.Context, serverID int64, serviceCode string, skip int32) error

ServiceInit 当skip为1时进行初始化 为2不进行真正的初始化

func (*ServerServiceUseCase) ServiceInstall added in v1.0.55

func (s *ServerServiceUseCase) ServiceInstall(ctx context.Context, version, serviceCode, installPath string,
	serverID int64,
	parameters []*component.ComponentParameters,
) error

func (*ServerServiceUseCase) ServiceRunningStatus added in v1.0.55

func (s *ServerServiceUseCase) ServiceRunningStatus(serverIp string, serviceComponent component.ServiceComponent) (bool, error)

func (*ServerServiceUseCase) ServiceUninstall added in v1.0.55

func (s *ServerServiceUseCase) ServiceUninstall(ctx context.Context, serverID int64, serviceCode string) error

func (*ServerServiceUseCase) ServiceUpdate added in v1.0.55

func (s *ServerServiceUseCase) ServiceUpdate(ctx context.Context, serverID int64, serviceCode string, version, imagePath string) error

func (*ServerServiceUseCase) ServiceVersionList added in v1.0.55

func (s *ServerServiceUseCase) ServiceVersionList(ctx context.Context, serverID int64, serviceCode string,
	page, perPage int32,
) ([]*model.ServiceVersion, *model.ServerServiceBind, int64, error)

func (*ServerServiceUseCase) ServiceVersionRevert added in v1.0.55

func (s *ServerServiceUseCase) ServiceVersionRevert(ctx context.Context, versionID int64) error

type ServerUsecase added in v1.0.55

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

func NewServerUsecase added in v1.0.55

func NewServerUsecase(serverRepo ServerRepo,
	logger *zap.Logger) *ServerUsecase

func (*ServerUsecase) CreateDir added in v1.0.55

func (s *ServerUsecase) CreateDir(ctx context.Context, serverID int64, path string) error

func (*ServerUsecase) CreateServer added in v1.0.55

func (s *ServerUsecase) CreateServer(ctx context.Context, ser *model.Server) error

func (*ServerUsecase) GetClient added in v1.0.55

func (s *ServerUsecase) GetClient(serverID int64) *ssh.SSHClient

func (*ServerUsecase) GetComponentRunningStatus added in v1.0.55

func (s *ServerUsecase) GetComponentRunningStatus(serverID int64, code string) (bool, error)

func (*ServerUsecase) GetNginxData added in v1.0.55

func (s *ServerUsecase) GetNginxData(ctx context.Context, serverID int64) (string, error)

func (*ServerUsecase) GetServerComponentList added in v1.0.55

func (s *ServerUsecase) GetServerComponentList(ctx context.Context, serverID int64) ([]*SystemComponentStatus, error)

GetServerComponentList 只返回系统组件

func (*ServerUsecase) GetServerList added in v1.0.55

func (s *ServerUsecase) GetServerList(ctx context.Context) ([]*model.Server, error)

func (*ServerUsecase) GetSystemComponentByCode added in v1.0.55

func (s *ServerUsecase) GetSystemComponentByCode(code string) component.SystemComponent

func (*ServerUsecase) InstallExistedSystemComponent added in v1.0.55

func (s *ServerUsecase) InstallExistedSystemComponent(ctx context.Context, componentCode string, serverID int64) error

func (*ServerUsecase) InstallSystemComponent added in v1.0.55

func (s *ServerUsecase) InstallSystemComponent(ctx context.Context, serverID int64,
	componentCode,
	installPackegePath string,
	parameters []*component.ComponentParameters,
) error

func (*ServerUsecase) IsSSHConnect added in v1.0.55

func (s *ServerUsecase) IsSSHConnect(serverID int64) bool

func (*ServerUsecase) ListServerDir added in v1.0.55

func (s *ServerUsecase) ListServerDir(ctx context.Context, serverID int64, path string) ([]*DirDesc, error)

func (*ServerUsecase) SystemComponent added in v1.0.55

func (s *ServerUsecase) SystemComponent(ctx context.Context, serverID int64,
	componectCode string) error

func (*ServerUsecase) SystemComponentOperate added in v1.0.55

func (s *ServerUsecase) SystemComponentOperate(ctx context.Context,
	serverID int64,
	componectCode string,
	operate component.OperateType,
) error

func (*ServerUsecase) UFW added in v1.0.55

func (s *ServerUsecase) UFW(ctx context.Context, serverID int64) (status string, err error)

func (*ServerUsecase) UninstallSystemComponent added in v1.0.55

func (s *ServerUsecase) UninstallSystemComponent(ctx context.Context, serverID int64, systemComponentCode string) error

func (*ServerUsecase) UpdateNginxData added in v1.0.55

func (s *ServerUsecase) UpdateNginxData(ctx context.Context, serverID int64, conf string) error

func (*ServerUsecase) UpdateServer added in v1.0.55

func (s *ServerUsecase) UpdateServer(ctx context.Context, id int64, ser *model.Server) error

func (*ServerUsecase) UploadFile added in v1.0.55

func (s *ServerUsecase) UploadFile(ctx context.Context, serverID int64, localFileName string, remoteFileName string) error

type ServiceVersionRepo added in v1.0.55

type ServiceVersionRepo interface {
	CreateServiceVersion(context.Context, *model.ServiceVersion) error
	GetServiceVersionByID(context.Context, int64) (*model.ServiceVersion, error)
	ListServiceVersionByIDList(context.Context, []int64) (map[int64]*model.ServiceVersion, error)
	ListServiceVersion(ctx context.Context, serverID, serviceID int64, page, perPage int32) ([]*model.ServiceVersion, int64, error)
}

type SystemComponentStatus added in v1.0.55

type SystemComponentStatus struct {
	ComponentName string
	ComponentCode string
	HasInstalled  bool
	IsRunning     bool
	Parameters    []*component.ComponentParameters
	CanInstalled  bool
	Depends       []*DependInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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