usecase

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDiscoverer

func WithDiscoverer(d port.ClusterDiscoverer) func(*ClusterUseCase)

WithDiscoverer injects a ClusterDiscoverer so Register/Update/Refresh paths can probe the real cluster for node architectures.

func WithKubeconfigDecryptor

func WithKubeconfigDecryptor(fn func([]byte) ([]byte, error)) func(*ClusterUseCase)

WithKubeconfigDecryptor injects a function that turns the repository's encrypted kubeconfig blob into the raw YAML bytes the discoverer can consume. Kept as an option so the use case doesn't depend on the crypto package directly.

func WithOrgRepo

func WithOrgRepo(r port.OrgRepository) func(*ClusterUseCase)

Types

type ClusterUseCase

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

ClusterUseCase handles Cluster business logic.

func NewClusterUseCase

func NewClusterUseCase(clusterRepo port.ClusterRepository, opts ...func(*ClusterUseCase)) *ClusterUseCase

func (*ClusterUseCase) DeleteCluster

func (uc *ClusterUseCase) DeleteCluster(ctx context.Context, id string) error

DeleteCluster removes a cluster by ID.

func (*ClusterUseCase) GetCluster

func (uc *ClusterUseCase) GetCluster(ctx context.Context, id string) (*domain.Cluster, error)

GetCluster retrieves a cluster by ID.

func (*ClusterUseCase) GetFirstOrgID

func (uc *ClusterUseCase) GetFirstOrgID(ctx context.Context) (string, error)

func (*ClusterUseCase) GetKubeconfig

func (uc *ClusterUseCase) GetKubeconfig(ctx context.Context, id string) ([]byte, error)

func (*ClusterUseCase) ListClusters

func (uc *ClusterUseCase) ListClusters(ctx context.Context, orgID string) ([]*domain.Cluster, error)

ListClusters returns all clusters for the given organization.

func (*ClusterUseCase) OrgNames

func (uc *ClusterUseCase) OrgNames(ctx context.Context, orgIDs []string) (map[string]string, error)

OrgNames 는 조직 ID 를 사람이 읽는 이름으로 바꾼다.

화면이 조직을 UUID 로 보여주면 어느 조직인지 알 수 없다. 이름은 조직 저장소만 알고 있으므로 클러스터 응답을 만들 때 여기서 함께 풀어 준다.

조회에 실패해도 오류를 올리지 않는다 — 이름은 부가 정보이고, 그것 때문에 클러스터 목록 자체가 뜨지 않으면 더 나쁘다. 못 찾은 ID 는 그냥 빠지고 화면이 ID 로 되돌아간다.

func (*ClusterUseCase) RefreshDiscovery

func (uc *ClusterUseCase) RefreshDiscovery(ctx context.Context, id string) (*domain.Cluster, error)

RefreshDiscovery reads the stored kubeconfig, probes the cluster for its server version and node architectures, and persists the result onto the Cluster aggregate.

On discovery failure the cluster is marked connection_failed with an empty NodeArchitectures slice — the Pre-Deploy Gate interprets empty as "arch unknown" and falls back to a warn verdict, prompting the user to refresh.

func (*ClusterUseCase) RegisterCluster

func (uc *ClusterUseCase) RegisterCluster(ctx context.Context, input RegisterClusterInput) (*domain.Cluster, error)

RegisterCluster registers a new cluster with pending connection status.

func (*ClusterUseCase) SaveKubeconfig

func (uc *ClusterUseCase) SaveKubeconfig(ctx context.Context, id string, kubeconfig []byte) error

func (*ClusterUseCase) UpdateCluster

func (uc *ClusterUseCase) UpdateCluster(ctx context.Context, id string, input UpdateClusterInput) (*domain.Cluster, error)

UpdateCluster updates a cluster's mutable fields.

func (*ClusterUseCase) VerifyCluster

func (uc *ClusterUseCase) VerifyCluster(ctx context.Context, id string) (*domain.Cluster, error)

VerifyCluster marks a cluster connection status as connected.

type CreateOrgInput

type CreateOrgInput struct {
	Name   string
	Slug   string
	Domain string
}

CreateOrgInput holds the input for creating an organization.

type OrgUseCase

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

OrgUseCase handles Organization business logic.

func NewOrgUseCase

