usecase

package
v0.0.0-...-d535874 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: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEYCLOAK_IDENTITY_COOKIE        = "KEYCLOAK_IDENTITY"
	KEYCLOAK_IDENTITY_LEGACY_COOKIE = "KEYCLOAK_IDENTITY_LEGACY"
)
View Source
const (
	ProjectAll int = iota
	ProjectLeader
	ProjectMember
	ProjectViewer
)
View Source
const MAX_WORKFLOW_TIME = 30

Variables

This section is empty.

Functions

This section is empty.

Types

type AppGroupUsecase

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

func (*AppGroupUsecase) Create

func (u *AppGroupUsecase) Create(ctx context.Context, dto model.AppGroup) (id domain.AppGroupId, err error)

func (*AppGroupUsecase) Delete

func (u *AppGroupUsecase) Delete(ctx context.Context, id domain.AppGroupId) (err error)

func (*AppGroupUsecase) Fetch

func (u *AppGroupUsecase) Fetch(ctx context.Context, clusterId domain.ClusterId, pg *pagination.Pagination) (out []model.AppGroup, err error)

func (*AppGroupUsecase) Get

func (u *AppGroupUsecase) Get(ctx context.Context, id domain.AppGroupId) (out model.AppGroup, err error)

func (*AppGroupUsecase) GetApplications

func (u *AppGroupUsecase) GetApplications(ctx context.Context, id domain.AppGroupId, applicationType domain.ApplicationType) (out []model.Application, err error)

func (*AppGroupUsecase) UpdateApplication

func (u *AppGroupUsecase) UpdateApplication(ctx context.Context, dto model.Application) (err error)

type AppServeAppUsecase

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

func (*AppServeAppUsecase) AbortAppServeApp

func (u *AppServeAppUsecase) AbortAppServeApp(ctx context.Context, appId string) (ret string, err error)

func (*AppServeAppUsecase) CreateAppServeApp

func (u *AppServeAppUsecase) CreateAppServeApp(ctx context.Context, app *model.AppServeApp) (string, string, error)

func (*AppServeAppUsecase) DeleteAppServeApp

func (u *AppServeAppUsecase) DeleteAppServeApp(ctx context.Context, appId string) (res string, err error)

func (*AppServeAppUsecase) GetAppServeAppById

func (u *AppServeAppUsecase) GetAppServeAppById(ctx context.Context, appId string) (*model.AppServeApp, error)

func (*AppServeAppUsecase) GetAppServeAppLatestTask

func (u *AppServeAppUsecase) GetAppServeAppLatestTask(ctx context.Context, appId string) (*model.AppServeAppTask, error)

func (*AppServeAppUsecase) GetAppServeAppTaskById

func (u *AppServeAppUsecase) GetAppServeAppTaskById(ctx context.Context, taskId string) (*model.AppServeAppTask, *model.AppServeApp, error)

func (*AppServeAppUsecase) GetAppServeAppTasks

func (u *AppServeAppUsecase) GetAppServeAppTasks(ctx context.Context, appId string, pg *pagination.Pagination) ([]model.AppServeAppTask, error)

func (*AppServeAppUsecase) GetAppServeApps

func (u *AppServeAppUsecase) GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error)

func (*AppServeAppUsecase) GetNumOfAppsOnStack

func (u *AppServeAppUsecase) GetNumOfAppsOnStack(ctx context.Context, organizationId string, clusterId string) (int64, error)

func (*AppServeAppUsecase) IsAppServeAppExist

func (u *AppServeAppUsecase) IsAppServeAppExist(ctx context.Context, appId string) (bool, error)

func (*AppServeAppUsecase) IsAppServeAppNameExist

func (u *AppServeAppUsecase) IsAppServeAppNameExist(ctx context.Context, orgId string, appName string) (bool, error)

func (*AppServeAppUsecase) IsAppServeAppNamespaceExist

func (u *AppServeAppUsecase) IsAppServeAppNamespaceExist(ctx context.Context, clusterId string, new_ns string) (bool, error)

func (*AppServeAppUsecase) PromoteAppServeApp

func (u *AppServeAppUsecase) PromoteAppServeApp(ctx context.Context, appId string) (ret string, err error)

func (*AppServeAppUsecase) RollbackAppServeApp

func (u *AppServeAppUsecase) RollbackAppServeApp(ctx context.Context, appId string, taskId string) (ret string, err error)

func (*AppServeAppUsecase) UpdateAppServeApp

func (u *AppServeAppUsecase) UpdateAppServeApp(ctx context.Context, app *model.AppServeApp, appTask *model.AppServeAppTask) (ret string, err error)

func (*AppServeAppUsecase) UpdateAppServeAppEndpoint

func (u *AppServeAppUsecase) UpdateAppServeAppEndpoint(
	ctx context.Context,
	appId string,
	taskId string,
	endpoint string,
	previewEndpoint string,
	helmRevision int32) (string, error)

func (*AppServeAppUsecase) UpdateAppServeAppStatus

func (u *AppServeAppUsecase) UpdateAppServeAppStatus(ctx context.Context, appId string, taskId string, status string,
	output string) (string, error)

type AuditUsecase

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

func (*AuditUsecase) Create

func (u *AuditUsecase) Create(ctx context.Context, dto model.Audit) (auditId uuid.UUID, err error)

func (*AuditUsecase) Delete

func (u *AuditUsecase) Delete(ctx context.Context, dto model.Audit) (err error)

func (*AuditUsecase) Fetch

func (u *AuditUsecase) Fetch(ctx context.Context, pg *pagination.Pagination) (audits []model.Audit, err error)

func (*AuditUsecase) Get

func (u *AuditUsecase) Get(ctx context.Context, auditId uuid.UUID) (res model.Audit, err error)

type AuthUsecase

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

func (*AuthUsecase) FindId

func (u *AuthUsecase) FindId(ctx context.Context, code string, email string, userName string, organizationId string) (string, error)

func (*AuthUsecase) FindPassword

func (u *AuthUsecase) FindPassword(ctx context.Context, code string, accountId string, email string, userName string, organizationId string) error

func (*AuthUsecase) Login

func (u *AuthUsecase) Login(ctx context.Context, accountId string, password string, organizationId string) (model.User, error)

func (*AuthUsecase) Logout

func (u *AuthUsecase) Logout(ctx context.Context, sessionId string, organizationName string) error

func (*AuthUsecase) SingleSignIn

func (u *AuthUsecase) SingleSignIn(ctx context.Context, organizationId, accountId, password string) ([]*http.Cookie, error)

func (*AuthUsecase) SingleSignOut

func (u *AuthUsecase) SingleSignOut(ctx context.Context, organizationId string) (string, []*http.Cookie, error)

func (*AuthUsecase) UpdateExpiredTimeOnToken

func (u *AuthUsecase) UpdateExpiredTimeOnToken(ctx context.Context, organizationId string, userId string) error

func (*AuthUsecase) VerifyIdentity

func (u *AuthUsecase) VerifyIdentity(ctx context.Context, accountId string, email string, userName string, organizationId string) error

func (*AuthUsecase) VerifyToken

func (u *AuthUsecase) VerifyToken(ctx context.Context, token string) (bool, error)

type CloudAccountUsecase

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

func (*CloudAccountUsecase) Create

func (u *CloudAccountUsecase) Create(ctx context.Context, dto model.CloudAccount) (cloudAccountId uuid.UUID, err error)

func (*CloudAccountUsecase) Delete

func (*CloudAccountUsecase) DeleteForce

func (u *CloudAccountUsecase) DeleteForce(ctx context.Context, cloudAccountId uuid.UUID) (out model.CloudAccount, err error)

func (*CloudAccountUsecase) Fetch

func (u *CloudAccountUsecase) Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) (cloudAccounts []model.CloudAccount, err error)

func (*CloudAccountUsecase) Get

func (u *CloudAccountUsecase) Get(ctx context.Context, cloudAccountId uuid.UUID) (res model.CloudAccount, err error)

func (*CloudAccountUsecase) GetByAwsAccountId

func (u *CloudAccountUsecase) GetByAwsAccountId(ctx context.Context, awsAccountId string) (res model.CloudAccount, err error)

func (*CloudAccountUsecase) GetByName

func (u *CloudAccountUsecase) GetByName(ctx context.Context, organizationId string, name string) (res model.CloudAccount, err error)

func (*CloudAccountUsecase) GetResourceQuota

func (u *CloudAccountUsecase) GetResourceQuota(ctx context.Context, cloudAccountId uuid.UUID) (available bool, out domain.ResourceQuota, err error)

func (*CloudAccountUsecase) Update

type ClusterUsecase

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

func (*ClusterUsecase) Bootstrap

