service

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Overview

Copyright 2023 The KodeRover Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2023 The KodeRover Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	CardNameRunningWorkflow        = "运行中的工作流"
	CardNameServiceUpdateFrequency = "服务热力图"
)
View Source
const (
	CardTypeRunningWorkflow        = "running_workflow"
	CardTypeServiceUpdateFrequency = "service_update_frequency"
	CardTypeMyWorkflow             = "my_workflow"
	CardTypeMyEnv                  = "my_env"
)
View Source
const (
	PERPAGE = 100
	PAGE    = 1
)
View Source
const (
	CleanStatusUnStart  = "unStart"
	CleanStatusSuccess  = "success"
	CleanStatusCleaning = "cleaning"
	CleanStatusFailed   = "failed"
)

Variables

View Source
var ClusterProviderValueNames map[int8]string = map[int8]string{
	1: "阿里云 ACK",
	2: "腾讯云 TKE",
	3: "华为云 CCE",
	4: "Amazon EKS",
	5: "腾讯云 TKE Serverless",
	0: "其它",
}
View Source
var ImageTagsReqStatus = struct {
	M    sync.Mutex
	List map[string]struct{}
}{
	M:    sync.Mutex{},
	List: make(map[string]struct{}),
}

ImageTagsReqStatus its a global map to store the status of the image list request

Functions

func BatchCreatePrivateKey

func BatchCreatePrivateKey(args []*commonmodels.PrivateKey, option, username string, log *zap.SugaredLogger) error

override: Full coverage (temporarily reserved) increment: Incremental coverage patch: Overwrite existing

func CheckLLMIntegration

func CheckLLMIntegration(ctx context.Context) (bool, error)

func CheckReqLimit

func CheckReqLimit(key string) bool

func CleanCache

func CleanCache() error

func CleanImageCache

func CleanImageCache(logger *zap.SugaredLogger) error

func CleanSharedStorage

func CleanSharedStorage() error

func CreateAnnouncement

func CreateAnnouncement(creater string, ctx *systemmodel.Announcement, log *zap.SugaredLogger) error

func CreateBasicImage

func CreateBasicImage(args *commonmodels.BasicImage, log *zap.SugaredLogger) error

func CreateConfigurationManagement

func CreateConfigurationManagement(args *commonmodels.ConfigurationManagement, log *zap.SugaredLogger) error
func CreateExternalLink(args *commonmodels.ExternalLink, log *zap.SugaredLogger) error

func CreateExternalSystem

func CreateExternalSystem(args *ExternalSystemDetail, log *zap.SugaredLogger) error

func CreateHelmRepo

func CreateHelmRepo(args *commonmodels.HelmRepo, log *zap.SugaredLogger) error

func CreateIMApp

func CreateIMApp(args *commonmodels.IMApp, log *zap.SugaredLogger) error

func CreateInstall

func CreateInstall(args *commonmodels.Install, log *zap.SugaredLogger) error

func CreateJenkinsIntegration

func CreateJenkinsIntegration(args *commonmodels.JenkinsIntegration, log *zap.SugaredLogger) error

func CreateLLMIntegration

func CreateLLMIntegration(ctx context.Context, args *commonmodels.LLMIntegration) error

func CreateObservability

func CreateObservability(args *models.Observability) error

func CreateOrUpdateDashboardConfiguration

func CreateOrUpdateDashboardConfiguration(username, userID string, config *DashBoardConfig, log *zap.SugaredLogger) error

func CreateOrUpdateSecuritySettings

func CreateOrUpdateSecuritySettings(args *SecurityAndPrivacySettings, logger *zap.SugaredLogger) error

func CreateProjectManagement

func CreateProjectManagement(pm *models.ProjectManagement, log *zap.SugaredLogger) error

func CreateProxy

func CreateProxy(args *commonmodels.Proxy, log *zap.SugaredLogger) error

func CreateRegistryNamespace

func CreateRegistryNamespace(username string, args *commonmodels.RegistryNamespace, log *zap.SugaredLogger) error

func CreateS3Storage

