service

package
v1.8.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 103 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// GrantTypeAccess is the grant type for access token
	GrantTypeAccess = "access"
	// GrantTypeRefresh is the grant type for refresh token
	GrantTypeRefresh = "refresh"
)
View Source
const (
	// DefaultCloudShellPathPrefix the default prefix
	DefaultCloudShellPathPrefix = "/view/cloudshell"
	// DefaultCloudShellCommand the init command when open the TTY connection
	DefaultCloudShellCommand = "bash"
	// DefaultLabelKey the default label key for the cloud shell
	DefaultLabelKey = "oam.dev/cloudshell"

	// StatusFailed means there is an error when creating the required resources, should retry.
	StatusFailed = "Failed"

	// StatusPreparing means the required resource is created, waiting until the environment is ready.
	StatusPreparing = "Preparing"

	// StatusCompleted means the environment is ready.
	StatusCompleted = "Completed"

	// CAFilePathInCluster the CA file path when the server running in cluster.
	CAFilePathInCluster = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"

	// ServerAddressInCluster the kubernetes server address in cluster.
	ServerAddressInCluster = "https://kubernetes.default:443"
)
View Source
const DefinitionHidden = "true"

DefinitionHidden means the definition can not be used in VelaUX

View Source
const (
	// InitAdminPassword the password of first admin user
	InitAdminPassword = "VelaUX12345"
)
View Source
const LogSourceResource = "Resource"

LogSourceResource Read the step logs from the pod stdout.

View Source
const LogSourceURL = "URL"

LogSourceURL Read the step logs from the URL.

View Source
const True = "true"

True -

Variables

View Source
var ResourceMaps = map[string]resourceMetadata{
	"project": {
		// contains filtered or unexported fields
	},
	"cluster": {
		// contains filtered or unexported fields
	},
	"addon": {
		// contains filtered or unexported fields
	},
	"addonRegistry": {
		// contains filtered or unexported fields
	},
	"target": {
		// contains filtered or unexported fields
	},
	"user": {
		// contains filtered or unexported fields
	},
	"role": {},
	"permission": {
		// contains filtered or unexported fields
	},
	"systemSetting": {},
	"definition": {
		// contains filtered or unexported fields
	},
	"configType": {
		// contains filtered or unexported fields
	},
	"cloudshell":     {},
	"config":         {},
	"configTemplate": {},
}

ResourceMaps all resources definition for RBAC

View Source
var WebhookHandlers []string

WebhookHandlers is the webhook handlers

Functions

func AddonImpl2AddonRes

func AddonImpl2AddonRes(impl *pkgaddon.UIData, config *rest.Config) (*apis.DetailAddonResponse, error)

AddonImpl2AddonRes convert pkgaddon.UIData to the type apiserver need

func CheckAppEnvBindingsContainTarget

func CheckAppEnvBindingsContainTarget(envBindings []*apisv1.EnvBindingBase, targetName string) (bool, error)

CheckAppEnvBindingsContainTarget check envbinding contain target

func ConfigCatalog added in v1.5.0

func ConfigCatalog(tags map[string]string) string

ConfigCatalog will get configCatalog value from tags

func ConvertProjectModel2Base

func ConvertProjectModel2Base(project *model.Project, owner *model.User) *apisv1.ProjectBase

ConvertProjectModel2Base convert project model to base struct

func ConvertProjectUserModel2Base

func ConvertProjectUserModel2Base(user *model.ProjectUser, userModel *model.User) *apisv1.ProjectUserBase

ConvertProjectUserModel2Base convert project user model to base struct

func DefinitionAlias added in v1.5.0

func DefinitionAlias(tags map[string]string) string

DefinitionAlias will get definitionAlias value from tags

func DefinitionType added in v1.5.0

func DefinitionType(tags map[string]string) string

DefinitionType will get definitionType value from tags

func GeneratePasswordHash

func GeneratePasswordHash(s string) (string, error)

GeneratePasswordHash generate password hash

func InitData

func InitData(ctx context.Context) error

InitData init data

func InitServiceBean

func InitServiceBean(c config.Config) []interface{}

InitServiceBean init all service instance

func ParseToken

func ParseToken(tokenString string) (*model.CustomClaims, error)

