usecase

package
Version: v1.3.5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvBindingPolicy Multiple environment distribution policy
	EnvBindingPolicy PolicyType = "env-binding"

	// EnvBindingPolicyDefaultName default policy name
	EnvBindingPolicyDefaultName string = "env-bindings"
)
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 (
	// Deploy2Env deploy app to target cluster, suitable for common applications
	Deploy2Env string = "deploy2env"
	// DeployCloudResource deploy app to local and copy secret to target cluster, suitable for cloud application.
	DeployCloudResource string = "deploy-cloud-resource"
	// TerraformWorkloadType cloud application
	TerraformWorkloadType string = "configurations.terraform.core.oam.dev"
	// TerraformWorkloadKind terraform workload kind
	TerraformWorkloadKind string = "Configuration"
)

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":    {},
	"systemSetting": {},
	"definition":    {},
	"configType": {
		// contains filtered or unexported fields
	},
}

ResourceMaps all resources definition for RBAC

View Source
var WebhookHandlers []string

WebhookHandlers is the webhook handlers

Functions

func AddonImpl2AddonRes added in v1.2.0

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

AddonImpl2AddonRes convert pkgaddon.UIData to the type apiserver need

func CheckAppEnvBindingsContainTarget added in v1.2.0

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

CheckAppEnvBindingsContainTarget check envbinding contain target

func ConvertProjectModel2Base added in v1.3.0

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

ConvertProjectModel2Base convert project model to base struct

func ConvertProjectUserModel2Base added in v1.3.0

func ConvertProjectUserModel2Base(user *model.ProjectUser) *apisv1.ProjectUserBase

ConvertProjectUserModel2Base convert project user model to base struct

func ConvertRole2Model added in v1.3.0

func ConvertRole2Model(role *model.Role, policies []*model.Permission) *apisv1.RoleBase

ConvertRole2Model convert role model to role base struct

func GenEnvWorkflowSteps added in v1.2.0

func GenEnvWorkflowSteps(ctx context.Context, kubeClient client.Client, ds datastore.DataStore, env *model.Env, app *model.Application) []apisv1.WorkflowStep

GenEnvWorkflowSteps will generate workflow steps for an env and application

func GeneratePasswordHash added in v1.3.0

func GeneratePasswordHash(s string) (string, error)

GeneratePasswordHash generate password hash

func GetComponentDefinition added in v1.2.0

func GetComponentDefinition(ctx context.Context, kubeClient client.Client, name string) (*v1beta1.ComponentDefinition, error)

GetComponentDefinition will get componentDefinition by kube client

func GetSuitableDeployWay added in v1.2.0

func GetSuitableDeployWay(ctx context.Context, kubeClient client.Client, ds datastore.DataStore, app *model.Application) string

GetSuitableDeployWay will get a workflow deploy strategy for workflow step

func ParseToken added in v1.3.0

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

ParseToken parses and verifies a token

func SyncConfigs added in v1.3.0

func SyncConfigs(ctx context.Context, k8sClient client.Client, project string, targets []*model.ClusterTarget) error

SyncConfigs will sync configs to working clusters

func UpdateEnvWorkflow added in v1.2.0

func UpdateEnvWorkflow(ctx context.Context, kubeClient client.Client, ds datastore.DataStore, app *model.Application, env *model.Env) error

UpdateEnvWorkflow will update env workflow internally

Types

type AddonHandler added in v1.2.0

type AddonHandler 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
}

AddonHandler handle CRUD and installation of addons

func NewAddonUsecase added in v1.2.0

func NewAddonUsecase(cacheTime time.Duration) AddonHandler

NewAddonUsecase returns an addon usecase

type ApplicationDeployTarget added in v1.3.0

type ApplicationDeployTarget struct {
	Namespace string   `json:"namespace"`
	Clusters  []string `json:"clusters"`
}

ApplicationDeployTarget is the struct of application deploy target

type ApplicationUsecase added in v1.2.0

type ApplicationUsecase 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) 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)
	Statistics(ctx context.Context, app *model.Application) (*apisv1.ApplicationStatisticsResponse, error)
	ListRecords(ctx context.Context, appName string) (*apisv1.ListWorkflowRecordsResponse, error)
	CompareAppWithLatestRevision(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
}