func CreateS3Storage(updateBy string, storage *commonmodels.S3Storage, logger *zap.SugaredLogger) error

func CreateSonarIntegration

func CreateSonarIntegration(args *SonarIntegration, log *zap.SugaredLogger) error

func DeleteAnnouncement

func DeleteAnnouncement(user, id string, log *zap.SugaredLogger) error

func DeleteBasicImage

func DeleteBasicImage(id string, log *zap.SugaredLogger) error

func DeleteConfigurationManagement

func DeleteConfigurationManagement(id string, log *zap.SugaredLogger) error
func DeleteExternalLink(id string, log *zap.SugaredLogger) error

func DeleteExternalSystem

func DeleteExternalSystem(id string, log *zap.SugaredLogger) error

func DeleteHelmRepo

func DeleteHelmRepo(id string, log *zap.SugaredLogger) error

func DeleteIMApp

func DeleteIMApp(id string, log *zap.SugaredLogger) error

func DeleteInstall

func DeleteInstall(name, version string, log *zap.SugaredLogger) error

func DeleteJenkinsIntegration

func DeleteJenkinsIntegration(ID string, log *zap.SugaredLogger) error

func DeleteLLMIntegration

func DeleteLLMIntegration(ctx context.Context, ID string) error

func DeleteNotifies

func DeleteNotifies(user string, notifyIDs []string, log *zap.SugaredLogger) error

func DeleteObservability

func DeleteObservability(id string) error

func DeletePrivateKey

func DeletePrivateKey(id, userName string, log *zap.SugaredLogger) error

func DeleteProjectManagement

func DeleteProjectManagement(idHex string, log *zap.SugaredLogger) error

func DeleteProxy

func DeleteProxy(id string, log *zap.SugaredLogger) error

func DeleteRegistryNamespace

func DeleteRegistryNamespace(id string, log *zap.SugaredLogger) error

func DeleteS3Storage

func DeleteS3Storage(deleteBy string, id string, logger *zap.SugaredLogger) error

func DeleteSonarIntegration

func DeleteSonarIntegration(id string, log *zap.SugaredLogger) error

func FindOperation

func FindOperation(args *OperationLogArgs, log *zap.SugaredLogger) ([]*models.OperationLog, int, error)

func GetBasicImage

func GetBasicImage(id string, log *zap.SugaredLogger) (*commonmodels.BasicImage, error)

func GetConfigurationManagement

func GetConfigurationManagement(id string, log *zap.SugaredLogger) (*commonmodels.ConfigurationManagement, error)

func GetInstall

func GetInstall(name, version string, log *zap.SugaredLogger) (*commonmodels.Install, error)

func GetJiraAllStatus

func GetJiraAllStatus(id, project string) ([]string, error)

func GetJiraTypes

func GetJiraTypes(id, project string) ([]*jira.IssueTypeWithStatus, error)

func GetLLMIntegration

func GetLLMIntegration(ctx context.Context, id string) (*commonmodels.LLMIntegration, error)

func GetNacosConfig

func GetNacosConfig(id, namespace, groupName, dataName string, log *zap.SugaredLogger) (*types.NacosConfig, error)

func GetOrCreateCleanCacheState

func GetOrCreateCleanCacheState() (*commonmodels.DindClean, error)

GetOrCreateCleanCacheState 获取清理镜像缓存状态,如果数据库中没有数据返回一个临时对象

func GetPrivateKey

func GetPrivateKey(id string, log *zap.SugaredLogger) (*commonmodels.PrivateKey, error)

func GetProxy

func GetProxy(id string, log *zap.SugaredLogger) (*commonmodels.Proxy, error)

func GetRepoTags

func GetRepoTags(registryInfo *commonmodels.RegistryNamespace, name string, log *zap.SugaredLogger) (*registry.ImagesResp, error)

func GetS3Storage

func GetS3Storage(id string, logger *zap.SugaredLogger) (*commonmodels.S3Storage, error)

func GetThemeInfos

func GetThemeInfos(log *zap.SugaredLogger) (*types.Theme, error)