ParseToken parses and verifies a token

Types

type AddonService

type AddonService interface {
	GetAddonRegistry(ctx context.Context, name string) (*apis.AddonRegistry, error)
	CreateAddonRegistry(ctx context.Context, req apis.CreateAddonRegistryRequest) (*apis.AddonRegistry, error)
	DeleteAddonRegistry(ctx context.Context, name string) error
	UpdateAddonRegistry(ctx context.Context, name string, req apis.UpdateAddonRegistryRequest) (*apis.AddonRegistry, error)
	ListAddonRegistries(ctx context.Context) ([]*apis.AddonRegistry, error)
	ListAddons(ctx context.Context, registry, query string) ([]*apis.DetailAddonResponse, error)
	StatusAddon(ctx context.Context, name string) (*apis.AddonStatusResponse, error)
	GetAddon(ctx context.Context, name string, registry string, version string) (*apis.DetailAddonResponse, error)
	EnableAddon(ctx context.Context, name string, args apis.EnableAddonRequest) error
	DisableAddon(ctx context.Context, name string, force bool) error
	ListEnabledAddon(ctx context.Context) ([]*apis.AddonBaseStatus, error)
	UpdateAddon(ctx context.Context, name string, args apis.EnableAddonRequest) error
	Init(ctx context.Context) error
}

AddonService handle CRUD and installation of addons

func NewAddonService

func NewAddonService(cacheTime time.Duration) AddonService

NewAddonService returns an addon service

type ApplicationService

type ApplicationService interface {
	ListApplications(ctx context.Context, listOptions apisv1.ListApplicationOptions) ([]*apisv1.ApplicationBase, error)
	GetApplication(ctx context.Context, appName string) (*model.Application, error)
	GetApplicationStatus(ctx context.Context, app *model.Application, envName string) (*common.AppStatus, error)
	DetailApplication(ctx context.Context, app *model.Application) (*apisv1.DetailApplicationResponse, error)
	PublishApplicationTemplate(ctx context.Context, app *model.Application) (*apisv1.ApplicationTemplateBase, error)
	CreateApplication(context.Context, apisv1.CreateApplicationRequest) (*apisv1.ApplicationBase, error)
	UpdateApplication(context.Context, *model.Application, apisv1.UpdateApplicationRequest) (*apisv1.ApplicationBase, error)
	DeleteApplication(ctx context.Context, app *model.Application) error
	Deploy(ctx context.Context, app *model.Application, req apisv1.ApplicationDeployRequest) (*apisv1.ApplicationDeployResponse, error)
	GetApplicationComponent(ctx context.Context, app *model.Application, componentName string) (*model.ApplicationComponent, error)
	ListComponents(ctx context.Context, app *model.Application, op apisv1.ListApplicationComponentOptions) ([]*apisv1.ComponentBase, error)
	CreateComponent(ctx context.Context, app *model.Application, com apisv1.CreateComponentRequest) (*apisv1.ComponentBase, error)
	DetailComponent(ctx context.Context, app *model.Application, componentName string) (*apisv1.DetailComponentResponse, error)
	DeleteComponent(ctx context.Context, app *model.Application, component *model.ApplicationComponent) error
	UpdateComponent(ctx context.Context, app *model.Application, component *model.ApplicationComponent, req apisv1.UpdateApplicationComponentRequest) (*apisv1.ComponentBase, error)
	ListPolicies(ctx context.Context, app *model.Application) ([]*apisv1.PolicyBase, error)
	CreatePolicy(ctx context.Context, app *model.Application, policy apisv1.CreatePolicyRequest) (*apisv1.PolicyBase, error)
	DetailPolicy(ctx context.Context, app *model.Application, policyName string) (*apisv1.DetailPolicyResponse, error)
	DeletePolicy(ctx context.Context, app *model.Application, policyName string, force bool) error
	UpdatePolicy(ctx context.Context, app *model.Application, policyName string, policy apisv1.UpdatePolicyRequest) (*apisv1.DetailPolicyResponse, error)
	CreateApplicationTrait(ctx context.Context, app *model.Application, component *model.ApplicationComponent, req apisv1.CreateApplicationTraitRequest) (*apisv1.ApplicationTrait, error)
	DeleteApplicationTrait(ctx context.Context, app *model.Application, component *model.ApplicationComponent, traitType string) error
	UpdateApplicationTrait(ctx context.Context, app *model.Application, component *model.ApplicationComponent, traitType string, req apisv1.UpdateApplicationTraitRequest) (*apisv1.ApplicationTrait, error)
	ListRevisions(ctx context.Context, appName, envName, status string, page, pageSize int) (*apisv1.ListRevisionsResponse, error)
	DetailRevision(ctx context.Context, appName, revisionName string) (*apisv1.DetailRevisionResponse, error)
	RollbackWithRevision(ctx context.Context, app *model.Application, revisionName string) (*apisv1.ApplicationRollbackResponse, error)
	Statistics(ctx context.Context, app *model.Application) (*apisv1.ApplicationStatisticsResponse, error)
	ListRecords(ctx context.Context, appName string) (*apisv1.ListWorkflowRecordsResponse, error)
	CompareApp(ctx context.Context, app *model.Application, compareReq apisv1.AppCompareReq) (*apisv1.AppCompareResponse, error)
	ResetAppToLatestRevision(ctx context.Context, appName string) (*apisv1.AppResetResponse, error)
	DryRunAppOrRevision(ctx context.Context, app *model.Application, dryRunReq apisv1.AppDryRunReq) (*apisv1.AppDryRunResponse, error)
	CreateApplicationTrigger(ctx context.Context, app *model.Application, req apisv1.CreateApplicationTriggerRequest) (*apisv1.ApplicationTriggerBase, error)
	ListApplicationTriggers(ctx context.Context, app *model.Application) ([]*apisv1.ApplicationTriggerBase, error)
	DeleteApplicationTrigger(ctx context.Context, app *model.Application, triggerName string) error
	UpdateApplicationTrigger(ctx context.Context, app *model.Application, token string, req apisv1.UpdateApplicationTriggerRequest) (*apisv1.ApplicationTriggerBase, error)
}