ApplicationUsecase application usecase

func NewApplicationUsecase added in v1.2.0

func NewApplicationUsecase(ds datastore.DataStore,
	workflowUsecase WorkflowUsecase,
	envBindingUsecase EnvBindingUsecase,
	envUsecase EnvUsecase,
	targetUsecase TargetUsecase,
	definitionUsecase DefinitionUsecase,
	projectUsecase ProjectUsecase,
) ApplicationUsecase

NewApplicationUsecase new application usecase

type AuthenticationUsecase added in v1.3.0

type AuthenticationUsecase 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)
	UpdateDexConfig(ctx context.Context) error
}

AuthenticationUsecase is the usecase of authentication

func NewAuthenticationUsecase added in v1.3.0

func NewAuthenticationUsecase(ds datastore.DataStore, sysUsecase SystemInfoUsecase, userUsecase UserUsecase) AuthenticationUsecase

NewAuthenticationUsecase new authentication usecase

type ClusterUsecase

ClusterUsecase cluster manage

func NewClusterUsecase

func NewClusterUsecase(ds datastore.DataStore) ClusterUsecase

NewClusterUsecase new cluster usecase

type ConfigHandler added in v1.3.0

type ConfigHandler interface {
	ListConfigTypes(ctx context.Context, query string) ([]*apis.ConfigType, error)
	GetConfigType(ctx context.Context, configType string) (*apis.ConfigType, error)
	CreateConfig(ctx context.Context, req apis.CreateConfigRequest) error
	GetConfigs(ctx context.Context, configType string) ([]*apis.Config, error)
	GetConfig(ctx context.Context, configType, name string) (*apis.Config, error)
	DeleteConfig(ctx context.Context, configType, name string) error
}

ConfigHandler handle CRUD of configs

func NewConfigUseCase added in v1.3.0

func NewConfigUseCase(authenticationUseCase AuthenticationUsecase) ConfigHandler

NewConfigUseCase returns a config use case

type DefinitionUsecase added in v1.2.0

type DefinitionUsecase interface {
	// ListDefinitions list definition base info
	ListDefinitions(ctx context.Context, envName, defType, appliedWorkloads string) ([]*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, configRaw string) ([]*utils.UIParameter, error)
}

DefinitionUsecase definition usecase, Implement the management of ComponentDefinition、TraitDefinition and WorkflowStepDefinition.

func NewDefinitionUsecase added in v1.2.0

func NewDefinitionUsecase() DefinitionUsecase

NewDefinitionUsecase new definition usecase

type EnvBindingUsecase added in v1.2.0

type EnvBindingUsecase 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
}

EnvBindingUsecase envbinding usecase

func NewEnvBindingUsecase added in v1.2.0

func NewEnvBindingUsecase(ds datastore.DataStore, workflowUsecase WorkflowUsecase, definitionUsecase DefinitionUsecase, envUsecase EnvUsecase) EnvBindingUsecase

NewEnvBindingUsecase new envBinding usecase

type EnvUsecase added in v1.2.0

type EnvUsecase 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)
}

EnvUsecase defines the API of Env.

func NewEnvUsecase added in v1.2.0

func NewEnvUsecase(ds datastore.DataStore, projectUsecase ProjectUsecase) EnvUsecase

NewEnvUsecase new env usecase

type HelmHandler added in v1.3.0

type HelmHandler 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)
	GetChartValues(ctx context.Context, url string, chartName string, version string, secretName string, skipCache bool) (map[string]interface{}, error)
	ListChartRepo(ctx context.Context, projectName string) (*v1.ChartRepoResponseList, error)
}

HelmHandler responsible handle helm related interface

func NewHelmUsecase added in v1.3.0

func NewHelmUsecase() HelmHandler

NewHelmUsecase return a helmHandler

type OAMApplicationUsecase added in v1.2.0

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

OAMApplicationUsecase oam_application usecase

func NewOAMApplicationUsecase added in v1.2.0

func NewOAMApplicationUsecase() OAMApplicationUsecase