func GithubAppAdd

func GithubAppAdd(args *commonmodels.GithubApp) error

func GithubAppDelete

func GithubAppDelete(id string) error

func GithubAppList

func GithubAppList() ([]*commonmodels.GithubApp, error)

func HandleJiraHookEvent

func HandleJiraHookEvent(workflowName, hookName string, event *jira.Event, logger *zap.SugaredLogger) error

func HandleMeegoHookEvent

func HandleMeegoHookEvent(workflowName, hookName string, event *meego.GeneralWebhookRequest, logger *zap.SugaredLogger) error

func HandleSystemGC

func HandleSystemGC(dryRun bool) error

func InitInstallMap

func InitInstallMap() map[string]*commonmodels.Install

func InitbasicImageInfos

func InitbasicImageInfos() []*commonmodels.BasicImage

func InitializeUser

func InitializeUser(username, password, company, email string, phone int64, improvementPlan bool, logger *zap.SugaredLogger) error

func ListApolloApps

func ListApolloApps(id string, log *zap.SugaredLogger) ([]string, error)

func ListApolloConfigByType

func ListApolloConfigByType(id, appID, format string, log *zap.SugaredLogger) ([]*apollo.BriefNamespace, error)

func ListApolloEnvAndClusters

func ListApolloEnvAndClusters(id string, appID string, log *zap.SugaredLogger) ([]*apollo.EnvAndCluster, error)

func ListApolloNamespaces

func ListApolloNamespaces(id string, appID string, env string, cluster string, log *zap.SugaredLogger) ([]string, error)

func ListAvaiableInstalls

func ListAvaiableInstalls(log *zap.SugaredLogger) ([]*commonmodels.Install, error)

func ListBasicImages

func ListBasicImages(imageFrom string, imageType string, log *zap.SugaredLogger) ([]*commonmodels.BasicImage, error)

func ListConfigurationManagement

func ListConfigurationManagement(_type string, log *zap.SugaredLogger) ([]*commonmodels.ConfigurationManagement, error)
func ListExternalLinks(log *zap.SugaredLogger) ([]*commonmodels.ExternalLink, error)

func ListGrafanaAlert

func ListGrafanaAlert(id string) ([]*grafana.ListAlertResp, error)

func ListGuanceyunMonitor

func ListGuanceyunMonitor(id, search string) ([]guanceyun.MonitorContent, error)

func ListHelmRepos

func ListHelmRepos(log *zap.SugaredLogger) ([]*commonmodels.HelmRepo, error)

func ListIMApp

func ListIMApp(_type string, log *zap.SugaredLogger) ([]*commonmodels.IMApp, error)

func ListInstalls

func ListInstalls(log *zap.SugaredLogger) ([]*commonmodels.Install, error)

func ListJenkinsIntegration

func ListJenkinsIntegration(encryptedKey string, log *zap.SugaredLogger) ([]*commonmodels.JenkinsIntegration, error)

func ListJobNames

func ListJobNames(id string, log *zap.SugaredLogger) ([]string, error)

func ListLLMIntegration

func ListLLMIntegration(ctx context.Context) ([]*commonmodels.LLMIntegration, error)

func ListLabels

func ListLabels() ([]string, error)

func ListObservability

func ListObservability(_type string, isAdmin bool) ([]*models.Observability, error)

func ListPrivateKeys

func ListPrivateKeys(encryptedKey, projectName, keyword string, systemOnly bool, log *zap.SugaredLogger) ([]*commonmodels.PrivateKey, error)

func ListPrivateKeysInternal

func ListPrivateKeysInternal(log *zap.SugaredLogger) ([]*commonmodels.PrivateKey, error)

func ListProjectManagement

func ListProjectManagement(log *zap.SugaredLogger) ([]*models.ProjectManagement, error)

func ListProxies

func ListProxies(log *zap.SugaredLogger) ([]*commonmodels.Proxy, error)

func ListRegistries

func ListRegistries(log *zap.SugaredLogger) ([]*commonmodels.RegistryNamespace, error)

ListRegistries 为了抹掉ak和sk的数据