func (u *ClusterUsecase) Bootstrap(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)

func (*ClusterUsecase) Create

func (u *ClusterUsecase) Create(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)

func (*ClusterUsecase) CreateBootstrapKubeconfig

func (u *ClusterUsecase) CreateBootstrapKubeconfig(ctx context.Context, clusterId domain.ClusterId) (out domain.BootstrapKubeconfig, err error)

func (*ClusterUsecase) Delete

func (u *ClusterUsecase) Delete(ctx context.Context, clusterId domain.ClusterId) (err error)

func (*ClusterUsecase) Fetch

func (u *ClusterUsecase) Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) (out []model.Cluster, err error)

func (*ClusterUsecase) FetchByCloudAccountId

func (u *ClusterUsecase) FetchByCloudAccountId(ctx context.Context, cloudAccountId uuid.UUID, pg *pagination.Pagination) (out []model.Cluster, err error)

func (*ClusterUsecase) Get

func (u *ClusterUsecase) Get(ctx context.Context, clusterId domain.ClusterId) (out model.Cluster, err error)

func (*ClusterUsecase) GetBootstrapKubeconfig

func (u *ClusterUsecase) GetBootstrapKubeconfig(ctx context.Context, clusterId domain.ClusterId) (out domain.BootstrapKubeconfig, err error)

func (*ClusterUsecase) GetClusterSiteValues

func (u *ClusterUsecase) GetClusterSiteValues(ctx context.Context, clusterId domain.ClusterId) (out domain.ClusterSiteValuesResponse, err error)

func (*ClusterUsecase) GetNodes

func (u *ClusterUsecase) GetNodes(ctx context.Context, clusterId domain.ClusterId) (out []domain.ClusterNode, err error)

func (*ClusterUsecase) Import

func (u *ClusterUsecase) Import(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)

func (*ClusterUsecase) Install

func (u *ClusterUsecase) Install(ctx context.Context, clusterId domain.ClusterId) (err error)

func (*ClusterUsecase) WithTrx

func (u *ClusterUsecase) WithTrx(trxHandle *gorm.DB) IClusterUsecase

type DashboardUsecase

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

func (*DashboardUsecase) CreateDashboard

func (u *DashboardUsecase) CreateDashboard(ctx context.Context, dashboard *model.Dashboard) (string, error)

func (*DashboardUsecase) GetCharts

func (u *DashboardUsecase) GetCharts(ctx context.Context, organizationId string, chartType domain.ChartType, duration string, interval string, year string, month string) (out []domain.DashboardChart, err error)

func (*DashboardUsecase) GetDashboard

func (u *DashboardUsecase) GetDashboard(ctx context.Context, organizationId string, userId string, dashboardKey string) (*model.Dashboard, error)

func (*DashboardUsecase) GetFlatClusterIds

func (u *DashboardUsecase) GetFlatClusterIds(ctx context.Context, organizationId string) (string, error)

func (*DashboardUsecase) GetPolicyEnforcement

func (u *DashboardUsecase) GetPolicyEnforcement(ctx context.Context, organizationId string, primaryClusterId string) (*domain.BarChartData, error)

func (*DashboardUsecase) GetPolicyUpdate

func (*DashboardUsecase) GetPolicyViolation

func (u *DashboardUsecase) GetPolicyViolation(ctx context.Context, organizationId string, duration string, interval string) (*domain.BarChartData, error)

func (*DashboardUsecase) GetPolicyViolationLog

func (u *DashboardUsecase) GetPolicyViolationLog(ctx context.Context, organizationId string) (*domain.GetDashboardPolicyViolationLogResponse, error)

func (*DashboardUsecase) GetPolicyViolationTop5

func (u *DashboardUsecase) GetPolicyViolationTop5(ctx context.Context, organizationId string, duration string, interval string) (*domain.BarChartData, error)

func (*DashboardUsecase) GetResources

func (u *DashboardUsecase) GetResources(ctx context.Context, organizationId string) (out domain.DashboardResource, err error)

func (*DashboardUsecase) GetStacks

func (u *DashboardUsecase) GetStacks(ctx context.Context, organizationId string) (out []domain.DashboardStack, err error)

func (*DashboardUsecase) GetThanosClient

func (u *DashboardUsecase) GetThanosClient(ctx context.Context, organizationId string) (thanos.ThanosClient, error)

func (*DashboardUsecase) GetWorkload

func (u *DashboardUsecase) GetWorkload(ctx context.Context, organizationId string) (*domain.GetDashboardWorkloadResponse, error)

func (*DashboardUsecase) UpdateDashboard

func (u *DashboardUsecase) UpdateDashboard(ctx context.Context, dashboard *model.Dashboard) error

type IAppGroupUsecase

type IAppGroupUsecase interface {
	Fetch(ctx context.Context, clusterId domain.ClusterId, pg *pagination.Pagination) ([]model.AppGroup, error)
	Create(ctx context.Context, dto model.AppGroup) (id domain.AppGroupId, err error)
	Get(ctx context.Context, id domain.AppGroupId) (out model.AppGroup, err error)
	Delete(ctx context.Context, id domain.AppGroupId) (err error)
	GetApplications(ctx context.Context, id domain.AppGroupId, applicationType domain.ApplicationType) (out []model.Application, err error)
	UpdateApplication(ctx context.Context, dto model.Application) (err error)
}

func NewAppGroupUsecase

func NewAppGroupUsecase(r repository.Repository, argoClient argowf.ArgoClient) IAppGroupUsecase

type IAppServeAppUsecase

type IAppServeAppUsecase interface {
	CreateAppServeApp(ctx context.Context, app *model.AppServeApp) (appId string, taskId string, err error)
	GetAppServeApps(ctx context.Context, organizationId string, projectId string, showAll bool, pg *pagination.Pagination) ([]model.AppServeApp, error)
	GetAppServeAppById(ctx context.Context, appId string) (*model.AppServeApp, error)
	GetAppServeAppTasks(ctx context.Context, appId string, pg *pagination.Pagination) ([]model.AppServeAppTask, error)
	GetAppServeAppTaskById(ctx context.Context, taskId string) (*model.AppServeAppTask, *model.AppServeApp, error)
	GetAppServeAppLatestTask(ctx context.Context, appId string) (*model.AppServeAppTask, error)
	GetNumOfAppsOnStack(ctx context.Context, organizationId string, clusterId string) (int64, error)
	IsAppServeAppExist(ctx context.Context, appId string) (bool, error)
	IsAppServeAppNameExist(ctx context.Context, orgId string, appName string) (bool, error)
	IsAppServeAppNamespaceExist(ctx context.Context, clusterId string, namespace string) (bool, error)
	UpdateAppServeAppStatus(ctx context.Context, appId string, taskId string, status string, output string) (ret string, err error)
	DeleteAppServeApp(ctx context.Context, appId string) (res string, err error)
	UpdateAppServeApp(ctx context.Context, app *model.AppServeApp, appTask *model.AppServeAppTask) (ret string, err error)
	UpdateAppServeAppEndpoint(ctx context.Context, appId string, taskId string, endpoint string, previewEndpoint string, helmRevision int32) (string, error)
	PromoteAppServeApp(ctx context.Context, appId string) (ret string, err error)
	AbortAppServeApp(ctx context.Context, appId string) (ret string, err error)
	RollbackAppServeApp(ctx context.Context, appId string, taskId string) (ret string, err error)
}

func NewAppServeAppUsecase

func NewAppServeAppUsecase(r repository.Repository, argoClient argowf.ArgoClient) IAppServeAppUsecase

type IAuditUsecase

type IAuditUsecase interface {
	Get(ctx context.Context, auditId uuid.UUID) (model.Audit, error)
	Fetch(ctx context.Context, pg *pagination.Pagination) ([]model.Audit, error)
	Create(ctx context.Context, dto model.Audit) (auditId uuid.UUID, err error)
	Delete(ctx context.Context, dto model.Audit) error
}

func NewAuditUsecase

func NewAuditUsecase(r repository.Repository) IAuditUsecase

type IAuthUsecase

type IAuthUsecase interface {
	Login(ctx context.Context, accountId string, password string, organizationId string) (model.User, error)
	Logout(ctx context.Context, sessionId string, organizationId string) error
	FindId(ctx context.Context, code string, email string, userName string, organizationId string) (string, error)
	FindPassword(ctx context.Context, code string, accountId string, email string, userName string, organizationId string) error
	VerifyIdentity(ctx context.Context, accountId string, email string, userName string, organizationId string) error
	SingleSignIn(ctx context.Context, organizationId, accountId, password string) ([]*http.Cookie, error)
	SingleSignOut(ctx context.Context, organizationId string) (string, []*http.Cookie, error)
	VerifyToken(ctx context.Context, token string) (bool, error)
	UpdateExpiredTimeOnToken(ctx context.Context, organizationId string, userId string) error
}

