- Instance deployment: charts browser, deploy modal, instances list - Values Template version management (create/history/rollback) - Storage layered config (cluster > workspace > shared priority) - Cluster credential decryptIfNeeded for mixed encrypted/plaintext kubeconfig - YAML syntax validation (client-side + server-side warning) - Frontend: charts, instances, storage, templates, admin pages - Backend: storage service, instance service, cluster service, helm client - Multi-Tenant Kubeconfig.md: added by user
75 lines
2.2 KiB
Go
75 lines
2.2 KiB
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// WorkspaceDTO 工作空间 DTO
|
|
type WorkspaceDTO struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
ClusterIDs []string `json:"cluster_ids,omitempty"`
|
|
Quotas []*QuotaDTO `json:"quotas,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// CreateWorkspaceRequest 创建工作空间请求(包含配额设置)
|
|
type CreateWorkspaceRequest struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Description string `json:"description"`
|
|
ClusterIDs []string `json:"cluster_ids"`
|
|
// Quotas can be set during creation
|
|
CPU *QuotaValue `json:"cpu"`
|
|
GPU *QuotaValue `json:"gpu"`
|
|
GPUMemory *QuotaValue `json:"gpu_memory"`
|
|
}
|
|
|
|
// UpdateWorkspaceRequest 更新工作空间请求
|
|
type UpdateWorkspaceRequest struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
ClusterIDs []string `json:"cluster_ids"`
|
|
}
|
|
|
|
// QuotaDTO 配额 DTO
|
|
type QuotaDTO struct {
|
|
ID string `json:"id"`
|
|
WorkspaceID string `json:"workspace_id"`
|
|
ResourceType string `json:"resource_type"`
|
|
HardLimit float64 `json:"hard_limit"`
|
|
SoftLimit float64 `json:"soft_limit"`
|
|
Used float64 `json:"used"`
|
|
}
|
|
|
|
// SetQuotaRequest 设置配额请求
|
|
type SetQuotaRequest struct {
|
|
ResourceType string `json:"resource_type" validate:"required"`
|
|
HardLimit float64 `json:"hard_limit" validate:"required"`
|
|
SoftLimit float64 `json:"soft_limit"`
|
|
}
|
|
|
|
// SetQuotasRequest 批量设置配额请求
|
|
type SetQuotasRequest struct {
|
|
CPU *QuotaValue `json:"cpu"`
|
|
GPU *QuotaValue `json:"gpu"`
|
|
GPUMemory *QuotaValue `json:"gpu_memory"`
|
|
}
|
|
|
|
// QuotaValue 配额值
|
|
type QuotaValue struct {
|
|
HardLimit float64 `json:"hard_limit"`
|
|
SoftLimit float64 `json:"soft_limit"`
|
|
}
|
|
|
|
// WorkspaceResponse 工作空间响应
|
|
type WorkspaceResponse struct {
|
|
Workspace *WorkspaceDTO `json:"workspace"`
|
|
Quotas []*QuotaDTO `json:"quotas,omitempty"`
|
|
}
|
|
|
|
// WorkspaceListResponse 工作空间列表响应
|
|
type WorkspaceListResponse struct {
|
|
Workspaces []*WorkspaceDTO `json:"workspaces"`
|
|
Total int `json:"total"`
|
|
} |