func ListRegistriesByProject

func ListRegistriesByProject(projectName string, log *zap.SugaredLogger) ([]*commonmodels.RegistryNamespace, error)

func ListS3Storage

func ListS3Storage(encryptedKey string, logger *zap.SugaredLogger) ([]*commonmodels.S3Storage, error)

func ListS3StorageByProject

func ListS3StorageByProject(projectName string, logger *zap.SugaredLogger) ([]*commonmodels.S3Storage, error)

func ListSubscriptions

func ListSubscriptions(user string, log *zap.SugaredLogger) ([]*commonmodels.Subscription, error)

func ListTars

func ListTars(id, kind string, serviceNames []string, logger *zap.SugaredLogger) ([]*commonmodels.TarInfo, error)

func OpenAPICreateRegistry

func OpenAPICreateRegistry(username string, req *OpenAPICreateRegistryReq, logger *zap.SugaredLogger) error

func OpenAPIDeleteCluster

func OpenAPIDeleteCluster(userName, clusterID string, logger *zap.SugaredLogger) error

func OpenAPIUpdateCluster

func OpenAPIUpdateCluster(userName, clusterID string, clusterInfo *OpenAPICluster, logger *zap.SugaredLogger) error

func PullAllAnnouncement

func PullAllAnnouncement(user string, log *zap.SugaredLogger) ([]*systemmodel.Announcement, error)

func PullNotify

func PullNotify(user string, log *zap.SugaredLogger) ([]*commonmodels.Notify, error)

func PullNotifyAnnouncement

func PullNotifyAnnouncement(user string, log *zap.SugaredLogger) ([]*systemmodel.Announcement, error)

func ReadNotify

func ReadNotify(user string, notifyIDs []string, log *zap.SugaredLogger) error

func SearchJiraIssues

func SearchJiraIssues(id, project, _type, status, summary string, ne bool) ([]*jira.Issue, error)

func SearchJiraProjectIssuesWithJQL

func SearchJiraProjectIssuesWithJQL(id, project, jql, summary string) ([]*jira.Issue, error)

func SetCron

func SetCron(cron string, cronEnabled bool, logger *zap.SugaredLogger) error

SetCron set the docker clean cron

func SetProxyConfig

func SetProxyConfig()

func SyncDinDForRegistries

func SyncDinDForRegistries() error

func TestConnection

func TestConnection(args *commonmodels.Proxy, log *zap.SugaredLogger) error

func TestJenkinsConnection

func TestJenkinsConnection(args *JenkinsArgs, log *zap.SugaredLogger) error

func Unsubscribe

func Unsubscribe(user string, notifyType int, log *zap.SugaredLogger) error

func UpdateAnnouncement

func UpdateAnnouncement(user string, notifyID string, ctx *systemmodel.Announcement, log *zap.SugaredLogger) error

func UpdateBasicImage

func UpdateBasicImage(id string, args *commonmodels.BasicImage, log *zap.SugaredLogger) error

func UpdateConfigurationManagement

func UpdateConfigurationManagement(id string, args *commonmodels.ConfigurationManagement, log *zap.SugaredLogger) error

func UpdateDefaultLogin

func UpdateDefaultLogin(defaultLogin string, _ *zap.SugaredLogger) error
func UpdateExternalLink(id string, args *commonmodels.ExternalLink, log *zap.SugaredLogger) error

func UpdateExternalSystem

func UpdateExternalSystem(id string, system *ExternalSystemDetail, log *zap.SugaredLogger) error

func UpdateHelmRepo

func UpdateHelmRepo(id string, args *commonmodels.HelmRepo, log *zap.SugaredLogger) error

func UpdateIMApp

func UpdateIMApp(id string, args *commonmodels.IMApp, log *zap.SugaredLogger) error

func UpdateInstall

func UpdateInstall(name, version string, args *commonmodels.Install, log *zap.SugaredLogger) error

func UpdateJenkinsIntegration

func UpdateJenkinsIntegration(ID string, args *commonmodels.JenkinsIntegration, log *zap.SugaredLogger) error