type ICloudAccountUsecase

type ICloudAccountUsecase interface {
	Get(ctx context.Context, cloudAccountId uuid.UUID) (model.CloudAccount, error)
	GetByName(ctx context.Context, organizationId string, name string) (model.CloudAccount, error)
	GetByAwsAccountId(ctx context.Context, awsAccountId string) (model.CloudAccount, error)
	GetResourceQuota(ctx context.Context, cloudAccountId uuid.UUID) (available bool, out domain.ResourceQuota, err error)
	Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.CloudAccount, error)
	Create(ctx context.Context, dto model.CloudAccount) (cloudAccountId uuid.UUID, err error)
	Update(ctx context.Context, dto model.CloudAccount) error
	Delete(ctx context.Context, dto model.CloudAccount) (model.CloudAccount, error)
	DeleteForce(ctx context.Context, cloudAccountId uuid.UUID) (model.CloudAccount, error)
}

func NewCloudAccountUsecase

func NewCloudAccountUsecase(r repository.Repository, argoClient argowf.ArgoClient) ICloudAccountUsecase

type IClusterUsecase

type IClusterUsecase interface {
	WithTrx(*gorm.DB) IClusterUsecase
	Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.Cluster, error)
	FetchByCloudAccountId(ctx context.Context, cloudAccountId uuid.UUID, pg *pagination.Pagination) (out []model.Cluster, err error)
	Create(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)
	Import(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)
	Bootstrap(ctx context.Context, dto model.Cluster) (clusterId domain.ClusterId, err error)
	Install(ctx context.Context, clusterId domain.ClusterId) (err error)
	Get(ctx context.Context, clusterId domain.ClusterId) (out model.Cluster, err error)
	GetClusterSiteValues(ctx context.Context, clusterId domain.ClusterId) (out domain.ClusterSiteValuesResponse, err error)
	Delete(ctx context.Context, clusterId domain.ClusterId) (err error)
	CreateBootstrapKubeconfig(ctx context.Context, clusterId domain.ClusterId) (out domain.BootstrapKubeconfig, err error)
	GetBootstrapKubeconfig(ctx context.Context, clusterId domain.ClusterId) (out domain.BootstrapKubeconfig, err error)
	GetNodes(ctx context.Context, clusterId domain.ClusterId) (out []domain.ClusterNode, err error)
}

func NewClusterUsecase

func NewClusterUsecase(r repository.Repository, argoClient argowf.ArgoClient, cache *gcache.Cache) IClusterUsecase

type IDashboardUsecase

type IDashboardUsecase interface {
	CreateDashboard(ctx context.Context, dashboard *model.Dashboard) (string, error)
	GetDashboard(ctx context.Context, organizationId string, userId string, dashboardKey string) (*model.Dashboard, error)
	UpdateDashboard(ctx context.Context, dashboard *model.Dashboard) error
	GetCharts(ctx context.Context, organizationId string, chartType domain.ChartType, duration string, interval string, year string, month string) (res []domain.DashboardChart, err error)
	GetStacks(ctx context.Context, organizationId string) (out []domain.DashboardStack, err error)
	GetResources(ctx context.Context, organizationId string) (out domain.DashboardResource, err error)
	GetPolicyUpdate(ctx context.Context, policyTemplates []policytemplate.TKSPolicyTemplate, policies []policytemplate.TKSPolicy) (domain.DashboardPolicyUpdate, error)
	GetPolicyEnforcement(ctx context.Context, organizationId string, primaryClusterId string) (*domain.BarChartData, error)
	GetPolicyViolation(ctx context.Context, organizationId string, duration string, interval string) (*domain.BarChartData, error)
	GetPolicyViolationLog(ctx context.Context, organizationId string) (*domain.GetDashboardPolicyViolationLogResponse, error)
	GetWorkload(ctx context.Context, organizationId string) (*domain.GetDashboardWorkloadResponse, error)
	GetPolicyViolationTop5(ctx context.Context, organizationId string, duration string, interval string) (*domain.BarChartData, error)
}

func NewDashboardUsecase

func NewDashboardUsecase(r repository.Repository, cache *gcache.Cache) IDashboardUsecase

type IOrganizationUsecase

type IOrganizationUsecase interface {
	Create(context.Context, *model.Organization) (organizationId string, err error)
	Fetch(ctx context.Context, pg *pagination.Pagination) (*[]model.Organization, error)
	Get(ctx context.Context, organizationId string) (model.Organization, error)
	Update(ctx context.Context, organizationId string, dto model.Organization) (model.Organization, error)
	UpdatePrimaryClusterId(ctx context.Context, organizationId string, clusterId string) (err error)
	ChangeAdminId(ctx context.Context, organizationId string, adminId uuid.UUID) error
	Delete(ctx context.Context, organizationId string, accessToken string) error
}

type IPermissionUsecase

type IPermissionUsecase interface {
	CreatePermissionSet(ctx context.Context, permissionSet *model.PermissionSet) error
	GetPermissionSetByRoleId(ctx context.Context, roleId string) (*model.PermissionSet, error)
	ListPermissions(ctx context.Context, roleId string) ([]*model.Permission, error)
	SetRoleIdToPermissionSet(ctx context.Context, roleId string, permissionSet *model.PermissionSet)
	GetAllowedPermissionSet(ctx context.Context) *model.PermissionSet
	GetUserPermissionSet(ctx context.Context) *model.PermissionSet
	UpdatePermission(ctx context.Context, permission *model.Permission) error
	MergePermissionWithOrOperator(ctx context.Context, permissionSet ...*model.PermissionSet) *model.PermissionSet
}

type IPolicyTemplateUsecase

type IPolicyTemplateUsecase interface {
	Create(ctx context.Context, policyTemplate model.PolicyTemplate) (policyTemplateId uuid.UUID, err error)
	Fetch(ctx context.Context, organizationId *string, pg *pagination.Pagination) (policyTemplates []model.PolicyTemplate, err error)
	Update(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, templateName *string, description *string,
		severity *string, deorecated *bool, permittedOrganizationIds *[]string) (err error)
	Get(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (policyTemplates *model.PolicyTemplate, err error)
	Delete(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (err error)
	IsPolicyTemplateNameExist(ctx context.Context, organizationId *string, policyTemplateName string) (bool, error)
	IsPolicyTemplateKindExist(ctx context.Context, organizationId *string, policyTemplateKind string) (bool, error)
	GetPolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string) (policyTemplateVersionsReponse *model.PolicyTemplate, err error)
	ListPolicyTemplateVersions(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (policyTemplateVersionsReponse *domain.ListPolicyTemplateVersionsResponse, err error)
	DeletePolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string) (err error)
	CreatePolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, newVersion string, schema []*domain.ParameterDef, rego string, libs []string) (version string, err error)

	RegoCompile(request *domain.RegoCompileRequest, parseParameter bool) (response *domain.RegoCompileResponse, err error)

	ListPolicyTemplateStatistics(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (statistics []model.UsageCount, err error)
	GetPolicyTemplateDeploy(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (deployInfo domain.GetPolicyTemplateDeployResponse, err error)

	ExtractPolicyParameters(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string, rego string, libs []string) (response *domain.RegoCompileResponse, err error)

	AddPermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)
	UpdatePermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)
	DeletePermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)
}

type IPolicyUsecase