ApplicationService application service

func NewApplicationService

func NewApplicationService() ApplicationService

NewApplicationService new application service

func NewTestApplicationService added in v1.5.0

func NewTestApplicationService(ds datastore.DataStore, c client.Client, cfg *rest.Config) ApplicationService

NewTestApplicationService create the application service instance for testing

type AuthenticationService

type AuthenticationService interface {
	Login(ctx context.Context, loginReq apisv1.LoginRequest) (*apisv1.LoginResponse, error)
	RefreshToken(ctx context.Context, refreshToken string) (*apisv1.RefreshTokenResponse, error)
	GetDexConfig(ctx context.Context) (*apisv1.DexConfigResponse, error)
	GetLoginType(ctx context.Context) (*apisv1.GetLoginTypeResponse, error)
}

AuthenticationService is the service of authentication

func NewAuthenticationService

func NewAuthenticationService() AuthenticationService

NewAuthenticationService new authentication service

type CloudShellService added in v1.5.0

type CloudShellService interface {
	Prepare(ctx context.Context) (*apisv1.CloudShellPrepareResponse, error)
	GetCloudShellEndpoint(ctx context.Context) (string, error)
	Destroy(ctx context.Context) error
}

CloudShellService provide the cloud shell feature

func NewCloudShellService added in v1.5.0

func NewCloudShellService() CloudShellService

NewCloudShellService create the instance of the cloud shell service

type ClusterService

ClusterService cluster manage

func NewClusterService

func NewClusterService() ClusterService

NewClusterService new cluster service

type ConfigService

type ConfigService interface {
	ListTemplates(ctx context.Context, project, scope string) ([]*apis.ConfigTemplate, error)
	GetTemplate(ctx context.Context, tem config.NamespacedName) (*apis.ConfigTemplateDetail, error)
	CreateConfig(ctx context.Context, project string, req apis.CreateConfigRequest) (*apis.Config, error)
	UpdateConfig(ctx context.Context, project string, name string, req apis.UpdateConfigRequest) (*apis.Config, error)
	ListConfigs(ctx context.Context, project, template string, withProperties bool) ([]*apis.Config, error)
	GetConfig(ctx context.Context, project, name string) (*apis.Config, error)
	DeleteConfig(ctx context.Context, project, name string) error
	CreateConfigDistribution(ctx context.Context, project string, req apis.CreateConfigDistributionRequest) error
	DeleteConfigDistribution(ctx context.Context, project, name string) error
	ListConfigDistributions(ctx context.Context, project string) ([]*config.Distribution, error)
}