func UpdateLLMIntegration

func UpdateLLMIntegration(ctx context.Context, ID string, args *commonmodels.LLMIntegration) error

func UpdateObservability

func UpdateObservability(id string, args *models.Observability) error

func UpdateOperation

func UpdateOperation(id string, status int, log *zap.SugaredLogger) error

func UpdatePrivateKey

func UpdatePrivateKey(id string, args *commonmodels.PrivateKey, log *zap.SugaredLogger) error

func UpdateProjectManagement

func UpdateProjectManagement(idHex string, pm *models.ProjectManagement, log *zap.SugaredLogger) error

func UpdateProxy

func UpdateProxy(id string, args *commonmodels.Proxy, log *zap.SugaredLogger) error

func UpdateRegistryNamespace

func UpdateRegistryNamespace(username, id string, args *commonmodels.RegistryNamespace, log *zap.SugaredLogger) error

func UpdateRegistryNamespaceDefault

func UpdateRegistryNamespaceDefault(args *commonmodels.RegistryNamespace, log *zap.SugaredLogger) error

func UpdateS3Storage

func UpdateS3Storage(updateBy, id string, storage *commonmodels.S3Storage, logger *zap.SugaredLogger) error

func UpdateSonarIntegration

func UpdateSonarIntegration(id string, integration *SonarIntegration, log *zap.SugaredLogger) error

func UpdateSubscribe

func UpdateSubscribe(user string, notifyType int, subscription *commonmodels.Subscription, log *zap.SugaredLogger) error

func UpdateSysCapStrategy

func UpdateSysCapStrategy(strategy *commonmodels.CapacityStrategy) error

func UpdateThemeInfo

func UpdateThemeInfo(theme *models.Theme, log *zap.SugaredLogger) error

func UpdateWorkflowConcurrency

func UpdateWorkflowConcurrency(workflowConcurrency, buildConcurrency int64, log *zap.SugaredLogger) error

func UpsertSubscription

func UpsertSubscription(user string, subscription *commonmodels.Subscription, log *zap.SugaredLogger) error

func ValidateConfigurationManagement

func ValidateConfigurationManagement(rawData string, log *zap.SugaredLogger) error

func ValidateIMApp

func ValidateIMApp(im *commonmodels.IMApp, log *zap.SugaredLogger) error

func ValidateJira

func ValidateJira(info *models.ProjectManagement) error

func ValidateMeego

func ValidateMeego(info *models.ProjectManagement) error

func ValidateObservability

func ValidateObservability(args *models.Observability) error

func ValidateSonarIntegration

func ValidateSonarIntegration(arg *SonarIntegration, log *zap.SugaredLogger) error

Types

type AddAuditLogResp

type AddAuditLogResp struct {
	OperationLogID string `json:"id"`
}

func InsertOperation

func InsertOperation(args *models.OperationLog, log *zap.SugaredLogger) (*AddAuditLogResp, error)

type ApolloConfig

type ApolloConfig struct {
	ConfigType string                   `json:"type"`
	Config     []*commonmodels.ApolloKV `json:"kv"`
}

func ListApolloConfig

func ListApolloConfig(id, appID, env, cluster, namespace string, log *zap.SugaredLogger) (*ApolloConfig, error)

type BriefNacosConfig

type BriefNacosConfig struct {
	DataID        string `json:"data_id"`
	Format        string `json:"format"`
	Group         string `json:"group"`
	NamespaceID   string `json:"namespace_id"`
	NamespaceName string `json:"namespace_name"`
}

func ListNacosConfigByType

func ListNacosConfigByType(id, format string, log *zap.SugaredLogger) ([]*BriefNacosConfig, error)

type ChartVersion

type ChartVersion struct {
	ChartName string `json:"chartName"`
	Version   string `json:"version"`
}

type CreatePrivateKeyResp

type CreatePrivateKeyResp struct {
	VmID string `json:"vm_id"`
}

type DashBoardCardConfig