type IPolicyUsecase interface {
	Create(ctx context.Context, organizationId string, dto model.Policy) (policyId uuid.UUID, err error)
	Update(ctx context.Context, organizationId string, policyId uuid.UUID,
		mandatory *bool, policyName *string, description *string, templateId *uuid.UUID, enforcementAction *string,
		parameters *string, match *domain.Match, matchYaml *string, targetClusterIds *[]string) (err error)
	Delete(ctx context.Context, organizationId string, policyId uuid.UUID) (err error)
	Get(ctx context.Context, organizationId string, policyId uuid.UUID) (policy *model.Policy, err error)
	GetForEdit(ctx context.Context, organizationId string, policyId uuid.UUID) (policy *model.Policy, err error)
	Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination, filledParameter bool) (*[]model.Policy, error)
	IsPolicyIdExist(ctx context.Context, organizationId string, policyId uuid.UUID) (exists bool, err error)
	IsPolicyNameExist(ctx context.Context, organizationId string, policyName string) (exists bool, err error)
	UpdatePolicyTargetClusters(ctx context.Context, organizationId string, policyId uuid.UUID, currentClusterIds []string, targetClusterIds []string) (err error)
	SetMandatoryPolicies(ctx context.Context, organizationId string, mandatoryPolicyIds []uuid.UUID, nonMandatoryPolicyIds []uuid.UUID) (err error)
	GetMandatoryPolicies(ctx context.Context, organizationId string) (response *domain.GetMandatoryPoliciesResponse, err error)
	ListStackPolicyStatus(ctx context.Context, clusterId string, pg *pagination.Pagination) (policyStatuses []domain.StackPolicyStatusResponse, err error)
	GetStackPolicyTemplateStatus(ctx context.Context, clusterId string, policyTemplateId uuid.UUID) (clusterPolicyTemplateStatusResponse *domain.GetStackPolicyTemplateStatusResponse, err error)
	UpdateStackPolicyTemplateStatus(ctx context.Context, clusterId string, policyTemplateId uuid.UUID,
		currentVersion string, targetVerson string) (err error)
	GetPolicyStatistics(ctx context.Context, organizationId string) (response *domain.PolicyStatisticsResponse, err error)
	AddPoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)
	UpdatePoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)
	DeletePoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)
	GetStackPolicyStatistics(ctx context.Context, organizationId string, clusterId domain.ClusterId) (statistics *domain.StackPolicyStatistics, err error)
	GetPolicyIDsByClusterID(ctx context.Context, clusterId domain.ClusterId) (out *[]uuid.UUID, err error)
}

func NewPolicyUsecase

func NewPolicyUsecase(r repository.Repository) IPolicyUsecase

type IProjectUsecase

type IProjectUsecase interface {
	CreateProject(ctx context.Context, p *model.Project) (string, error)
	GetProjects(ctx context.Context, organizationId string, userId string, onlyMyProject bool, projectName string, pg *pagination.Pagination) ([]domain.ProjectResponse, error)
	GetProject(ctx context.Context, organizationId string, projectId string) (*model.Project, error)
	GetProjectWithLeader(ctx context.Context, organizationId string, projectId string) (*model.Project, error)
	IsProjectNameExist(ctx context.Context, organizationId string, projectName string) (bool, error)
	UpdateProject(ctx context.Context, p *model.Project, newLeaderId string) error
	GetProjectRole(ctx context.Context, id string) (*model.ProjectRole, error)
	GetProjectRoles(ctx context.Context, query int) ([]model.ProjectRole, error)
	AddProjectMember(ctx context.Context, organizationId string, pm *model.ProjectMember) (string, error)
	GetProjectUser(ctx context.Context, projectUserId string) (*model.ProjectUser, error)
	GetProjectMember(ctx context.Context, projectMemberId string) (*model.ProjectMember, error)
	GetProjectMemberByUserId(ctx context.Context, projectId string, userId string) (*model.ProjectMember, error)
	GetProjectMembers(ctx context.Context, projectId string, query int, pg *pagination.Pagination) ([]model.ProjectMember, error)
	GetProjectMemberCount(ctx context.Context, projectMemberId string) (*domain.GetProjectMemberCountResponse, error)
	RemoveProjectMember(ctx context.Context, organizationId string, projectMemberId string) error
	UpdateProjectMemberRole(ctx context.Context, pm *model.ProjectMember) error
	CreateProjectNamespace(ctx context.Context, organizationId string, pn *model.ProjectNamespace) error
	IsProjectNamespaceExist(ctx context.Context, organizationId string, projectId string, stackId string, projectNamespace string) (bool, error)
	GetProjectNamespaces(ctx context.Context, organizationId string, projectId string, pg *pagination.Pagination) ([]model.ProjectNamespace, error)
	GetProjectNamespace(ctx context.Context, organizationId string, projectId string, projectNamespace string, stackId string) (*model.ProjectNamespace, error)
	UpdateProjectNamespace(ctx context.Context, pn *model.ProjectNamespace) error
	DeleteProjectNamespace(ctx context.Context, organizationId string, projectId string, projectNamespace string, stackId string) error
	GetAppCount(ctx context.Context, organizationId string, projectId string, namespace string) (appCount int, err error)
	EnsureNamespaceForCluster(ctx context.Context, organizationId string, stackId string, namespaceName string) error
	EnsureRequiredSetupForCluster(ctx context.Context, organizationId string, projectId string, stackId string) error
	MayRemoveRequiredSetupForCluster(ctx context.Context, organizationId string, projectId string, stackId string) error
	CreateK8SNSRoleBinding(ctx context.Context, organizationId string, projectId string, stackId string, namespace string) error
	DeleteK8SNSRoleBinding(ctx context.Context, organizationId string, projectId string, stackId string, namespace string) error
	GetProjectNamespaceKubeconfig(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (string, error)
	GetProjectKubeconfig(ctx context.Context, organizationId string, projectId string) (string, error)
	GetK8sResources(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (out domain.ProjectNamespaceK8sResources, err error)
	GetResourcesUsage(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (out domain.ProjectNamespaceResourcesUsage, err error)
	AssignKeycloakClientRoleToMember(ctx context.Context, organizationId string, projectId string, clientId string, projectMemberId string) error
	UnassignKeycloakClientRoleToMember(ctx context.Context, organizationId string, projectId string, clientId string, projectMemberId string) error
}

type IRoleUsecase

type IRoleUsecase interface {
	CreateTksRole(ctx context.Context, role *model.Role) (string, error)
	ListTksRoles(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]*model.Role, error)
	GetTksRole(ctx context.Context, orgainzationId string, id string) (*model.Role, error)
	DeleteTksRole(ctx context.Context, organizationId string, id string) error
	UpdateTksRole(ctx context.Context, role *model.Role) error
	IsRoleNameExisted(ctx context.Context, organizationId string, roleName string) (bool, error)
}

type IStackTemplateUsecase

type IStackTemplateUsecase interface {
	Get(ctx context.Context, stackTemplateId uuid.UUID) (model.StackTemplate, error)
	Fetch(ctx context.Context, pg *pagination.Pagination) ([]model.StackTemplate, error)
	FetchWithOrganization(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.StackTemplate, error)
	Create(ctx context.Context, dto model.StackTemplate) (stackTemplate uuid.UUID, err error)
	Update(ctx context.Context, dto model.StackTemplate) error
	Delete(ctx context.Context, stackTemplateId uuid.UUID) error
	UpdateOrganizations(ctx context.Context, dto model.StackTemplate) error
	GetByName(ctx context.Context, name string) (model.StackTemplate, error)
	AddOrganizationStackTemplates(ctx context.Context, organizationId string, stackTemplateIds []string) error
	RemoveOrganizationStackTemplates(ctx context.Context, organizationId string, stackTemplateIds []string) error
}

type IStackUsecase

type IStackUsecase interface {
	Get(ctx context.Context, stackId domain.StackId) (model.Stack, error)
	GetByName(ctx context.Context, organizationId string, name string) (model.Stack, error)
	Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.Stack, error)
	Create(ctx context.Context, dto model.Stack) (stackId domain.StackId, err error)
	Install(ctx context.Context, stackId domain.StackId) (err error)
	Update(ctx context.Context, dto model.Stack) error
	Delete(ctx context.Context, dto model.Stack) error
	GetKubeConfig(ctx context.Context, stackId domain.StackId) (kubeConfig string, err error)
	GetStepStatus(ctx context.Context, stackId domain.StackId) (out []domain.StackStepStatus, stackStatus string, err error)
	SetFavorite(ctx context.Context, stackId domain.StackId) error
	DeleteFavorite(ctx context.Context, stackId domain.StackId) error
}

func NewStackUsecase

func NewStackUsecase(r repository.Repository, argoClient argowf.ArgoClient, dashbordUsecase IDashboardUsecase) IStackUsecase

type ISystemNotificationRuleUsecase

type ISystemNotificationRuleUsecase interface {
	Get(ctx context.Context, systemNotificationRuleId uuid.UUID) (model.SystemNotificationRule, error)
	Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.SystemNotificationRule, error)
	Create(ctx context.Context, dto model.SystemNotificationRule) (systemNotificationRule uuid.UUID, err error)
	Update(ctx context.Context, dto model.SystemNotificationRule) error
	Delete(ctx context.Context, systemNotificationRuleId uuid.UUID) (model.SystemNotificationRule, error)
	GetByName(ctx context.Context, name string) (model.SystemNotificationRule, error)
	MakeDefaultSystemNotificationRules(ctx context.Context, organizationId string, dto *model.Organization) error
}

type ISystemNotificationTemplateUsecase