ConfigService handle CRUD of config and template

func NewConfigService

func NewConfigService() ConfigService

NewConfigService returns a config use case

type ContextService added in v1.6.0

type ContextService interface {
	InitContext(ctx context.Context, projectName, pipelineName string) (*model.PipelineContext, error)
	GetContext(ctx context.Context, projectName, pipelineName string, name string) (*apis.Context, error)
	CreateContext(ctx context.Context, projectName, pipelineName string, context apis.Context) (*model.PipelineContext, error)
	UpdateContext(ctx context.Context, projectName, pipelineName string, context apis.Context) (*model.PipelineContext, error)
	ListContexts(ctx context.Context, projectName, pipelineName string) (*apis.ListContextValueResponse, error)
	DeleteContext(ctx context.Context, projectName, pipelineName, name string) error
	DeleteAllContexts(ctx context.Context, projectName, pipelineName string) error
}

ContextService is the interface for context service

func NewContextService added in v1.6.0

func NewContextService() ContextService

NewContextService new context service

func NewTestContextService added in v1.6.0

func NewTestContextService(ds datastore.DataStore) ContextService

NewTestContextService create the context service instance for testing

type DataInit

type DataInit interface {
	Init(ctx context.Context) error
}

DataInit the service set that needs init data

type DefinitionQueryOption

type DefinitionQueryOption struct {
	Type             string `json:"type"`
	AppliedWorkloads string `json:"appliedWorkloads"`
	OwnerAddon       string `json:"sourceAddon"`
	QueryAll         bool   `json:"queryAll"`
	Scope            string `json:"scope"`
}

DefinitionQueryOption define a set of query options

func (DefinitionQueryOption) String

func (d DefinitionQueryOption) String() string

String return cache key string

type DefinitionService

type DefinitionService interface {
	// ListDefinitions list definition base info
	ListDefinitions(ctx context.Context, ops DefinitionQueryOption) ([]*apisv1.DefinitionBase, error)
	// DetailDefinition get definition detail
	DetailDefinition(ctx context.Context, name, defType string) (*apisv1.DetailDefinitionResponse, error)
	// AddDefinitionUISchema add or update custom definition ui schema
	AddDefinitionUISchema(ctx context.Context, name, defType string, schema []*utils.UIParameter) ([]*utils.UIParameter, error)
	// UpdateDefinitionStatus update the status of definition
	UpdateDefinitionStatus(ctx context.Context, name string, status apisv1.UpdateDefinitionStatusRequest) (*apisv1.DetailDefinitionResponse, error)
}

DefinitionService definition service, Implement the management of ComponentDefinition、TraitDefinition and WorkflowStepDefinition.

func NewDefinitionService

func NewDefinitionService() DefinitionService

NewDefinitionService new definition service

type EnvBindingService

type EnvBindingService interface {
	GetEnvBindings(ctx context.Context, app *model.Application) ([]*apisv1.EnvBindingBase, error)
	GetEnvBinding(ctx context.Context, app *model.Application, envName string) (*model.EnvBinding, error)
	CreateEnvBinding(ctx context.Context, app *model.Application, env apisv1.CreateApplicationEnvbindingRequest) (*apisv1.EnvBinding, error)
	BatchCreateEnvBinding(ctx context.Context, app *model.Application, env apisv1.EnvBindingList) error
	UpdateEnvBinding(ctx context.Context, app *model.Application, envName string, diff apisv1.PutApplicationEnvBindingRequest) (*apisv1.DetailEnvBindingResponse, error)
	DeleteEnvBinding(ctx context.Context, app *model.Application, envName string) error
	BatchDeleteEnvBinding(ctx context.Context, app *model.Application) error
	DetailEnvBinding(ctx context.Context, app *model.Application, envBinding *model.EnvBinding) (*apisv1.DetailEnvBindingResponse, error)
	ApplicationEnvRecycle(ctx context.Context, appModel *model.Application, envBinding *model.EnvBinding) error
}