type DashBoardCardConfig struct {
	ID     string      `json:"id"`
	Name   string      `json:"name"`
	Type   string      `json:"type"`
	Config interface{} `json:"config"`
}

type DashBoardConfig

type DashBoardConfig struct {
	Cards []*DashBoardCardConfig `json:"cards"`
}

func GetDashboardConfiguration

func GetDashboardConfiguration(username, userID string, log *zap.SugaredLogger) (*DashBoardConfig, error)

type EnvResponse

type EnvResponse struct {
	Name        string          `json:"name"`
	ProjectName string          `json:"project_name"`
	UpdateTime  int64           `json:"update_time"`
	UpdatedBy   string          `json:"updated_by"`
	ClusterID   string          `json:"cluster_id"`
	Services    []*EnvService   `json:"services,omitempty"`
	VMServices  []*VMEnvService `json:"vm_services,omitempty"`
}

func GetMyEnvironment

func GetMyEnvironment(projectName, envName, username, userID string, log *zap.SugaredLogger) (*EnvResponse, error)

type EnvService

type EnvService struct {
	ServiceName string `json:"service_name"`
	Status      string `json:"status"`
	Image       string `json:"image"`
}

type ExternalSystemDetail

type ExternalSystemDetail struct {
	ID      string           `json:"id"`
	Name    string           `json:"name"`
	Server  string           `json:"server"`
	Headers []*util.KeyValue `json:"headers,omitempty"`
	// @2023-04-14 APIToken is deprecated after 1.4.0-ee
	APIToken string `json:"api_token,omitempty"`
}

func GetExternalSystemDetail

func GetExternalSystemDetail(id string, log *zap.SugaredLogger) (*ExternalSystemDetail, error)

func ListExternalSystem

func ListExternalSystem(encryptedKey string, pageNum, pageSize int64, log *zap.SugaredLogger) ([]*ExternalSystemDetail, int64, error)

type GetDefaultLoginResponse

type GetDefaultLoginResponse struct {
	DefaultLogin string `json:"default_login"`
}

func GetDefaultLogin

func GetDefaultLogin(logger *zap.SugaredLogger) (*GetDefaultLoginResponse, error)

type GetWebhookConfigReponse

type GetWebhookConfigReponse struct {
	URL    string `json:"url"`
	Secret string `json:"secret"`
}

func GetWebhookConfig

func GetWebhookConfig(ctx context.Context, log *zap.SugaredLogger) (*GetWebhookConfigReponse, error)

type IndexFileResp

type IndexFileResp struct {
	Entries map[string][]*ChartVersion `json:"entries"`
}

func ListCharts

func ListCharts(name string, log *zap.SugaredLogger) (*IndexFileResp, error)

type InitializeInfo

type InitializeInfo struct {
	CreatedAt int64  `json:"created_at"`
	Username  string `json:"username"`
	Phone     int64  `json:"phone,omitempty"`
	Email     string `json:"email"`
	Company   string `json:"company"`
	Reason    string `json:"reason,omitempty"`
	Address   string `json:"address,omitempty"`
	Domain    string `json:"domain"`
}

type JenkinsArgs

type JenkinsArgs struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type JenkinsBuildArgs

type JenkinsBuildArgs struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
}

func ListJobBuildArgs

func ListJobBuildArgs(id, jobName string, log *zap.SugaredLogger) ([]*JenkinsBuildArgs, error)

type JiraProjectsResp

type JiraProjectsResp struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

func ListJiraProjects

func ListJiraProjects(id string) ([]JiraProjectsResp, error)

type MeegoProject

type MeegoProject struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

type MeegoProjectResp

type MeegoProjectResp struct {
	Projects []*MeegoProject `json:"projects"`
}

func GetMeegoProjects

func GetMeegoProjects(id string) (*MeegoProjectResp, error)

type MeegoTransitionResp

type MeegoTransitionResp struct {
	TargetStatus []*MeegoWorkItemStatusTransition `json:"target_status"`
}

func ListAvailableWorkItemTransitions

func ListAvailableWorkItemTransitions(id, projectID, typeKey string, workItemID int) (*MeegoTransitionResp, error)