type ISystemNotificationTemplateUsecase interface {
	Get(ctx context.Context, alertId uuid.UUID) (model.SystemNotificationTemplate, error)
	GetByName(ctx context.Context, name string) (model.SystemNotificationTemplate, error)
	Fetch(ctx context.Context, pg *pagination.Pagination) ([]model.SystemNotificationTemplate, error)
	FetchWithOrganization(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.SystemNotificationTemplate, error)
	Create(ctx context.Context, dto model.SystemNotificationTemplate) (systemNotificationTemplate uuid.UUID, err error)
	Update(ctx context.Context, dto model.SystemNotificationTemplate) error
	Delete(ctx context.Context, systemNotificationTemplateId uuid.UUID) error
	AddOrganizationSystemNotificationTemplates(ctx context.Context, organizationId string, systemNotificationTemplateIds []string) error
	RemoveOrganizationSystemNotificationTemplates(ctx context.Context, organizationId string, systemNotificationTemplateIds []string) error
}

type ISystemNotificationUsecase

type ISystemNotificationUsecase interface {
	Get(ctx context.Context, systemNotificationId uuid.UUID) (model.SystemNotification, error)
	GetByName(ctx context.Context, organizationId string, name string) (model.SystemNotification, error)
	FetchSystemNotifications(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.SystemNotification, error)
	FetchPolicyNotifications(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]model.SystemNotification, error)
	Create(ctx context.Context, dto domain.CreateSystemNotificationRequest) (err error)
	Update(ctx context.Context, dto model.SystemNotification) error
	Delete(ctx context.Context, dto model.SystemNotification) error

	CreateSystemNotificationAction(ctx context.Context, dto model.SystemNotificationAction) (systemNotificationActionId uuid.UUID, err error)
}

type IUserUsecase

type IUserUsecase interface {
	CreateAdmin(ctx context.Context, user *model.User) (*model.User, error)
	DeleteAdmin(ctx context.Context, organizationId string) error
	DeleteAll(ctx context.Context, organizationId string) error
	Create(ctx context.Context, user *model.User) (*model.User, error)
	List(ctx context.Context, organizationId string) (*[]model.User, error)
	ListWithPagination(ctx context.Context, organizationId string, pg *pagination.Pagination) (*[]model.User, error)
	Get(ctx context.Context, userId uuid.UUID) (*model.User, error)
	Update(ctx context.Context, user *model.User) (*model.User, error)
	ResetPassword(ctx context.Context, userId uuid.UUID) error
	ResetPasswordByAccountId(ctx context.Context, accountId string, organizationId string) error
	GenerateRandomPassword(ctx context.Context) string
	Delete(ctx context.Context, userId uuid.UUID, organizationId string) error
	GetByAccountId(ctx context.Context, accountId string, organizationId string) (*model.User, error)
	GetByEmail(ctx context.Context, email string, organizationId string) (*model.User, error)
	SendEmailForTemporaryPassword(ctx context.Context, accountId string, organizationId string, password string) error

	UpdateByAccountId(ctx context.Context, user *model.User) (*model.User, error)
	UpdatePasswordByAccountId(ctx context.Context, accountId string, originPassword string, newPassword string, organizationId string) error
	RenewalPasswordExpiredTime(ctx context.Context, userId uuid.UUID) error
	RenewalPasswordExpiredTimeByAccountId(ctx context.Context, accountId string, organizationId string) error
	DeleteByAccountId(ctx context.Context, accountId string, organizationId string) error
	ValidateAccount(ctx context.Context, userId uuid.UUID, password string, organizationId string) error
	ValidateAccountByAccountId(ctx context.Context, accountId string, password string, organizationId string) error

	UpdateByAccountIdByAdmin(ctx context.Context, user *model.User) (*model.User, error)

	ListUsersByRole(ctx context.Context, organizationId string, roleId string, pg *pagination.Pagination) (*[]model.User, error)
}

type OrganizationUsecase

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

func (*OrganizationUsecase) ChangeAdminId

func (u *OrganizationUsecase) ChangeAdminId(ctx context.Context, organizationId string, adminId uuid.UUID) error

func (*OrganizationUsecase) Create

func (u *OrganizationUsecase) Create(ctx context.Context, in *model.Organization) (organizationId string, err error)

func (*OrganizationUsecase) Delete

func (u *OrganizationUsecase) Delete(ctx context.Context, organizationId string, accessToken string) (err error)

func (*OrganizationUsecase) Fetch

func (*OrganizationUsecase) Get

func (u *OrganizationUsecase) Get(ctx context.Context, organizationId string) (out model.Organization, err error)

func (*OrganizationUsecase) Update

func (u *OrganizationUsecase) Update(ctx context.Context, organizationId string, in model.Organization) (model.Organization, error)

func (*OrganizationUsecase) UpdatePrimaryClusterId

func (u *OrganizationUsecase) UpdatePrimaryClusterId(ctx context.Context, organizationId string, clusterId string) (err error)

type PermissionUsecase

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

func NewPermissionUsecase

func NewPermissionUsecase(repo repository.Repository) *PermissionUsecase

func (PermissionUsecase) CreatePermissionSet

func (p PermissionUsecase) CreatePermissionSet(ctx context.Context, permissionSet *model.PermissionSet) error

func (PermissionUsecase) DeletePermission

func (p PermissionUsecase) DeletePermission(ctx context.Context, id uuid.UUID) error

func (PermissionUsecase) GetAllowedPermissionSet

func (p PermissionUsecase) GetAllowedPermissionSet(ctx context.Context) *model.PermissionSet

func (PermissionUsecase) GetPermission

func (p PermissionUsecase) GetPermission(ctx context.Context, id uuid.UUID) (*model.Permission, error)

func (PermissionUsecase) GetPermissionSetByRoleId

func (p PermissionUsecase) GetPermissionSetByRoleId(ctx context.Context, roleId string) (*model.PermissionSet, error)

func (PermissionUsecase) GetUserPermissionSet

func (p PermissionUsecase) GetUserPermissionSet(ctx context.Context) *model.PermissionSet

func (PermissionUsecase) ListPermissions

func (p PermissionUsecase) ListPermissions(ctx context.Context, roleId string) ([]*model.Permission, error)

func (PermissionUsecase) MergePermissionWithOrOperator

func (p PermissionUsecase) MergePermissionWithOrOperator(ctx context.Context, permissionSet ...*model.PermissionSet) *model.PermissionSet

func (PermissionUsecase) SetRoleIdToPermissionSet

func (p PermissionUsecase) SetRoleIdToPermissionSet(ctx context.Context, roleId string, permissionSet *model.PermissionSet)

func (PermissionUsecase) UpdatePermission

func (p PermissionUsecase) UpdatePermission(ctx context.Context, permission *model.Permission) error

type PolicyTemplateUsecase

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

func (*PolicyTemplateUsecase) AddPermittedPolicyTemplatesForOrganization

func (u *PolicyTemplateUsecase) AddPermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)

func (*PolicyTemplateUsecase) Create

func (u *PolicyTemplateUsecase) Create(ctx context.Context, dto model.PolicyTemplate) (policyTemplateId uuid.UUID, err error)

func (*PolicyTemplateUsecase) CreatePolicyTemplateVersion

func (u *PolicyTemplateUsecase) CreatePolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, newVersion string, schema []*domain.ParameterDef, rego string, libs []string) (version string, err error)

func (*PolicyTemplateUsecase) Delete

func (u *PolicyTemplateUsecase) Delete(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (err error)

func (*PolicyTemplateUsecase) DeletePermittedPolicyTemplatesForOrganization

func (u *PolicyTemplateUsecase) DeletePermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)

func (*PolicyTemplateUsecase) DeletePolicyTemplateVersion

func (u *PolicyTemplateUsecase) DeletePolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string) (err error)

func (*PolicyTemplateUsecase) ExtractPolicyParameters

func (u *PolicyTemplateUsecase) ExtractPolicyParameters(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string, rego string, libs []string) (response *domain.RegoCompileResponse, err error)

func (*PolicyTemplateUsecase) Fetch

func (u *PolicyTemplateUsecase) Fetch(ctx context.Context, organizationId *string, pg *pagination.Pagination) (policyTemplates []model.PolicyTemplate, err error)

func (*PolicyTemplateUsecase) Get

func (u *PolicyTemplateUsecase) Get(ctx context.Context, organizationId *string, policyTemplateID uuid.UUID) (policyTemplates *model.PolicyTemplate, err error)

func (*PolicyTemplateUsecase) GetPolicyTemplateDeploy