EnvBindingService envbinding service

func NewEnvBindingService

func NewEnvBindingService() EnvBindingService

NewEnvBindingService new envBinding service

type EnvService

type EnvService interface {
	GetEnv(ctx context.Context, envName string) (*model.Env, error)
	ListEnvs(ctx context.Context, page, pageSize int, listOption apisv1.ListEnvOptions) (*apisv1.ListEnvResponse, error)
	ListEnvCount(ctx context.Context, listOption apisv1.ListEnvOptions) (int64, error)
	DeleteEnv(ctx context.Context, envName string) error
	CreateEnv(ctx context.Context, req apisv1.CreateEnvRequest) (*apisv1.Env, error)
	UpdateEnv(ctx context.Context, envName string, req apisv1.UpdateEnvRequest) (*apisv1.Env, error)
}

EnvService defines the API of Env.

func NewEnvService

func NewEnvService() EnvService

NewEnvService new env service

func NewTestEnvService added in v1.5.0

func NewTestEnvService(ds datastore.DataStore, c client.Client) EnvService

NewTestEnvService create the env service instance for testing

type GenerateKubeConfig added in v1.5.0

type GenerateKubeConfig func(ctx context.Context, cli kubernetes.Interface, cfg *api.Config, writer io.Writer, options ...auth.KubeConfigGenerateOption) (*api.Config, error)

GenerateKubeConfig generate the kubeconfig for the cloudshell

type HelmService

type HelmService interface {
	ListChartNames(ctx context.Context, url string, secretName string, skipCache bool) ([]string, error)
	ListChartVersions(ctx context.Context, url string, chartName string, secretName string, skipCache bool) (repo.ChartVersions, error)
	ListChartValuesFiles(ctx context.Context, url string, chartName string, version string, secretName string, repoType string, skipCache bool) (map[string]string, error)
	ListChartRepo(ctx context.Context, projectName string) (*v1.ChartRepoResponseList, error)
	GetChartValues(ctx context.Context, repoURL string, chartName string, version string, secretName string, repoType string, skipCache bool) (map[string]interface{}, error)
}

HelmService responsible handle helm related interface

func NewHelmService

func NewHelmService() HelmService

NewHelmService return a helmHandler

type ImageService added in v1.4.3

type ImageService interface {
	ListImageRepos(ctx context.Context, project string) ([]v1.ImageRegistry, error)
	GetImageInfo(ctx context.Context, project, secretName, imageName string) v1.ImageInfo
}

ImageService the image service provide some handler functions about the docker image

func NewImageService added in v1.4.3

func NewImageService() ImageService

NewImageService create a image service instance

type OAMApplicationService

type OAMApplicationService interface {
	CreateOrUpdateOAMApplication(context.Context, apisv1.ApplicationRequest, string, string) error
	GetOAMApplication(context.Context, string, string) (*apisv1.ApplicationResponse, error)
	DeleteOAMApplication(context.Context, string, string) error
	DryRunOAMApplication(context.Context, apisv1.ApplicationRequest, string, string) error
}

OAMApplicationService oam_application service

func NewOAMApplicationService

func NewOAMApplicationService() OAMApplicationService

NewOAMApplicationService new oam_application service

type PipelineRunService added in v1.6.0

type PipelineRunService interface {
	GetPipelineRun(ctx context.Context, meta apis.PipelineRunMeta) (*apis.PipelineRun, error)
	ListPipelineRuns(ctx context.Context, base apis.PipelineBase) (apis.ListPipelineRunResponse, error)
	DeletePipelineRun(ctx context.Context, meta apis.PipelineRunMeta) error
	CleanPipelineRuns(ctx context.Context, base apis.PipelineBase) error
	GetPipelineRunOutput(ctx context.Context, meta apis.PipelineRun, step string) (apis.GetPipelineRunOutputResponse, error)
	GetPipelineRunInput(ctx context.Context, meta apis.PipelineRun, step string) (apis.GetPipelineRunInputResponse, error)
	GetPipelineRunLog(ctx context.Context, meta apis.PipelineRun, step string) (apis.GetPipelineRunLogResponse, error)
	ResumePipelineRun(ctx context.Context, meta apis.PipelineRunMeta, step string) error
	TerminatePipelineRun(ctx context.Context, meta apis.PipelineRunMeta) error
}