type MeegoWorkItem

type MeegoWorkItem struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	CurrentState string `json:"current_state"`
}

type MeegoWorkItemResp

type MeegoWorkItemResp struct {
	WorkItems []*MeegoWorkItem `json:"work_items"`
}

func ListMeegoWorkItems

func ListMeegoWorkItems(id, projectID, typeKey, nameQuery string, pageNum, pageSize int) (*MeegoWorkItemResp, error)

type MeegoWorkItemStatusTransition

type MeegoWorkItemStatusTransition struct {
	SourceStateKey  string `json:"source_state_key"`
	SourceStateName string `json:"source_state_name"`
	TargetStateKey  string `json:"target_state_key"`
	TargetStateName string `json:"target_state_name"`
	TransitionID    int64  `json:"transition_id"`
}

type MeegoWorkItemType

type MeegoWorkItemType struct {
	TypeKey string `json:"type_key"`
	Name    string `json:"name"`
}

type MeegoWorkItemTypeResp

type MeegoWorkItemTypeResp struct {
	WorkItemTypes []*MeegoWorkItemType `json:"work_item_types"`
}

func GetWorkItemTypeList

func GetWorkItemTypeList(id, projectID string) (*MeegoWorkItemTypeResp, error)

type MessageCtx

type MessageCtx struct {
	ReqID   string `bson:"req_id"                json:"req_id"`
	Title   string `bson:"title"                 json:"title"`   // 消息标题
	Content string `bson:"content"               json:"content"` // 消息内容
}

type MyEnvCardConfig

type MyEnvCardConfig struct {
	EnvType        string   `json:"env_type"`
	EnvName        string   `json:"env_name"`
	ProjectName    string   `json:"project_name"`
	ServiceModules []string `json:"service_modules"`
}

type MyWorkflowCardConfig

type MyWorkflowCardConfig struct {
	WorkflowList []*WorkflowConfig `json:"workflow_list"`
}

type OpenAPICluster

type OpenAPICluster struct {
	ID           string   `json:"cluster_id"`
	Name         string   `json:"name"`
	Production   bool     `json:"production"`
	Description  string   `json:"description"`
	ProviderName string   `json:"provider_name"`
	CreatedBy    string   `json:"created_by"`
	CreatedTime  int64    `json:"created_time"`
	Local        bool     `json:"local"`
	Status       string   `json:"status"`
	Type         string   `json:"type"`
	ProjectNames []string `json:"project_names"`
}

func OpenAPIListCluster

func OpenAPIListCluster(projectName string, logger *zap.SugaredLogger) ([]*OpenAPICluster, error)

type OpenAPICreateRegistryReq

type OpenAPICreateRegistryReq struct {
	Address   string                  `json:"address"`
	Provider  config.RegistryProvider `json:"provider"`
	Namespace string                  `json:"namespace"`
	IsDefault bool                    `json:"is_default"`
	AccessKey string                  `json:"access_key"`
	SecretKey string                  `json:"secret_key"`
	EnableTLS bool                    `json:"enable_tls"`
	// Optional field below
	Region  string `json:"region"`
	TLSCert string `json:"tls_cert"`
}

func (OpenAPICreateRegistryReq) Validate

func (req OpenAPICreateRegistryReq) Validate() error

type OpenAPIRegistry

type OpenAPIRegistry struct {
	ID        string                  `json:"registry_id"`
	Address   string                  `json:"address"`
	Provider  config.RegistryProvider `json:"provider"`
	Region    string                  `json:"region"`
	Namespace string                  `json:"namespace"`
	IsDefault bool                    `json:"is_default"`
}

type Operation

type Operation struct {
	Data string `json:"data"`
}

type OperationLogArgs

type OperationLogArgs struct {
	Username     string `json:"username"`
	ProductName  string `json:"product_name"`
	ExactProduct string `json:"exact_product"`
	Function     string `json:"function"`
	Status       int    `json:"status"`
	PerPage      int    `json:"per_page"`
	Page         int    `json:"page"`
	Scene        string `json:"scene"`
	TargetID     string `json:"target_id"`
	Detail       string `json:"detail"`
}