func (u *PolicyTemplateUsecase) GetPolicyTemplateDeploy(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (deployVersions domain.GetPolicyTemplateDeployResponse, err error)

func (*PolicyTemplateUsecase) GetPolicyTemplateVersion

func (u *PolicyTemplateUsecase) GetPolicyTemplateVersion(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, version string) (policyTemplateVersionsReponse *model.PolicyTemplate, err error)

func (*PolicyTemplateUsecase) IsPolicyTemplateKindExist

func (u *PolicyTemplateUsecase) IsPolicyTemplateKindExist(ctx context.Context, organizationId *string, policyTemplateKind string) (bool, error)

func (*PolicyTemplateUsecase) IsPolicyTemplateNameExist

func (u *PolicyTemplateUsecase) IsPolicyTemplateNameExist(ctx context.Context, organizationId *string, policyTemplateName string) (bool, error)

func (*PolicyTemplateUsecase) ListPolicyTemplateStatistics

func (u *PolicyTemplateUsecase) ListPolicyTemplateStatistics(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (statistics []model.UsageCount, err error)

func (*PolicyTemplateUsecase) ListPolicyTemplateVersions

func (u *PolicyTemplateUsecase) ListPolicyTemplateVersions(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID) (policyTemplateVersionsReponse *domain.ListPolicyTemplateVersionsResponse, err error)

func (*PolicyTemplateUsecase) RegoCompile

func (u *PolicyTemplateUsecase) RegoCompile(request *domain.RegoCompileRequest, parseParameter bool) (response *domain.RegoCompileResponse, err error)

func (*PolicyTemplateUsecase) Update

func (u *PolicyTemplateUsecase) Update(ctx context.Context, organizationId *string, policyTemplateId uuid.UUID, templateName *string, description *string, severity *string, deprecated *bool, permittedOrganizationIds *[]string) (err error)

func (*PolicyTemplateUsecase) UpdatePermittedPolicyTemplatesForOrganization

func (u *PolicyTemplateUsecase) UpdatePermittedPolicyTemplatesForOrganization(ctx context.Context, organizationId string, policyTemplateIds []uuid.UUID) (err error)

type PolicyUsecase

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

func (*PolicyUsecase) AddPoliciesForClusterID

func (u *PolicyUsecase) AddPoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)

func (*PolicyUsecase) Create

func (u *PolicyUsecase) Create(ctx context.Context, organizationId string, dto model.Policy) (policyId uuid.UUID, err error)

func (*PolicyUsecase) Delete

func (u *PolicyUsecase) Delete(ctx context.Context, organizationId string, policyId uuid.UUID) (err error)

func (*PolicyUsecase) DeletePoliciesForClusterID

func (u *PolicyUsecase) DeletePoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)

func (*PolicyUsecase) Fetch

func (u *PolicyUsecase) Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination, filledParameter bool) (*[]model.Policy, error)

func (*PolicyUsecase) Get

func (u *PolicyUsecase) Get(ctx context.Context, organizationId string, policyId uuid.UUID) (policy *model.Policy, err error)

func (*PolicyUsecase) GetForEdit

func (u *PolicyUsecase) GetForEdit(ctx context.Context, organizationId string, policyId uuid.UUID) (policy *model.Policy, err error)

func (*PolicyUsecase) GetMandatoryPolicies

func (u *PolicyUsecase) GetMandatoryPolicies(ctx context.Context, organizationId string) (response *domain.GetMandatoryPoliciesResponse, err error)

func (*PolicyUsecase) GetPolicyIDsByClusterID

func (u *PolicyUsecase) GetPolicyIDsByClusterID(ctx context.Context, clusterId domain.ClusterId) (out *[]uuid.UUID, err error)

func (*PolicyUsecase) GetPolicyStatistics

func (u *PolicyUsecase) GetPolicyStatistics(ctx context.Context, organizationId string) (response *domain.PolicyStatisticsResponse, err error)

func (*PolicyUsecase) GetStackPolicyStatistics

func (u *PolicyUsecase) GetStackPolicyStatistics(ctx context.Context, organizationId string, clusterId domain.ClusterId) (statistics *domain.StackPolicyStatistics, err error)

func (*PolicyUsecase) GetStackPolicyTemplateStatus

func (u *PolicyUsecase) GetStackPolicyTemplateStatus(ctx context.Context, clusterId string, policyTemplateId uuid.UUID) (stackPolicyTemplateStatusResponse *domain.GetStackPolicyTemplateStatusResponse, err error)

func (*PolicyUsecase) IsPolicyIdExist

func (u *PolicyUsecase) IsPolicyIdExist(ctx context.Context, organizationId string, policyId uuid.UUID) (exists bool, err error)

func (*PolicyUsecase) IsPolicyNameExist

func (u *PolicyUsecase) IsPolicyNameExist(ctx context.Context, organizationId string, policyName string) (exists bool, err error)

func (*PolicyUsecase) ListStackPolicyStatus

func (u *PolicyUsecase) ListStackPolicyStatus(ctx context.Context, clusterId string, pg *pagination.Pagination) (policyStatuses []domain.StackPolicyStatusResponse, err error)

func (*PolicyUsecase) SetMandatoryPolicies

func (u *PolicyUsecase) SetMandatoryPolicies(ctx context.Context, organizationId string, mandatoryPolicyIds []uuid.UUID, nonMandatoryPolicyIds []uuid.UUID) (err error)

func (*PolicyUsecase) Update

func (u *PolicyUsecase) Update(ctx context.Context, organizationId string, policyId uuid.UUID,
	mandatory *bool, policyName *string, description *string, templateId *uuid.UUID, enforcementAction *string,
	parameters *string, match *domain.Match, matchYaml *string, targetClusterIds *[]string) (err error)

func (*PolicyUsecase) UpdatePoliciesForClusterID

func (u *PolicyUsecase) UpdatePoliciesForClusterID(ctx context.Context, organizationId string, clusterId domain.ClusterId, policyIds []uuid.UUID) (err error)

func (*PolicyUsecase) UpdatePolicyTargetClusters

func (u *PolicyUsecase) UpdatePolicyTargetClusters(ctx context.Context, organizationId string, policyId uuid.UUID, currentClusterIds []string, targetClusterIds []string) (err error)

func (*PolicyUsecase) UpdateStackPolicyTemplateStatus

func (u *PolicyUsecase) UpdateStackPolicyTemplateStatus(ctx context.Context, clusterId string, policyTemplateId uuid.UUID,
	currentVersion string, targetVerson string) (err error)

type ProjectUsecase

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

func (*ProjectUsecase) AddProjectMember

func (u *ProjectUsecase) AddProjectMember(ctx context.Context, organizationId string, pm *model.ProjectMember) (string, error)

func (*ProjectUsecase) AssignKeycloakClientRoleToMember

func (u *ProjectUsecase) AssignKeycloakClientRoleToMember(ctx context.Context, organizationId string, projectId string, clientId string, projectMemberId string) error

func (*ProjectUsecase) CreateK8SNSRoleBinding

func (u *ProjectUsecase) CreateK8SNSRoleBinding(ctx context.Context, organizationId string, projectId string, stackId string, namespace string) error

func (*ProjectUsecase) CreateProject

func (u *ProjectUsecase) CreateProject(ctx context.Context, p *model.Project) (string, error)

func (*ProjectUsecase) CreateProjectNamespace

func (u *ProjectUsecase) CreateProjectNamespace(ctx context.Context, organizationId string, pn *model.ProjectNamespace) error

func (*ProjectUsecase) DeleteK8SNSRoleBinding

func (u *ProjectUsecase) DeleteK8SNSRoleBinding(ctx context.Context, organizationId string, projectId string, stackId string, namespace string) error

func (*ProjectUsecase) DeleteProjectNamespace

func (u *ProjectUsecase) DeleteProjectNamespace(ctx context.Context, organizationId string, projectId string,
	stackId string, projectNamespace string) error

func (*ProjectUsecase) EnsureNamespaceForCluster

func (u *ProjectUsecase) EnsureNamespaceForCluster(ctx context.Context, organizationId string, stackId string, namespaceName string) error

func (*ProjectUsecase) EnsureRequiredSetupForCluster

func (u *ProjectUsecase) EnsureRequiredSetupForCluster(ctx context.Context, organizationId string, projectId string, stackId string) error

func (*ProjectUsecase) GetAppCount

func (u *ProjectUsecase) GetAppCount(ctx context.Context, organizationId string, projectId string, namespace string) (appCount int, err error)

func (*ProjectUsecase) GetK8sResources

