project

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(project *Project)

Option the is fun to set *Project property

func WithBundle

func WithBundle(bundle *bundle.Bundle) Option

WithBundle sets the bundle to invoke other services

func WithCMP

func WithCMP(cmpServer dashboardPb.ClusterResourceServer) Option

WithCMP sets the gRPC client to invoke CMP service Todo: the dependency on CMP will be moved to a service which is more suitable

func WithClusterSvc

func WithClusterSvc(clusterSvc clusterpb.ClusterServiceServer) Option

func WithNamespace

func WithNamespace(ns *namespace.Namespace) Option

func WithOrg

func WithOrg(org org.Interface) Option

func WithTokenSvc

func WithTokenSvc(tokenService tokenpb.TokenServiceServer) Option

func WithTrans

func WithTrans(translator i18n.Translator) Option

WithTrans sets the translator for i18n

type PackageContext

type PackageContext struct {
	ProjectID   uint64 `json:"projectID"`
	ProjectName string `json:"projectName"`
	OrgID       uint64 `json:"orgID"`
	OrgName     string `json:"orgName"`
	apistructs.IdentityInfo
}

type PackageDB

type PackageDB struct {
	Artifacts []apistructs.Artifact `json:"artifacts"`
	Package   *apistructs.ProjectPackage

	TempDir string
	// contains filtered or unexported fields
}

func (*PackageDB) GetContext

func (t *PackageDB) GetContext() *PackageContext

func (*PackageDB) GetPackageName

func (t *PackageDB) GetPackageName() string

func (*PackageDB) GetProjectPackage

func (t *PackageDB) GetProjectPackage() *apistructs.ProjectPackage

func (*PackageDB) GetTempDir

func (t *PackageDB) GetTempDir() string

func (*PackageDB) InitData

func (t *PackageDB) InitData()

func (*PackageDB) SetMeta

func (t *PackageDB) SetMeta() error

func (*PackageDB) SetProject

func (t *PackageDB) SetProject() error

type PackageDataCreator

type PackageDataCreator interface {
	GetPackageName() string
	InitData()
	SetProject() error
	SetMeta() error
	GetProjectPackage() *apistructs.ProjectPackage
	GetTempDir() string
	GetContext() *PackageContext
}

type PackageDataDirector

type PackageDataDirector struct {
	Creator PackageDataCreator
	// contains filtered or unexported fields
}

func (*PackageDataDirector) CheckPackage

func (t *PackageDataDirector) CheckPackage() error

func (*PackageDataDirector) Construct

func (t *PackageDataDirector) Construct() error

func (*PackageDataDirector) GenAndUploadZipPackage

func (t *PackageDataDirector) GenAndUploadZipPackage() (string, error)

func (*PackageDataDirector) GenDesc

func (t *PackageDataDirector) GenDesc() string

func (*PackageDataDirector) GenErrInfo

func (t *PackageDataDirector) GenErrInfo() error

func (*PackageDataDirector) New

func (*PackageDataDirector) TryInitProjectByPackage

func (t *PackageDataDirector) TryInitProjectByPackage() error

type PackageZip

type PackageZip struct {
	ProjectPackage *apistructs.ProjectPackage

	TmpDir string
	// contains filtered or unexported fields
}

func (*PackageZip) GetContext

func (t *PackageZip) GetContext() *PackageContext

func (*PackageZip) GetPackageName

func (t *PackageZip) GetPackageName() string

func (*PackageZip) GetProjectPackage

func (t *PackageZip) GetProjectPackage() *apistructs.ProjectPackage

func (*PackageZip) GetTempDir

func (t *PackageZip) GetTempDir() string

func (*PackageZip) InitData

func (t *PackageZip) InitData()

func (*PackageZip) SetMeta

func (t *PackageZip) SetMeta() error

func (*PackageZip) SetProject

func (t *PackageZip) SetProject() error

type Project

type Project struct {
	CreateFileRecord func(req apistructs.TestFileRecordRequest) (uint64, error)
	UpdateFileRecord func(req apistructs.TestFileRecordRequest) error
	// contains filtered or unexported fields
}

func New

func New(options ...Option) *Project

func (*Project) ExportPackage

func (p *Project) ExportPackage(req apistructs.ExportProjectPackageRequest) (uint64, error)

func (*Project) ExportProjectPackage

func (p *Project) ExportProjectPackage(record *dao.TestFileRecord)

func (*Project) ExportTemplate

func (p *Project) ExportTemplate(req apistructs.ExportProjectTemplateRequest) (uint64, error)

func (*Project) ExportTemplatePackage

func (p *Project) ExportTemplatePackage(record *dao.TestFileRecord)