PipelineRunService is the interface for pipelineRun service

func NewPipelineRunService added in v1.6.0

func NewPipelineRunService() PipelineRunService

NewPipelineRunService new pipelineRun service

func NewTestPipelineRunService added in v1.6.0

func NewTestPipelineRunService(ds datastore.DataStore, c client.Client, cfg *rest.Config) PipelineRunService

NewTestPipelineRunService create the pipeline run service instance for testing

type PipelineService added in v1.6.0

type PipelineService interface {
	CreatePipeline(ctx context.Context, req apis.CreatePipelineRequest) (*apis.PipelineBase, error)
	ListPipelines(ctx context.Context, req apis.ListPipelineRequest) (*apis.ListPipelineResponse, error)
	GetPipeline(ctx context.Context, name string, getInfo bool) (*apis.GetPipelineResponse, error)
	UpdatePipeline(ctx context.Context, name string, req apis.UpdatePipelineRequest) (*apis.PipelineBase, error)
	DeletePipeline(ctx context.Context, base apis.PipelineBase) error
	RunPipeline(ctx context.Context, pipeline apis.PipelineBase, req apis.RunPipelineRequest) (*apis.PipelineRun, error)
}

PipelineService is the interface for pipeline service

func NewPipelineService added in v1.6.0

func NewPipelineService(version string) PipelineService

NewPipelineService new pipeline service

func NewTestPipelineService added in v1.6.0

func NewTestPipelineService(ds datastore.DataStore, c client.Client, cfg *rest.Config) PipelineService

NewTestPipelineService create the pipeline service instance for testing

type PolicyType

type PolicyType string

PolicyType build-in policy type

type ProjectService

type ProjectService interface {
	GetProject(ctx context.Context, projectName string) (*model.Project, error)
	DetailProject(ctx context.Context, projectName string) (*apisv1.ProjectBase, error)
	ListProjects(ctx context.Context, page, pageSize int) (*apisv1.ListProjectResponse, error)
	ListUserProjects(ctx context.Context, userName string) ([]*apisv1.ProjectBase, error)
	CreateProject(ctx context.Context, req apisv1.CreateProjectRequest) (*apisv1.ProjectBase, error)
	DeleteProject(ctx context.Context, projectName string) error
	UpdateProject(ctx context.Context, projectName string, req apisv1.UpdateProjectRequest) (*apisv1.ProjectBase, error)
	ListProjectUser(ctx context.Context, projectName string, page, pageSize int) (*apisv1.ListProjectUsersResponse, error)
	AddProjectUser(ctx context.Context, projectName string, req apisv1.AddProjectUserRequest) (*apisv1.ProjectUserBase, error)
	DeleteProjectUser(ctx context.Context, projectName string, userName string) error
	UpdateProjectUser(ctx context.Context, projectName string, userName string, req apisv1.UpdateProjectUserRequest) (*apisv1.ProjectUserBase, error)
	Init(ctx context.Context) error
	ListTerraformProviders(ctx context.Context, projectName string) ([]*apisv1.TerraformProvider, error)
}

ProjectService project manage service.

func NewProjectService

func NewProjectService() ProjectService

NewProjectService new project service

func NewTestProjectService added in v1.5.0

func NewTestProjectService(ds datastore.DataStore, c client.Client) ProjectService

NewTestProjectService create the project service instance for testing

type RBACService