func (u *ProjectUsecase) GetK8sResources(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (out domain.ProjectNamespaceK8sResources, err error)

func (*ProjectUsecase) GetProject

func (u *ProjectUsecase) GetProject(ctx context.Context, organizationId string, projectId string) (*model.Project, error)

func (*ProjectUsecase) GetProjectKubeconfig

func (u *ProjectUsecase) GetProjectKubeconfig(ctx context.Context, organizationId string, projectId string) (string, error)

func (*ProjectUsecase) GetProjectMember

func (u *ProjectUsecase) GetProjectMember(ctx context.Context, projectMemberId string) (pm *model.ProjectMember, err error)

func (*ProjectUsecase) GetProjectMemberByUserId

func (u *ProjectUsecase) GetProjectMemberByUserId(ctx context.Context, projectId string, userId string) (pm *model.ProjectMember, err error)

func (*ProjectUsecase) GetProjectMemberCount

func (u *ProjectUsecase) GetProjectMemberCount(ctx context.Context, projectMemberId string) (pmcr *domain.GetProjectMemberCountResponse, err error)

func (*ProjectUsecase) GetProjectMembers

func (u *ProjectUsecase) GetProjectMembers(ctx context.Context, projectId string, query int, pg *pagination.Pagination) (pms []model.ProjectMember, err error)

func (*ProjectUsecase) GetProjectNamespace

func (u *ProjectUsecase) GetProjectNamespace(ctx context.Context, organizationId string, projectId string, projectNamespace string, stackId string) (*model.ProjectNamespace, error)

func (*ProjectUsecase) GetProjectNamespaceKubeconfig

func (u *ProjectUsecase) GetProjectNamespaceKubeconfig(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (string, error)

func (*ProjectUsecase) GetProjectNamespaces

func (u *ProjectUsecase) GetProjectNamespaces(ctx context.Context, organizationId string, projectId string, pg *pagination.Pagination) ([]model.ProjectNamespace, error)

func (*ProjectUsecase) GetProjectRole

func (u *ProjectUsecase) GetProjectRole(ctx context.Context, id string) (*model.ProjectRole, error)

func (*ProjectUsecase) GetProjectRoles

func (u *ProjectUsecase) GetProjectRoles(ctx context.Context, query int) (prs []model.ProjectRole, err error)

func (*ProjectUsecase) GetProjectUser

func (u *ProjectUsecase) GetProjectUser(ctx context.Context, projectUserId string) (*model.ProjectUser, error)

func (*ProjectUsecase) GetProjectWithLeader

func (u *ProjectUsecase) GetProjectWithLeader(ctx context.Context, organizationId string, projectId string) (*model.Project, error)

func (*ProjectUsecase) GetProjects

func (u *ProjectUsecase) GetProjects(ctx context.Context, organizationId string, userId string, onlyMyProject bool, projectName string, pg *pagination.Pagination) (pr []domain.ProjectResponse, err error)

func (*ProjectUsecase) GetResourcesUsage

func (u *ProjectUsecase) GetResourcesUsage(ctx context.Context, organizationId string, projectId string, namespace string, stackId domain.StackId) (out domain.ProjectNamespaceResourcesUsage, err error)

func (*ProjectUsecase) IsProjectNameExist

func (u *ProjectUsecase) IsProjectNameExist(ctx context.Context, organizationId string, projectName string) (bool, error)

func (*ProjectUsecase) IsProjectNamespaceExist

func (u *ProjectUsecase) IsProjectNamespaceExist(ctx context.Context, organizationId string, projectId string, stackId string, projectNamespace string) (bool, error)

func (*ProjectUsecase) MayRemoveRequiredSetupForCluster

func (u *ProjectUsecase) MayRemoveRequiredSetupForCluster(ctx context.Context, organizationId string, projectId string, stackId string) error

func (*ProjectUsecase) RemoveProjectMember

func (u *ProjectUsecase) RemoveProjectMember(ctx context.Context, organizationId string, projectMemberId string) error

func (*ProjectUsecase) UnassignKeycloakClientRoleToMember

func (u *ProjectUsecase) UnassignKeycloakClientRoleToMember(ctx context.Context, organizationId string, projectId string, clientId string, projectMemberId string) error

func (*ProjectUsecase) UpdateProject

func (u *ProjectUsecase) UpdateProject(ctx context.Context, p *model.Project, newLeaderId string) error

func (*ProjectUsecase) UpdateProjectMemberRole

func (u *ProjectUsecase) UpdateProjectMemberRole(ctx context.Context, pm *model.ProjectMember) error

func (*ProjectUsecase) UpdateProjectNamespace

func (u *ProjectUsecase) UpdateProjectNamespace(ctx context.Context, pn *model.ProjectNamespace) error

type RoleUsecase

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

func NewRoleUsecase

func NewRoleUsecase(repo repository.Repository, kc keycloak.IKeycloak) *RoleUsecase

func (RoleUsecase) CreateTksRole

func (r RoleUsecase) CreateTksRole(ctx context.Context, role *model.Role) (string, error)

func (RoleUsecase) DeleteTksRole

func (r RoleUsecase) DeleteTksRole(ctx context.Context, organizationId string, id string) error

func (RoleUsecase) GetTksRole

func (r RoleUsecase) GetTksRole(ctx context.Context, organizationId string, id string) (*model.Role, error)

func (RoleUsecase) IsRoleNameExisted

func (r RoleUsecase) IsRoleNameExisted(ctx context.Context, organizationId string, roleName string) (bool, error)

func (RoleUsecase) ListTksRoles

func (r RoleUsecase) ListTksRoles(ctx context.Context, organizationId string, pg *pagination.Pagination) ([]*model.Role, error)

func (RoleUsecase) UpdateTksRole

func (r RoleUsecase) UpdateTksRole(ctx context.Context, newRole *model.Role) error

type StackTemplateUsecase

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

func (*StackTemplateUsecase) AddOrganizationStackTemplates

func (u *StackTemplateUsecase) AddOrganizationStackTemplates(ctx context.Context, organizationId string, stackTemplateIds []string) error

func (*StackTemplateUsecase) Create

func (u *StackTemplateUsecase) Create(ctx context.Context, dto model.StackTemplate) (stackTemplateId uuid.UUID, err error)

func (*StackTemplateUsecase) Delete

func (u *StackTemplateUsecase) Delete(ctx context.Context, stackTemplateId uuid.UUID) (err error)

func (*StackTemplateUsecase) Fetch

func (*StackTemplateUsecase) FetchWithOrganization

func (u *StackTemplateUsecase) FetchWithOrganization(ctx context.Context, organizationId string, pg *pagination.Pagination) (res []model.StackTemplate, err error)

func (*StackTemplateUsecase) Get

func (u *StackTemplateUsecase) Get(ctx context.Context, stackTemplateId uuid.UUID) (res model.StackTemplate, err error)

func (*StackTemplateUsecase) GetByName

func (u *StackTemplateUsecase) GetByName(ctx context.Context, name string) (out model.StackTemplate, err error)

func (*StackTemplateUsecase) RemoveOrganizationStackTemplates

func (u *StackTemplateUsecase) RemoveOrganizationStackTemplates(ctx context.Context, organizationId string, stackTemplateIds []string) error

func (*StackTemplateUsecase) Update

func (*StackTemplateUsecase) UpdateOrganizations

func (u *StackTemplateUsecase) UpdateOrganizations(ctx context.Context, dto model.StackTemplate) error

type StackUsecase

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

func (*StackUsecase) Create

func (u *StackUsecase) Create(ctx context.Context, dto model.Stack) (stackId domain.StackId, err error)

func (*StackUsecase) Delete

func (u *StackUsecase) Delete(ctx context.Context, dto model.Stack) (err error)

func (*StackUsecase) DeleteFavorite

func (u *StackUsecase) DeleteFavorite(ctx context.Context, stackId domain.StackId) error

func (*StackUsecase) Fetch

func (u *StackUsecase) Fetch(ctx context.Context, organizationId string, pg *pagination.Pagination) (out []model.Stack, err error)

func (*StackUsecase) Get

func (u *StackUsecase) Get(ctx context.Context, stackId domain.StackId) (out model.Stack, err error)

func (*StackUsecase) GetByName

func (u *StackUsecase) GetByName(ctx context.Context, organizationId string, name string) (out model.Stack, err error)

func (*StackUsecase) GetKubeConfig

func (u *StackUsecase) GetKubeConfig(ctx context.Context, stackId domain.StackId) (kubeConfig string, err error)

func (*StackUsecase) GetStepStatus

func (u *StackUsecase) GetStepStatus(ctx context.Context, stackId domain.StackId) (out []domain.StackStepStatus, stackStatus string, err error)

[TODO] need more pretty...

func (*StackUsecase) Install

func (u *StackUsecase) Install(ctx context.Context, stackId domain.StackId) (err error)

func (*StackUsecase) SetFavorite

func (u *StackUsecase) SetFavorite(ctx context.Context, stackId domain.StackId) error

func (*StackUsecase) Update

func (u *StackUsecase) Update(ctx context.Context, dto model.Stack) (err error)

type SystemNotificationRuleUsecase

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

func (*SystemNotificationRuleUsecase) Create

func (u *SystemNotificationRuleUsecase) Create(ctx context.Context, dto model.SystemNotificationRule) (systemNotificationRuleId uuid.UUID, err error)

func (*SystemNotificationRuleUsecase) Delete

func (u *SystemNotificationRuleUsecase) Delete(ctx context.Context, systemNotificationRuleId uuid.UUID) (out model.SystemNotificationRule, err error)

func (*SystemNotificationRuleUsecase) Fetch

func (*SystemNotificationRuleUsecase) Get

func (u *SystemNotificationRuleUsecase) Get(ctx context.Context, systemNotificationRuleId uuid.UUID) (res model.SystemNotificationRule, err error)

func (*SystemNotificationRuleUsecase) GetByName

func (*SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules

func (u *SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules(ctx context.Context, organizationId string, dto *model.Organization) error

func (*SystemNotificationRuleUsecase) Update

type SystemNotificationTemplateUsecase

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

func (*SystemNotificationTemplateUsecase) AddOrganizationSystemNotificationTemplates

func (u *SystemNotificationTemplateUsecase) AddOrganizationSystemNotificationTemplates(ctx context.Context, organizationId string, systemNotificationTemplateIds []string) error

func (*SystemNotificationTemplateUsecase) Create

func (u *SystemNotificationTemplateUsecase) Create(ctx context.Context, dto model.SystemNotificationTemplate) (systemNotificationTemplate uuid.UUID, err error)

func (*SystemNotificationTemplateUsecase) Delete

func (u *SystemNotificationTemplateUsecase) Delete(ctx context.Context, systemNotificationTemplateId uuid.UUID) (err error)

func (*SystemNotificationTemplateUsecase) Fetch

func (*SystemNotificationTemplateUsecase) FetchWithOrganization

func (u *SystemNotificationTemplateUsecase) FetchWithOrganization(ctx context.Context, organizationId string, pg *pagination.Pagination) (res []model.SystemNotificationTemplate, err error)

func (*SystemNotificationTemplateUsecase) Get

func (u *SystemNotificationTemplateUsecase) Get(ctx context.Context, systemNotificationTemplateId uuid.UUID) (systemNotificationTemplate model.SystemNotificationTemplate, err error)

func (*SystemNotificationTemplateUsecase) GetByName

func (*SystemNotificationTemplateUsecase) RemoveOrganizationSystemNotificationTemplates

func (u *SystemNotificationTemplateUsecase) RemoveOrganizationSystemNotificationTemplates(ctx context.Context, organizationId string, systemNotificationTemplateIds []string) error

func (*SystemNotificationTemplateUsecase) Update

func (*SystemNotificationTemplateUsecase) UpdateOrganizations

type SystemNotificationUsecase

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

func (*SystemNotificationUsecase) Create

func (*SystemNotificationUsecase) CreateSystemNotificationAction

func (u *SystemNotificationUsecase) CreateSystemNotificationAction(ctx context.Context, dto model.SystemNotificationAction) (systemNotificationActionId uuid.UUID, err error)

func (*SystemNotificationUsecase) Delete

func (*SystemNotificationUsecase) FetchPolicyNotifications

func (u *SystemNotificationUsecase) FetchPolicyNotifications(ctx context.Context, organizationId string, pg *pagination.Pagination) (systemNotifications []model.SystemNotification, err error)

func (*SystemNotificationUsecase) FetchSystemNotifications

func (u *SystemNotificationUsecase) FetchSystemNotifications(ctx context.Context, organizationId string, pg *pagination.Pagination) (systemNotifications []model.SystemNotification, err error)

func (*SystemNotificationUsecase) Get

func (u *SystemNotificationUsecase) Get(ctx context.Context, systemNotificationId uuid.UUID) (systemNotification model.SystemNotification, err error)

func (*SystemNotificationUsecase) GetByName

func (u *SystemNotificationUsecase) GetByName(ctx context.Context, organizationId string, name string) (out model.SystemNotification, err error)

func (*SystemNotificationUsecase) Update

type Usecase

type Usecase struct {
	Auth                       IAuthUsecase
	User                       IUserUsecase
	Cluster                    IClusterUsecase
	Organization               IOrganizationUsecase
	AppGroup                   IAppGroupUsecase
	AppServeApp                IAppServeAppUsecase
	CloudAccount               ICloudAccountUsecase
	StackTemplate              IStackTemplateUsecase
	Dashboard                  IDashboardUsecase
	SystemNotification         ISystemNotificationUsecase
	SystemNotificationTemplate ISystemNotificationTemplateUsecase
	SystemNotificationRule     ISystemNotificationRuleUsecase
	Stack                      IStackUsecase
	Project                    IProjectUsecase
	Role                       IRoleUsecase
	Permission                 IPermissionUsecase
	Audit                      IAuditUsecase
	PolicyTemplate             IPolicyTemplateUsecase
	Policy                     IPolicyUsecase
}

type UserUsecase

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

func (*UserUsecase) Create

func (u *UserUsecase) Create(ctx context.Context, user *model.User) (*model.User, error)

func (*UserUsecase) CreateAdmin

func (u *UserUsecase) CreateAdmin(ctx context.Context, user *model.User) (*model.User, error)

func (*UserUsecase) Delete

func (u *UserUsecase) Delete(ctx context.Context, userId uuid.UUID, organizationId string) error

func (*UserUsecase) DeleteAdmin

func (u *UserUsecase) DeleteAdmin(ctx context.Context, organizationId string) error

func (*UserUsecase) DeleteAll

func (u *UserUsecase) DeleteAll(ctx context.Context, organizationId string) error

func (*UserUsecase) DeleteByAccountId

func (u *UserUsecase) DeleteByAccountId(ctx context.Context, accountId string, organizationId string) error

func (*UserUsecase) GenerateRandomPassword

func (u *UserUsecase) GenerateRandomPassword(ctx context.Context) string

func (*UserUsecase) Get

func (u *UserUsecase) Get(ctx context.Context, userId uuid.UUID) (*model.User, error)

func (*UserUsecase) GetByAccountId

func (u *UserUsecase) GetByAccountId(ctx context.Context, accountId string, organizationId string) (*model.User, error)

func (*UserUsecase) GetByEmail

func (u *UserUsecase) GetByEmail(ctx context.Context, email string, organizationId string) (*model.User, error)

func (*UserUsecase) List

func (u *UserUsecase) List(ctx context.Context, organizationId string) (users *[]model.User, err error)

func (*UserUsecase) ListUsersByRole

func (u *UserUsecase) ListUsersByRole(ctx context.Context, organizationId string, roleId string, pg *pagination.Pagination) (*[]model.User, error)

func (*UserUsecase) ListWithPagination

func (u *UserUsecase) ListWithPagination(ctx context.Context, organizationId string, pg *pagination.Pagination) (users *[]model.User, err error)

func (*UserUsecase) RenewalPasswordExpiredTime

func (u *UserUsecase) RenewalPasswordExpiredTime(ctx context.Context, userId uuid.UUID) error

func (*UserUsecase) RenewalPasswordExpiredTimeByAccountId

func (u *UserUsecase) RenewalPasswordExpiredTimeByAccountId(ctx context.Context, accountId string, organizationId string) error

func (*UserUsecase) ResetPassword

func (u *UserUsecase) ResetPassword(ctx context.Context, userId uuid.UUID) error

func (*UserUsecase) ResetPasswordByAccountId

func (u *UserUsecase) ResetPasswordByAccountId(ctx context.Context, accountId string, organizationId string) error

func (*UserUsecase) SendEmailForTemporaryPassword

func (u *UserUsecase) SendEmailForTemporaryPassword(ctx context.Context, accountId string, organizationId string, password string) error

func (*UserUsecase) Update

func (u *UserUsecase) Update(ctx context.Context, user *model.User) (*model.User, error)

func (*UserUsecase) UpdateByAccountId

func (u *UserUsecase) UpdateByAccountId(ctx context.Context, user *model.User) (*model.User, error)

func (*UserUsecase) UpdateByAccountIdByAdmin

func (u *UserUsecase) UpdateByAccountIdByAdmin(ctx context.Context, newUser *model.User) (*model.User, error)

func (*UserUsecase) UpdatePasswordByAccountId

func (u *UserUsecase) UpdatePasswordByAccountId(ctx context.Context, accountId string, originPassword string, newPassword string,
	organizationId string) error

func (*UserUsecase) ValidateAccount

func (u *UserUsecase) ValidateAccount(ctx context.Context, userId uuid.UUID, password string, organizationId string) error

func (*UserUsecase) ValidateAccountByAccountId

func (u *UserUsecase) ValidateAccountByAccountId(ctx context.Context, accountId string, password string, organizationId string) error

Jump to

Keyboard shortcuts

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