func (*Project) Get

Get gets the project info. id is the project id.

func (*Project) ImportPackage

func (p *Project) ImportPackage(req apistructs.ImportProjectPackageRequest, r *http.Request) (uint64, error)

func (*Project) ImportProjectPackage

func (p *Project) ImportProjectPackage(record *dao.TestFileRecord)

func (*Project) ImportTemplate

func (p *Project) ImportTemplate(req apistructs.ImportProjectTemplateRequest, r *http.Request) (uint64, error)

func (*Project) ImportTemplatePackage

func (p *Project) ImportTemplatePackage(record *dao.TestFileRecord)

func (*Project) MakePackageName

func (p *Project) MakePackageName(origin string) string

func (*Project) MakeTemplatePackageName

func (p *Project) MakeTemplatePackageName(origin string) string

func (*Project) ParsePackage

func (p *Project) ParsePackage(r io.ReadCloser) (*apistructs.ProjectPackage, error)

func (*Project) ParseTemplatePackage

func (p *Project) ParseTemplatePackage(r io.ReadCloser) (*apistructs.ProjectTemplateData, error)

type TemplateDB

type TemplateDB struct {
	ProjectID   uint64 `json:"projectID"`
	ProjectName string `json:"projectName"`
	OrgID       int64  `json:"orgID"`
	Data        *apistructs.ProjectTemplateData

	apistructs.IdentityInfo
	// contains filtered or unexported fields
}

func (*TemplateDB) GetIdentityInfo

func (t *TemplateDB) GetIdentityInfo() apistructs.IdentityInfo

func (*TemplateDB) GetPackageName

func (t *TemplateDB) GetPackageName() string

func (*TemplateDB) GetProjectID

func (t *TemplateDB) GetProjectID() uint64

func (*TemplateDB) GetProjectTemplate

func (t *TemplateDB) GetProjectTemplate() *apistructs.ProjectTemplateData

func (*TemplateDB) InitData

func (t *TemplateDB) InitData()

func (*TemplateDB) SetApplications

func (t *TemplateDB) SetApplications() error

func (*TemplateDB) SetMeta

func (t *TemplateDB) SetMeta() error

type TemplateDataCreator

type TemplateDataCreator interface {
	GetPackageName() string
	InitData()
	SetApplications() error
	SetMeta() error
	GetProjectTemplate() *apistructs.ProjectTemplateData
	GetProjectID() uint64
	GetIdentityInfo() apistructs.IdentityInfo
}

type TemplateDataDirector

type TemplateDataDirector struct {
	Creator TemplateDataCreator
	// contains filtered or unexported fields
}

func (*TemplateDataDirector) CheckTemplatePackage

func (t *TemplateDataDirector) CheckTemplatePackage() error

func (*TemplateDataDirector) Construct

func (t *TemplateDataDirector) Construct() error

func (*TemplateDataDirector) GenAndUploadZipPackage

func (t *TemplateDataDirector) GenAndUploadZipPackage() (string, error)

func (*TemplateDataDirector) GenDesc

func (t *TemplateDataDirector) GenDesc() string

func (*TemplateDataDirector) GenErrInfo

func (t *TemplateDataDirector) GenErrInfo() error

func (*TemplateDataDirector) New

func (t *TemplateDataDirector) New(creator TemplateDataCreator, bdl *bundle.Bundle, namespace *namespace.Namespace)

func (*TemplateDataDirector) TryCreateAppsByTemplate

func (t *TemplateDataDirector) TryCreateAppsByTemplate() error

type TemplateZip

type TemplateZip struct {
	ProjectID   uint64 `json:"projectID"`
	ProjectName string `json:"projectName"`
	OrgID       int64  `json:"orgID"`
	Data        *apistructs.ProjectTemplateData

	apistructs.IdentityInfo
	// contains filtered or unexported fields
}

func (*TemplateZip) GetIdentityInfo

func (t *TemplateZip) GetIdentityInfo() apistructs.IdentityInfo

func (*TemplateZip) GetPackageName

func (t *TemplateZip) GetPackageName() string

func (*TemplateZip) GetProjectID

func (t *TemplateZip) GetProjectID() uint64

func (*TemplateZip) GetProjectTemplate

func (t *TemplateZip) GetProjectTemplate() *apistructs.ProjectTemplateData

func (*TemplateZip) InitData

func (t *TemplateZip) InitData()

func (*TemplateZip) SetApplications

func (t *TemplateZip) SetApplications() error

func (*TemplateZip) SetMeta

func (t *TemplateZip) SetMeta() error

Jump to

Keyboard shortcuts

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