func NewOrgUseCase(orgRepo port.OrgRepository) *OrgUseCase

NewOrgUseCase creates a new OrgUseCase.

func (*OrgUseCase) CreateOrg

func (uc *OrgUseCase) CreateOrg(ctx context.Context, input CreateOrgInput) (*domain.Organization, error)

CreateOrg creates a new organization after validating the slug.

func (*OrgUseCase) GetFirstOrg

func (uc *OrgUseCase) GetFirstOrg(ctx context.Context) (*domain.Organization, error)

func (*OrgUseCase) GetOrg

func (uc *OrgUseCase) GetOrg(ctx context.Context, id string) (*domain.Organization, error)

GetOrg retrieves an organization by ID.

func (*OrgUseCase) UpdateFirstOrg

func (uc *OrgUseCase) UpdateFirstOrg(ctx context.Context, input UpdateOrgInput) (*domain.Organization, error)

func (*OrgUseCase) UpdateOrg

func (uc *OrgUseCase) UpdateOrg(ctx context.Context, id string, input UpdateOrgInput) (*domain.Organization, error)

UpdateOrg updates an organization's mutable fields.

type RegisterClusterInput

type RegisterClusterInput struct {
	Name          string
	Type          domain.ClusterType
	Types         []domain.ClusterType
	CloudProvider domain.CloudProvider
	Endpoint      string
	OrgID         string
}

RegisterClusterInput holds the input for registering a cluster.

type TokenSourceUseCase

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

func (*TokenSourceUseCase) ApplyAction

func (uc *TokenSourceUseCase) ApplyAction(ctx context.Context, tokenSourceID, action, reason string, details map[string]any) error

func (*TokenSourceUseCase) ListEvents

func (uc *TokenSourceUseCase) ListEvents(ctx context.Context, tokenSourceID string) ([]*domain.TokenRotationEvent, error)

func (*TokenSourceUseCase) ListSources

func (uc *TokenSourceUseCase) ListSources(ctx context.Context, orgID string) ([]*domain.TokenSource, error)

func (*TokenSourceUseCase) RevealMeta

func (uc *TokenSourceUseCase) RevealMeta(ctx context.Context, tokenSourceID string) (map[string]any, error)

type TokenSourceUseCaseOption

type TokenSourceUseCaseOption func(*TokenSourceUseCase)

func WithSecretRouter

func WithSecretRouter(router *secrets.Router) TokenSourceUseCaseOption

type UpdateClusterInput

type UpdateClusterInput struct {
	Name          string
	Type          domain.ClusterType
	Types         []domain.ClusterType
	CloudProvider domain.CloudProvider
	Endpoint      string
}

UpdateClusterInput holds the input for updating a cluster.

type UpdateMemberInput

type UpdateMemberInput struct {
	OrgID string
	Name  *string
	Email *string
	Role  *domain.Role
}

type UpdateOrgInput

type UpdateOrgInput struct {
	Name               string
	Domain             string
	ClusterAccessScope []string
}

UpdateOrgInput holds the input for updating an organization.

type UserUseCase

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

func NewUserUseCase

func NewUserUseCase(userRepo port.UserRepository) *UserUseCase

func (*UserUseCase) DeactivateUser

func (uc *UserUseCase) DeactivateUser(ctx context.Context, userID string) error

func (*UserUseCase) InviteMember

func (uc *UserUseCase) InviteMember(ctx context.Context, orgID, email, name string, role domain.Role) (*domain.User, error)

func (*UserUseCase) ListMembers

func (uc *UserUseCase) ListMembers(ctx context.Context, orgID string) ([]*domain.User, error)

func (*UserUseCase) RemoveMember

func (uc *UserUseCase) RemoveMember(ctx context.Context, userID string) error

func (*UserUseCase) SearchByEmail

func (uc *UserUseCase) SearchByEmail(ctx context.Context, email string) (*domain.User, error)

func (*UserUseCase) UpdateMember

func (uc *UserUseCase) UpdateMember(ctx context.Context, userID string, input UpdateMemberInput) (*domain.User, error)

func (*UserUseCase) UpdateRole

func (uc *UserUseCase) UpdateRole(ctx context.Context, userID string, newRole domain.Role) error

Jump to

Keyboard shortcuts

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