ocdp v1
This commit is contained in:
133
backend/internal/adapter/input/http/dto/instance_dto.go
Normal file
133
backend/internal/adapter/input/http/dto/instance_dto.go
Normal file
@ -0,0 +1,133 @@
|
||||
package dto
|
||||
|
||||
// CreateInstanceRequest 创建实例请求
|
||||
type CreateInstanceRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Namespace string `json:"namespace" binding:"required"`
|
||||
RegistryID string `json:"registryId" binding:"required"`
|
||||
RegistryIDAlt string `json:"registry_id"`
|
||||
Repository string `json:"repository" binding:"required"`
|
||||
Tag string `json:"tag" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Values map[string]interface{} `json:"values"`
|
||||
ValuesYAML string `json:"valuesYaml"`
|
||||
}
|
||||
|
||||
// UpdateInstanceRequest 更新实例请求
|
||||
type UpdateInstanceRequest struct {
|
||||
Version string `json:"version"`
|
||||
Description string `json:"description"`
|
||||
Values map[string]interface{} `json:"values"`
|
||||
ValuesYAML string `json:"valuesYaml"`
|
||||
}
|
||||
|
||||
// Normalize 将多种命名风格的字段合并到统一字段
|
||||
func (r *CreateInstanceRequest) Normalize() {
|
||||
if r.RegistryID == "" {
|
||||
r.RegistryID = r.RegistryIDAlt
|
||||
}
|
||||
}
|
||||
|
||||
// RollbackInstanceRequest 回滚实例请求
|
||||
type RollbackInstanceRequest struct {
|
||||
Revision int `json:"revision" binding:"required"`
|
||||
Wait bool `json:"wait"`
|
||||
Timeout int `json:"timeout"` // seconds
|
||||
}
|
||||
|
||||
// DeleteInstanceRequest 删除实例请求
|
||||
type DeleteInstanceRequest struct {
|
||||
KeepHistory bool `json:"keepHistory"`
|
||||
Timeout int `json:"timeout"` // seconds
|
||||
}
|
||||
|
||||
// InstanceResponse 实例响应
|
||||
type InstanceResponse struct {
|
||||
ID string `json:"id"`
|
||||
ClusterID string `json:"clusterId"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
RegistryID string `json:"registryId"`
|
||||
Repository string `json:"repository"`
|
||||
Chart string `json:"chart"`
|
||||
Version string `json:"version"`
|
||||
Description string `json:"description"`
|
||||
Status string `json:"status"`
|
||||
StatusReason string `json:"statusReason,omitempty"`
|
||||
LastOperation string `json:"lastOperation,omitempty"`
|
||||
LastError string `json:"lastError,omitempty"`
|
||||
Revision int `json:"revision"`
|
||||
Values map[string]interface{} `json:"values,omitempty"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// InstanceStatusResponse 实例状态响应
|
||||
type InstanceStatusResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Status string `json:"status"`
|
||||
Revision int `json:"revision"`
|
||||
Chart string `json:"chart"`
|
||||
Version string `json:"version"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// ReleaseHistoryResponse Release 历史响应
|
||||
type ReleaseHistoryResponse struct {
|
||||
Revision int `json:"revision"`
|
||||
Updated string `json:"updated"`
|
||||
Status string `json:"status"`
|
||||
Chart string `json:"chart"`
|
||||
AppVersion string `json:"appVersion"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// InstanceListResponse 实例列表响应
|
||||
type InstanceListResponse struct {
|
||||
Instances []*InstanceResponse `json:"instances"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// InstanceEntryPortResponse Service 端口响应
|
||||
type InstanceEntryPortResponse struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol"`
|
||||
Port int32 `json:"port"`
|
||||
TargetPort string `json:"targetPort,omitempty"`
|
||||
NodePort int32 `json:"nodePort,omitempty"`
|
||||
}
|
||||
|
||||
// InstanceEntryPathResponse Ingress path 响应
|
||||
type InstanceEntryPathResponse struct {
|
||||
Path string `json:"path"`
|
||||
ServiceName string `json:"serviceName,omitempty"`
|
||||
ServicePort string `json:"servicePort,omitempty"`
|
||||
}
|
||||
|
||||
// InstanceEntryHostResponse Ingress host 响应
|
||||
type InstanceEntryHostResponse struct {
|
||||
Host string `json:"host"`
|
||||
Paths []InstanceEntryPathResponse `json:"paths,omitempty"`
|
||||
}
|
||||
|
||||
// InstanceEntryTLSResponse Ingress TLS 响应
|
||||
type InstanceEntryTLSResponse struct {
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
SecretName string `json:"secretName,omitempty"`
|
||||
}
|
||||
|
||||
// InstanceEntryResponse 实例入口响应
|
||||
type InstanceEntryResponse struct {
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ClusterIP string `json:"clusterIP,omitempty"`
|
||||
ExternalIPs []string `json:"externalIPs,omitempty"`
|
||||
LoadBalancerIngress []string `json:"loadBalancerIngress,omitempty"`
|
||||
Ports []InstanceEntryPortResponse `json:"ports,omitempty"`
|
||||
Hosts []InstanceEntryHostResponse `json:"hosts,omitempty"`
|
||||
TLS []InstanceEntryTLSResponse `json:"tls,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user