-
Notifications
You must be signed in to change notification settings - Fork 43
/
application.go
82 lines (74 loc) · 4.31 KB
/
application.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package models
import (
"time"
specV1 "github.com/baetyl/baetyl-go/v2/spec/v1"
)
type ApplicationView struct {
Name string `json:"name,omitempty" binding:"res_name"`
Mode string `json:"mode,omitempty" default:"kube"`
Type string `json:"type,omitempty" default:"container"`
Labels map[string]string `json:"labels,omitempty"`
Namespace string `json:"namespace,omitempty"`
CreationTimestamp time.Time `json:"createTime,omitempty"`
Version string `json:"version,omitempty"`
Selector string `json:"selector,omitempty"`
NodeSelector string `json:"nodeSelector,omitempty"`
InitServices []ServiceView `json:"initServices,omitempty" binding:"dive"`
Services []ServiceView `json:"services,omitempty" binding:"dive"`
Volumes []VolumeView `json:"volumes,omitempty" binding:"dive"`
Description string `json:"description,omitempty"`
System bool `json:"system,omitempty"`
Registries []RegistryView `json:"registries,omitempty"`
CronStatus specV1.CronStatusCode `json:"cronStatus" default:"0"`
CronTime time.Time `json:"cronTime,omitempty"`
HostNetwork bool `json:"hostNetwork,omitempty"` // specifies host network mode of service
Replica int `json:"replica"`
Workload string `json:"workload,omitempty"` // deployment | daemonset | statefulset | job
JobConfig *specV1.AppJobConfig `json:"jobConfig,omitempty"`
Ota specV1.OtaInfo `json:"ota,omitempty"`
AutoScaleCfg *specV1.AutoScaleCfg `json:"autoScaleCfg,omitempty"`
}
// VolumeView volume view
type VolumeView struct {
// specified name of the volume
Name string `json:"name,omitempty" binding:"required,res_name"`
HostPath *specV1.HostPathVolumeSource `json:"hostPath,omitempty"`
Config *specV1.ObjectReference `json:"config,omitempty"`
Secret *specV1.ObjectReference `json:"secret,omitempty"`
EmptyDir *specV1.EmptyDirVolumeSource `json:"emptyDir,omitempty"`
Certificate *specV1.ObjectReference `json:"certificate,omitempty"`
}
type AppItem struct {
Name string `json:"name,omitempty" binding:"omitempty,res_name"`
Mode string `json:"mode,omitempty" default:"kube"`
Type string `json:"type,omitempty" default:"container"`
Labels map[string]string `json:"labels,omitempty"`
Selector string `json:"selector"`
NodeSelector string `json:"nodeSelector"`
Version string `json:"version,omitempty"`
Namespace string `json:"namespace,omitempty"`
CreationTimestamp time.Time `json:"createTime,omitempty"`
Description string `json:"description,omitempty"`
System bool `json:"system,omitempty"`
CronStatus specV1.CronStatusCode `json:"cronStatus,omitempty" default:"0"`
CronTime time.Time `json:"cronTime,omitempty"`
HostNetwork bool `json:"hostNetwork,omitempty" yaml:"hostNetwork,omitempty"` // specifies host network mode of service
Replica int `json:"replica,omitempty" yaml:"replica,omitempty" binding:"required" default:"1"`
Workload string `json:"workload,omitempty" yaml:"workload,omitempty"` // deployment | daemonset | statefulset | job
JobConfig *specV1.AppJobConfig `json:"jobConfig,omitempty" yaml:"jobConfig,omitempty"`
Ota specV1.OtaInfo `json:"ota,omitempty"`
AutoScaleCfg *specV1.AutoScaleCfg `json:"autoScaleCfg,omitempty"`
}
// ApplicationList app List
type ApplicationList struct {
Total int `json:"total"`
*ListOptions `json:",inline"`
Items []AppItem `json:"items"`
}
type ServiceFunction struct {
Functions []specV1.ServiceFunction `json:"functions,omitempty"`
}
type ServiceView struct {
specV1.Service `json:",inline"`
ProgramConfig string `json:"programConfig,omitempty"`
}