type RBACService interface {
	CheckPerm(resource string, actions ...string) func(req *restful.Request, res *restful.Response, chain *restful.FilterChain)
	GetUserPermissions(ctx context.Context, user *model.User, projectName string, withPlatform bool) ([]*model.Permission, error)
	CreateRole(ctx context.Context, projectName string, req apisv1.CreateRoleRequest) (*apisv1.RoleBase, error)
	DeleteRole(ctx context.Context, projectName, roleName string) error
	UpdateRole(ctx context.Context, projectName, roleName string, req apisv1.UpdateRoleRequest) (*apisv1.RoleBase, error)
	ListRole(ctx context.Context, projectName string, page, pageSize int) (*apisv1.ListRolesResponse, error)
	ListPermissionTemplate(ctx context.Context, projectName string) ([]apisv1.PermissionTemplateBase, error)
	ListPermissions(ctx context.Context, projectName string) ([]apisv1.PermissionBase, error)
	CreatePermission(ctx context.Context, projectName string, req apisv1.CreatePermissionRequest) (*apisv1.PermissionBase, error)
	DeletePermission(ctx context.Context, projectName, permName string) error
	SyncDefaultRoleAndUsersForProject(ctx context.Context, project *model.Project) error
	Init(ctx context.Context) error
}

RBACService implement RBAC-related business logic.

func NewRBACService

func NewRBACService() RBACService

NewRBACService is the service service of RBAC

type RequestResourceAction

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

RequestResourceAction resource permission boundary

func (*RequestResourceAction) GetResource

func (r *RequestResourceAction) GetResource() *ResourceName

GetResource return the resource after be formated

func (*RequestResourceAction) Match

func (r *RequestResourceAction) Match(policies []*model.Permission) bool

Match determines whether the request resources and actions matches the user permission set.

func (*RequestResourceAction) SetActions

func (r *RequestResourceAction) SetActions(actions []string)

SetActions set request actions

func (*RequestResourceAction) SetResourceWithName

func (r *RequestResourceAction) SetResourceWithName(resource string, pathParameter func(name string) string)

SetResourceWithName format resource and assign a value from path parameter

type ResourceName

type ResourceName struct {
	Type  string
	Value string
	Next  *ResourceName
}

ResourceName it is similar to ARNs <type>:<value>/<type>:<value>

func ParseResourceName

func ParseResourceName(resource string) *ResourceName

ParseResourceName parse string to ResourceName

func (*ResourceName) Match

func (r *ResourceName) Match(target *ResourceName) bool

Match the resource types same with target and resource value include target resource means request resources

func (*ResourceName) String

func (r *ResourceName) String() string

type SystemInfoService

type SystemInfoService interface {
	Get(ctx context.Context) (*model.SystemInfo, error)
	GetSystemInfo(ctx context.Context) (*v1.SystemInfoResponse, error)
	UpdateSystemInfo(ctx context.Context, sysInfo v1.SystemInfoRequest) (*v1.SystemInfoResponse, error)
	Init(ctx context.Context) error
}

SystemInfoService is service for systemInfoCollection

func NewSystemInfoService

func NewSystemInfoService() SystemInfoService

NewSystemInfoService return a systemInfoCollectionService

type TargetService

type TargetService interface {
	GetTarget(ctx context.Context, TargetName string) (*model.Target, error)
	DetailTarget(ctx context.Context, Target *model.Target) (*apisv1.DetailTargetResponse, error)
	DeleteTarget(ctx context.Context, TargetName string) error
	CreateTarget(ctx context.Context, req apisv1.CreateTargetRequest) (*apisv1.DetailTargetResponse, error)
	UpdateTarget(ctx context.Context, Target *model.Target, req apisv1.UpdateTargetRequest) (*apisv1.DetailTargetResponse, error)
	ListTargets(ctx context.Context, page, pageSize int, projectName string) (*apisv1.ListTargetResponse, error)
	ListTargetCount(ctx context.Context, projectName string) (int64, error)
	Init(ctx context.Context) error
}

TargetService Target manage api

func NewTargetService

func NewTargetService() TargetService

NewTargetService new Target service

func NewTestTargetService added in v1.5.0

func NewTestTargetService(ds datastore.DataStore, c client.Client) TargetService

NewTestTargetService create the target service instance for testing

type UserService