type RepoImgResp

type RepoImgResp struct {
	Host    string `json:"host"`
	Owner   string `json:"owner"`
	Name    string `json:"name"`
	Tag     string `json:"tag"`
	Created string `json:"created"`
	Digest  string `json:"digest"`
}

func ImageListGetter

func ImageListGetter(repo *registry.Repo, registryInfo *commonmodels.RegistryNamespace, dbTags map[string]*models.ImageTag, regService registry.Service, logger *zap.SugaredLogger) []*RepoImgResp

func ListReposTags

func ListReposTags(registryInfo *commonmodels.RegistryNamespace, names []string, logger *zap.SugaredLogger) ([]*RepoImgResp, error)

ListReposTags TODO: need to be optimized

type RepoInfo

type RepoInfo struct {
	RegType      string `json:"regType"`
	RegProvider  string `json:"regProvider"`
	RegNamespace string `json:"regNamespace"`
	RegAddr      string `json:"regAddr"`
	ID           string `json:"id"`
}

func ListAllRepos

func ListAllRepos(log *zap.SugaredLogger) ([]*RepoInfo, error)

type SecurityAndPrivacySettings

type SecurityAndPrivacySettings struct {
	TokenExpirationTime int64 `json:"token_expiration_time"`
	ImprovementPlan     bool  `json:"improvement_plan"`
}

func GetSecuritySettings

func GetSecuritySettings(logger *zap.SugaredLogger) (*SecurityAndPrivacySettings, error)

type SonarIntegration

type SonarIntegration struct {
	ID             string `json:"id"`
	SystemIdentity string `json:"system_identity"`
	ServerAddress  string `json:"server_address"`
	Token          string `json:"token"`
}

func GetSonarIntegration

func GetSonarIntegration(id string, log *zap.SugaredLogger) (*SonarIntegration, error)

func ListSonarIntegration

func ListSonarIntegration(log *zap.SugaredLogger) ([]*SonarIntegration, int64, error)

type SystemInitializationStatus

type SystemInitializationStatus struct {
	Initialized bool `json:"initialized"`
}

func GetSystemInitializationStatus

func GetSystemInitializationStatus(logger *zap.SugaredLogger) (*SystemInitializationStatus, error)

type UpdateDefaultLoginParams

type UpdateDefaultLoginParams struct {
	DefaultLogin string `json:"default_login"`
}

type VMEnvService

type VMEnvService struct {
	ServiceName string                    `json:"service_name"`
	EnvStatus   []*commonmodels.EnvStatus `json:"env_status"`
}

type WorkflowConcurrencySettings

type WorkflowConcurrencySettings struct {
	WorkflowConcurrency int64 `json:"workflow_concurrency"`
	BuildConcurrency    int64 `json:"build_concurrency"`
}

func GetWorkflowConcurrency

func GetWorkflowConcurrency() (*WorkflowConcurrencySettings, error)

type WorkflowConfig

type WorkflowConfig struct {
	Name    string `json:"name"`
	Project string `json:"project_name"`
}

type WorkflowResponse

type WorkflowResponse struct {
	TaskID      int64  `json:"task_id,omitempty"`
	Name        string `json:"name"`
	Project     string `json:"project"`
	Creator     string `json:"creator"`
	StartTime   int64  `json:"start_time"`
	Status      string `json:"status"`
	DisplayName string `json:"display_name"`
	Type        string `json:"workflow_type"`
	TestName    string `json:"test_name,omitempty"`
	ScanName    string `json:"scan_name,omitempty"`
	ScanID      string `json:"scan_id,omitempty"`
}

func GetMyWorkflow

func GetMyWorkflow(header http.Header, username, userID string, isAdmin bool, cardID string, log *zap.SugaredLogger) ([]*WorkflowResponse, error)

func GetRunningWorkflow

func GetRunningWorkflow(log *zap.SugaredLogger) ([]*WorkflowResponse, error)

Jump to

Keyboard shortcuts

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