NewOAMApplicationUsecase new oam_application usecase

type PolicyType added in v1.2.0

type PolicyType string

PolicyType build-in policy type

type ProjectUsecase added in v1.2.0

type ProjectUsecase 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
	GetConfigs(ctx context.Context, projectName, configType string) ([]*apisv1.Config, error)
}

ProjectUsecase project manage usecase.

func NewProjectUsecase added in v1.2.0

func NewProjectUsecase(ds datastore.DataStore, rbacUsecase RBACUsecase) ProjectUsecase

NewProjectUsecase new project usecase

type RBACUsecase added in v1.3.0

type RBACUsecase 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)
	DeletePermission(ctx context.Context, projectName, permName string) error
	InitDefaultRoleAndUsersForProject(ctx context.Context, project *model.Project) error
	Init(ctx context.Context) error
}

RBACUsecase implement RBAC-related business logic.

func NewRBACUsecase added in v1.3.0

func NewRBACUsecase(ds datastore.DataStore) RBACUsecase

NewRBACUsecase is the usecase service of RBAC

type RequestResourceAction added in v1.3.0

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

RequestResourceAction resource permission boundary

func (*RequestResourceAction) GetResource added in v1.3.0

func (r *RequestResourceAction) GetResource() *ResourceName

GetResource return the resource after be formated

func (*RequestResourceAction) Match added in v1.3.0

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

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

func (*RequestResourceAction) SetActions added in v1.3.0

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

SetActions set request actions

func (*RequestResourceAction) SetResourceWithName added in v1.3.0

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

SetResourceWithName format resource and assign a value from path parameter

type ResourceName added in v1.3.0

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

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

func ParseResourceName added in v1.3.0

func ParseResourceName(resource string) *ResourceName

ParseResourceName parse string to ResourceName

func (*ResourceName) Match added in v1.3.0

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 added in v1.3.0

func (r *ResourceName) String() string

type SystemInfoUsecase added in v1.2.0

type SystemInfoUsecase 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
}

SystemInfoUsecase is usecase for systemInfoCollection

func NewSystemInfoUsecase added in v1.2.0

func NewSystemInfoUsecase(ds datastore.DataStore) SystemInfoUsecase

NewSystemInfoUsecase return a systemInfoCollectionUsecase

type TargetUsecase added in v1.2.0

type TargetUsecase 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
}

TargetUsecase Target manage api

func NewTargetUsecase added in v1.2.0

func NewTargetUsecase(ds datastore.DataStore) TargetUsecase

NewTargetUsecase new Target usecase

type UserUsecase added in v1.3.0

type UserUsecase 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
}

UserUsecase User manage api

func NewUserUsecase added in v1.3.0

func NewUserUsecase(ds datastore.DataStore, projectUsecase ProjectUsecase, sysUsecase SystemInfoUsecase, rbacUsecase RBACUsecase) UserUsecase

NewUserUsecase new User usecase

type VelaQLUsecase added in v1.2.0

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

VelaQLUsecase velaQL usecase

func NewVelaQLUsecase added in v1.2.0

func NewVelaQLUsecase() VelaQLUsecase

NewVelaQLUsecase new velaQL usecase

type WebhookUsecase added in v1.2.0

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

WebhookUsecase webhook usecase

func NewWebhookUsecase added in v1.2.0

func NewWebhookUsecase(ds datastore.DataStore,
	applicationUsecase ApplicationUsecase,
) WebhookUsecase

NewWebhookUsecase new webhook usecase

type WorkflowUsecase added in v1.2.0

type WorkflowUsecase 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)
	CreateWorkflowRecord(ctx context.Context, appModel *model.Application, app *v1beta1.Application, workflow *model.Workflow) 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 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) error
	CountWorkflow(ctx context.Context, app *model.Application) int64
}

WorkflowUsecase workflow manage api

func NewWorkflowUsecase added in v1.2.0

func NewWorkflowUsecase(ds datastore.DataStore, envUsecase EnvUsecase) WorkflowUsecase

NewWorkflowUsecase new workflow usecase

Jump to

Keyboard shortcuts

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