type UserService interface {
	GetUser(ctx context.Context, username string) (*model.User, error)
	DetailUser(ctx context.Context, user *model.User) (*apisv1.DetailUserResponse, error)
	DeleteUser(ctx context.Context, username string) error
	CreateUser(ctx context.Context, req apisv1.CreateUserRequest) (*apisv1.UserBase, error)
	UpdateUser(ctx context.Context, user *model.User, req apisv1.UpdateUserRequest) (*apisv1.UserBase, error)
	ListUsers(ctx context.Context, page, pageSize int, listOptions apisv1.ListUserOptions) (*apisv1.ListUserResponse, error)
	DisableUser(ctx context.Context, user *model.User) error
	EnableUser(ctx context.Context, user *model.User) error
	DetailLoginUserInfo(ctx context.Context) (*apisv1.LoginUserInfoResponse, error)
	UpdateUserLoginTime(ctx context.Context, user *model.User) error
	Init(ctx context.Context) error
}

UserService User manage api

func NewTestUserService added in v1.5.0

func NewTestUserService(ds datastore.DataStore, c client.Client) UserService

NewTestUserService create the user service instance for testing

func NewUserService

func NewUserService() UserService

NewUserService new User service

type VelaQLService

type VelaQLService interface {
	QueryView(context.Context, string) (*apis.VelaQLViewResponse, error)
}

VelaQLService velaQL service

func NewVelaQLService

func NewVelaQLService() VelaQLService

NewVelaQLService new velaQL service

type WebhookService

type WebhookService interface {
	HandleApplicationWebhook(ctx context.Context, token string, req *restful.Request) (interface{}, error)
}

WebhookService webhook service

func NewWebhookService

func NewWebhookService() WebhookService

NewWebhookService new webhook service

type WorkflowService

type WorkflowService interface {
	ListApplicationWorkflow(ctx context.Context, app *model.Application) ([]*apisv1.WorkflowBase, error)
	GetWorkflow(ctx context.Context, app *model.Application, workflowName string) (*model.Workflow, error)
	DetailWorkflow(ctx context.Context, workflow *model.Workflow) (*apisv1.DetailWorkflowResponse, error)
	GetApplicationDefaultWorkflow(ctx context.Context, app *model.Application) (*model.Workflow, error)
	DeleteWorkflow(ctx context.Context, app *model.Application, workflowName string) error
	DeleteWorkflowByApp(ctx context.Context, app *model.Application) error
	CreateOrUpdateWorkflow(ctx context.Context, app *model.Application, req apisv1.CreateWorkflowRequest) (*apisv1.DetailWorkflowResponse, error)
	UpdateWorkflow(ctx context.Context, workflow *model.Workflow, req apisv1.UpdateWorkflowRequest) (*apisv1.DetailWorkflowResponse, error)

	GetWorkflowRecord(ctx context.Context, workflow *model.Workflow, recordName string) (*model.WorkflowRecord, error)
	CreateWorkflowRecord(ctx context.Context, appModel *model.Application, app *v1beta1.Application, workflow *model.Workflow) (*model.WorkflowRecord, error)
	ListWorkflowRecords(ctx context.Context, workflow *model.Workflow, page, pageSize int) (*apisv1.ListWorkflowRecordsResponse, error)
	DetailWorkflowRecord(ctx context.Context, workflow *model.Workflow, recordName string) (*apisv1.DetailWorkflowRecordResponse, error)
	SyncWorkflowRecord(ctx context.Context) error
	ResumeRecord(ctx context.Context, appModel *model.Application, workflow *model.Workflow, recordName, stepName string) error
	TerminateRecord(ctx context.Context, appModel *model.Application, workflow *model.Workflow, recordName string) error
	RollbackRecord(ctx context.Context, appModel *model.Application, workflow *model.Workflow, recordName, revisionName string) (*apisv1.WorkflowRecordBase, error)
	GetWorkflowRecordLog(ctx context.Context, record *model.WorkflowRecord, step string) (apisv1.GetPipelineRunLogResponse, error)
	GetWorkflowRecordOutput(ctx context.Context, workflow *model.Workflow, record *model.WorkflowRecord, stepName string) (apisv1.GetPipelineRunOutputResponse, error)
	GetWorkflowRecordInput(ctx context.Context, workflow *model.Workflow, record *model.WorkflowRecord, stepName string) (apisv1.GetPipelineRunInputResponse, error)

	CountWorkflow(ctx context.Context, app *model.Application) int64
}

WorkflowService workflow manage api

func NewWorkflowService

func NewWorkflowService() WorkflowService

NewWorkflowService new workflow service

Jump to

Keyboard shortcuts

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