- Add Workspace domain (entity, repository, service, handler, DTO) - Add multi-tenant K8s client with tenant binding and quota management - Add K8s diagnostics client (instance diagnostics) - Add authorization middleware (authz package) - Restructure frontend to feature-based architecture (features/) - Add User Management page in configuration - Add AccessDenied page and route guards - Refactor shared components (form inputs, layout, UI) - Update Tailwind config for new design system - Add comprehensive documentation (docs/, tasks/, plans) - Improve cluster service with better kubeconfig handling - Add tests for crypto, config, helm client, tenant binding
96 lines
3.4 KiB
Go
96 lines
3.4 KiB
Go
package dto
|
|
|
|
// CreateClusterRequest 创建集群请求
|
|
type CreateClusterRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Host string `json:"host" binding:"required"`
|
|
CAData string `json:"caData"`
|
|
CADataAlt string `json:"ca_data"`
|
|
CertData string `json:"certData"`
|
|
CertDataAlt string `json:"cert_data"`
|
|
KeyData string `json:"keyData"`
|
|
KeyDataAlt string `json:"key_data"`
|
|
Token string `json:"token"`
|
|
Description string `json:"description"`
|
|
Visibility string `json:"visibility"`
|
|
GlobalShared bool `json:"globalShared"`
|
|
GlobalSharedAlt bool `json:"global_shared"`
|
|
DefaultNamespace string `json:"defaultNamespace"`
|
|
}
|
|
|
|
// UpdateClusterRequest 更新集群请求
|
|
type UpdateClusterRequest struct {
|
|
Name string `json:"name"`
|
|
Host string `json:"host"`
|
|
CAData string `json:"caData"`
|
|
CADataAlt string `json:"ca_data"`
|
|
CertData string `json:"certData"`
|
|
CertDataAlt string `json:"cert_data"`
|
|
KeyData string `json:"keyData"`
|
|
KeyDataAlt string `json:"key_data"`
|
|
Token string `json:"token"`
|
|
Description string `json:"description"`
|
|
Visibility string `json:"visibility"`
|
|
GlobalShared bool `json:"globalShared"`
|
|
GlobalSharedAlt bool `json:"global_shared"`
|
|
DefaultNamespace string `json:"defaultNamespace"`
|
|
}
|
|
|
|
// Normalize 将多种命名风格的字段合并到统一字段
|
|
func (r *CreateClusterRequest) Normalize() {
|
|
if r.CAData == "" {
|
|
r.CAData = r.CADataAlt
|
|
}
|
|
if r.CertData == "" {
|
|
r.CertData = r.CertDataAlt
|
|
}
|
|
if r.KeyData == "" {
|
|
r.KeyData = r.KeyDataAlt
|
|
}
|
|
}
|
|
|
|
// Normalize 将多种命名风格的字段合并到统一字段
|
|
func (r *UpdateClusterRequest) Normalize() {
|
|
if r.CAData == "" {
|
|
r.CAData = r.CADataAlt
|
|
}
|
|
if r.CertData == "" {
|
|
r.CertData = r.CertDataAlt
|
|
}
|
|
if r.KeyData == "" {
|
|
r.KeyData = r.KeyDataAlt
|
|
}
|
|
}
|
|
|
|
// ClusterResponse 集群响应(敏感数据已脱敏)
|
|
type ClusterResponse struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Host string `json:"host"`
|
|
Description string `json:"description"`
|
|
WorkspaceID string `json:"workspaceId"`
|
|
OwnerID string `json:"ownerId"`
|
|
Visibility string `json:"visibility"`
|
|
DefaultNamespace string `json:"defaultNamespace,omitempty"`
|
|
AllowedActions []string `json:"allowedActions,omitempty"`
|
|
// 认证配置状态(不返回实际证书数据,仅返回是否已配置)
|
|
HasCAData bool `json:"hasCaData"`
|
|
HasCertData bool `json:"hasCertData"`
|
|
HasKeyData bool `json:"hasKeyData"`
|
|
HasToken bool `json:"hasToken"`
|
|
// 脱敏数据(仅用于前端显示,实际值为掩码)
|
|
CAData string `json:"caData,omitempty"` // 脱敏显示(••••••••)
|
|
CertData string `json:"certData,omitempty"` // 脱敏显示(••••••••)
|
|
KeyData string `json:"keyData,omitempty"` // 脱敏显示(••••••••)
|
|
Token string `json:"token,omitempty"` // 脱敏显示(••••••••)
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
}
|
|
|
|
// ClusterHealthResponse 集群健康状态响应
|
|
type ClusterHealthResponse struct {
|
|
Healthy bool `json:"healthy"`
|
|
Message string `json:"message,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
}
|