package model
import (
corev1 "k8s.io/api/core/v1"
"net/url"
"time"
"github.com/goodrain/rainbond/util"
dbmodel "github.com/goodrain/rainbond/db/model"
dmodel "github.com/goodrain/rainbond/worker/discover/model"
)
const (
AppTypeRainbond = "rainbond"
AppTypeHelm = "helm"
)
const (
YamlSourceFile = "File"
YamlSourceHelm = "Helm"
)
type ServiceGetCommon struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
}
type ComposerStruct struct {
Body struct {
Lang string `json:"default_runtime" validate:"default_runtime"`
Data struct {
JSON struct {
PlatForm struct {
PHP string `json:"php" validate:"php"`
}
}
Packages []string `json:"packages" validate:"packages"`
Lock struct {
PlatForm struct {
PHP string `json:"php" validate:"php"`
}
}
}
}
}
type CreateServiceStruct struct {
TenantName string `gorm:"column:tenant_name;size:32" json:"tenant_name" validate:"tenant_name"`
Body struct {
TenantID string `gorm:"column:tenant_id;size:32" json:"tenant_id" validate:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" json:"service_id" validate:"service_id"`
Operator string `json:"operator" validate:"operator"`
ServiceLabel string `json:"service_label" validate:"service_label"`
NodeLabel string `json:"node_label" validate:"node_label"`
DependIDs []dbmodel.TenantServiceRelation `json:"depend_ids" validate:"depend_ids"`
VolumesInfo []dbmodel.TenantServiceVolume `json:"volumes_info" validate:"volumes_info"`
EnvsInfo []dbmodel.TenantServiceEnvVar `json:"envs_info" validate:"envs_info"`
PortsInfo []dbmodel.TenantServicesPort `json:"ports_info" validate:"ports_info"`
ServiceKey string `gorm:"column:service_key;size:32" json:"service_key" validate:"service_key"`
ServiceAlias string `gorm:"column:service_alias;size:30" json:"service_alias" validate:"service_alias"`
Comment string `gorm:"column:comment" json:"comment" validate:"comment"`
ServiceVersion string `gorm:"column:service_version;size:32" json:"service_version" validate:"service_version"`
ImageName string `gorm:"column:image_name;size:100" json:"image_name" validate:"image_name"`
ContainerCPU int `gorm:"column:container_cpu;default:500" json:"container_cpu" validate:"container_cpu"`
ContainerMemory int `gorm:"column:container_memory;default:128" json:"container_memory" validate:"container_memory"`
ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd" validate:"container_cmd"`
ContainerEnv string `gorm:"column:container_env;size:255" json:"container_env" validate:"container_env"`
VolumePath string `gorm:"column:volume_path" json:"volume_path" validate:"volume_path"`
VolumeMountPath string `gorm:"column:volume_mount_path" json:"volume_mount_path" validate:"volume_mount_path"`
HostPath string `gorm:"column:host_path" json:"host_path" validate:"host_path"`
ExtendMethod string `gorm:"column:extend_method;default:'stateless';" json:"extend_method" validate:"extend_method"`
Replicas int `gorm:"column:replicas;default:1" json:"replicas" validate:"replicas"`
DeployVersion string `gorm:"column:deploy_version" json:"deploy_version" validate:"deploy_version"`
Category string `gorm:"column:category" json:"category" validate:"category"`
EventID string `gorm:"column:event_id" json:"event_id" validate:"event_id"`
ServiceType string `gorm:"column:service_type" json:"service_type" validate:"service_type"`
Namespace string `gorm:"column:namespace" json:"namespace" validate:"namespace"`
VolumeType string `gorm:"column:volume_type;default:'shared'" json:"volume_type" validate:"volume_type"`
PortType string `gorm:"column:port_type;default:'multi_outer'" json:"port_type" validate:"port_type"`
UpdateTime time.Time `gorm:"column:update_time" json:"update_time" validate:"update_time"`
ServiceOrigin string `gorm:"column:service_origin;default:'assistant'" json:"service_origin" validate:"service_origin"`
CodeFrom string `gorm:"column:code_from" json:"code_from" validate:"code_from"`
}
}
type ServiceSecurityContext struct {
ServiceID string `json:"service_id"`
SeccompProfile struct {
SeccompProfileType string `json:"type"`
LocalhostProfile string `json:"localhostProfile"`
} `json:"seccomp_profile"`
RunAsNonRoot bool `json:"run_as_non_root"`
AllowPrivilegeEscalation bool `json:"allow_privilege_escalation"`
RunAsUser int `json:"run_as_user"`
RunAsGroup int `json:"run_as_group"`
Capabilities struct {
Add []corev1.Capability `json:"add"`
Drop []corev1.Capability `json:"drop"`
} `json:"capabilities"`
ReadOnlyRootFilesystem bool `json:"read_only_root_filesystem"`
}
type UpdateServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd" validate:"container_cmd"`
ImageName string `gorm:"column:image_name;size:100" json:"image_name" validate:"image_name"`
ContainerMemory int `gorm:"column:container_memory;default:128" json:"container_memory" validate:"container_memory"`
}
}
type StartStopStruct struct {
ServiceID string
TenantID string
DeployVersion string
EventID string
TaskType string
}
type LanguageSet struct {
ServiceID string `json:"service_id"`
Language string `json:"language"`
}
type ServiceStruct struct {
TenantID string `json:"tenant_id" validate:"tenant_id"`
ServiceID string `json:"service_id" validate:"service_id"`
ServiceName string `json:"service_name" validate:"service_name"`
ServiceAlias string `json:"service_alias" validate:"service_alias"`
ServiceType string `json:"service_type" validate:"service_type"`
Comment string `json:"comment" validate:"comment"`
ServiceVersion string `json:"service_version" validate:"service_version"`
ImageName string `json:"image_name" validate:"image_name"`
ContainerCPU int `json:"container_cpu" validate:"container_cpu"`
ContainerMemory int `json:"container_memory" validate:"container_memory"`
ContainerGPU int `json:"container_gpu" validate:"container_gpu"`
ContainerCMD string `json:"container_cmd" validate:"container_cmd"`
ContainerEnv string `json:"container_env" validate:"container_env"`
ExtendMethod string `json:"extend_method" validate:"extend_method"`
Replicas int `json:"replicas" validate:"replicas"`
DeployVersion string `json:"deploy_version" validate:"deploy_version"`
Category string `json:"category" validate:"category"`
CurStatus string `json:"cur_status" validate:"cur_status"`
EventID string `json:"event_id" validate:"event_id"`
Namespace string `json:"namespace" validate:"namespace"`
UpdateTime time.Time `json:"update_time" validate:"update_time"`
ServiceOrigin string `json:"service_origin" validate:"service_origin"`
Kind string `json:"kind" validate:"kind|in:internal,third_party"`
EtcdKey string `json:"etcd_key" validate:"etcd_key"`
OSType string `json:"os_type" validate:"os_type|in:windows,linux"`
ServiceLabel string `json:"service_label" validate:"service_label|in:StatelessServiceType,StatefulServiceType"`
NodeLabel string `json:"node_label" validate:"node_label"`
Operator string `json:"operator" validate:"operator"`
RepoURL string `json:"repo_url" validate:"repo_url"`
DependIDs []dbmodel.TenantServiceRelation `json:"depend_ids" validate:"depend_ids"`
VolumesInfo []TenantServiceVolumeStruct `json:"volumes_info" validate:"volumes_info"`
DepVolumesInfo []dbmodel.TenantServiceMountRelation `json:"dep_volumes_info" validate:"dep_volumes_info"`
EnvsInfo []dbmodel.TenantServiceEnvVar `json:"envs_info" validate:"envs_info"`
PortsInfo []dbmodel.TenantServicesPort `json:"ports_info" validate:"ports_info"`
Endpoints *Endpoints `json:"endpoints" validate:"endpoints"`
AppID string `json:"app_id" validate:"required"`
ComponentProbes []ServiceProbe `json:"component_probes" validate:"component_probes"`
ComponentMonitors []AddServiceMonitorRequestStruct `json:"component_monitors" validate:"component_monitors"`
HTTPRules []AddHTTPRuleStruct `json:"http_rules" validate:"http_rules"`
TCPRules []AddTCPRuleStruct `json:"tcp_rules" validate:"tcp_rules"`
K8sComponentName string `json:"k8s_component_name" validate:"k8s_component_name"`
JobStrategy string `json:"job_strategy" validate:"job_strategy"`
}
type Endpoints struct {
Static []string `json:"static" validate:"static"`
Kubernetes *EndpointKubernetes `json:"kubernetes" validate:"kubernetes"`
}
func (e *Endpoints) DbModel(componentID string) *dbmodel.ThirdPartySvcDiscoveryCfg {
return &dbmodel.ThirdPartySvcDiscoveryCfg{
ServiceID: componentID,
Type: string(dbmodel.DiscorveryTypeKubernetes),
Namespace: e.Kubernetes.Namespace,
ServiceName: e.Kubernetes.ServiceName,
}
}
type EndpointKubernetes struct {
Namespace string `json:"namespace"`
ServiceName string `json:"serviceName"`
}
type TenantServiceVolumeStruct struct {
ServiceID string ` json:"service_id"`
Category string `json:"category"`
VolumeType string `json:"volume_type"`
VolumeName string `json:"volume_name"`
HostPath string `json:"host_path"`
VolumePath string `json:"volume_path"`
IsReadOnly bool `json:"is_read_only"`
FileContent string `json:"file_content"`
VolumeCapacity int64 `json:"volume_capacity"`
AccessMode string `json:"access_mode"`
SharePolicy string `json:"share_policy"`
BackupPolicy string `json:"backup_policy"`
ReclaimPolicy string `json:"reclaim_policy"`
AllowExpansion bool `json:"allow_expansion"`
VolumeProviderName string `json:"volume_provider_name"`
Mode *int32 `json:"mode"`
NFSServer string `json:"nfs_server"`
NFSPath string `json:"nfs_path"`
}
type DependService struct {
TenantID string `json:"tenant_id"`
ServiceID string `json:"service_id"`
Namespace string `json:"namespace"`
DepSAName string `json:"dep_sa_name"`
DepServiceID string `json:"dep_service_id"`
DepServiceType string `json:"dep_service_type"`
Action string `json:"action"`
}
type Attr struct {
Action string `json:"action"`
TenantID string `json:"tenant_id"`
ServiceID string `json:"service_id"`
AttrName string `json:"env_name"`
AttrValue string `json:"env_value"`
}
type DeleteServicePort struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Port int `json:"port"`
}
type AddHandleResource struct {
Namespace string `json:"namespace"`
AppID string `json:"app_id"`
ResourceYaml string `json:"resource_yaml"`
Recover bool `json:"recover"`
}
type HandleResource struct {
Name string `json:"name"`
AppID string `json:"app_id"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
ResourceYaml string `json:"resource_yaml"`
State int `json:"state"`
}
type SyncResources struct {
AppID string `json:"app_id"`
K8sResources []HandleResource `json:"k8s_resources"`
}
type YamlResource struct {
EventID string `json:"event_id"`
AppID string `json:"region_app_id"`
TenantID string `json:"tenant_id"`
Namespace string `json:"namespace"`
Yaml string `json:"yaml"`
}
type HelmAppInstall struct {
Name string `json:"name"`
Chart string `json:"chart"`
Version string `json:"version"`
Overrides []string `json:"overrides"`
AppID string `json:"app_id"`
TenantID string `json:"tenant_id"`
Namespace string `json:"namespace"`
}
type CommandHelmStruct struct {
Command string `json:"command"`
}
type CheckHelmApp struct {
Name string `json:"name"`
Chart string `json:"chart"`
Version string `json:"version"`
Namespace string `json:"namespace"`
Overrides []string `json:"overrides"`
RepoName string `json:"repo_name"`
RepoURL string `json:"repo_url"`
Username string `json:"username"`
Password string `json:"password"`
}
type ChartInformation struct {
RepoURL string `json:"repo_url"`
ChartName string `json:"chart_name"`
Username string `json:"username"`
Password string `json:"password"`
}
type GetYamlByChart struct {
EventID string `json:"event_id"`
Name string `json:"name"`
FileName string `json:"file_name"`
Version string `json:"version"`
Namespace string `json:"namespace"`
}
const (
CreateSuccess = 1
UpdateSuccess = 2
CreateError = 3
UpdateError = 4
GetError = 5
)
type JobStrategy struct {
Schedule string `json:"schedule"`
BackoffLimit string `json:"backoff_limit"`
Parallelism string `json:"parallelism"`
ActiveDeadlineSeconds string `json:"active_deadline_seconds"`
Completions string `json:"completions"`
}
type TenantResources struct {
Body struct {
TenantNames []string `json:"tenant_name" validate:"tenant_name"`
}
}
type ServicesResources struct {
Body struct {
ServiceIDs []string `json:"service_ids" validate:"service_ids"`
}
}
type CommandResponse struct {
Body struct {
ValidationError url.Values `json:"validation_error,omitempty"`
Msg string `json:"msg,omitempty"`
Bean interface{} `json:"bean,omitempty"`
List interface{} `json:"list,omitempty"`
ListAllNumber int `json:"number,omitempty"`
Page int `json:"page,omitempty"`
}
}
type ServicePortInnerOrOuter struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Port int `json:"port"`
Body struct {
Operation string `json:"operation" validate:"operation|required|in:open,close"`
IfCreateExPort bool `json:"if_create_ex_port"`
}
}
type ServiceLBPortChange struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Port int `json:"port"`
Body struct {
ChangePort int `json:"change_port" validate:"change_port|required"`
}
}
type RollbackStruct struct {
TenantID string `json:"tenant_id"`
ServiceID string `json:"service_id"`
EventID string `json:"event_id;default:system"`
Operator string `json:"operator"`
DeployVersion string `json:"deploy_version"`
}
type StatusList struct {
TenantID string `json:"tenant_id"`
ServiceID string `json:"service_id"`
ServiceAlias string `json:"service_alias"`
DeployVersion string `json:"deploy_version"`
Replicas int `json:"replicas"`
ContainerMem int `json:"container_memory"`
CurStatus string `json:"cur_status"`
ContainerCPU int `json:"container_cpu"`
StatusCN string `json:"status_cn"`
StartTime string `json:"start_time"`
PodList []PodsList `json:"pod_list"`
}
type PodsList struct {
PodIP string `json:"pod_ip"`
Phase string `json:"phase"`
PodName string `json:"pod_name"`
NodeName string `json:"node_name"`
}
type StatsInfo struct {
UUID string `json:"uuid"`
CPU int `json:"cpu"`
MEM int `json:"memory"`
}
type TotalStatsInfo struct {
Data []*StatsInfo `json:"data"`
}
type LicenseInfo struct {
Code string `json:"code"`
Company string `json:"company"`
Node int `json:"node"`
CPU int `json:"cpu"`
MEM int `json:"memory"`
Tenant int `json:"tenant"`
EndTime string `json:"end_time"`
StartTime string `json:"start_time"`
DataCenter int `json:"data_center"`
ModuleList []string `json:"module_list"`
}
type AddTenantStruct struct {
Body struct {
TenantID string `json:"tenant_id" validate:"tenant_id"`
TenantName string `json:"tenant_name" validate:"tenant_name"`
Eid string `json:"eid" validata:"eid"`
Token string `json:"token" validate:"token"`
LimitMemory int `json:"limit_memory" validate:"limit_memory"`
Namespace string `json:"namespace" validate:"namespace"`
BindExistingNamespace bool `json:"bind_existing_namespace"`
}
}
type UpdateTenantStruct struct {
Body struct {
LimitMemory int `json:"limit_memory" validate:"limit_memory"`
}
}
type ServicesInfoStruct struct {
TenantName string `json:"tenant_name"`
}
type SetLanguageStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
Language string `json:"language"`
}
}
type StartServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
}
}
type VerticalServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
ContainerCPU int `json:"container_cpu"`
ContainerMemory int `json:"container_memory"`
}
}
type HorizontalServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
NodeNUM int `json:"node_num"`
}
}
type BuildServiceStruct struct {
TenantName string `json:"tenant_name" validate:"tenant_name"`
ServiceAlias string `json:"service_alias" validate:"service_alias"`
Body struct {
EventID string `json:"event_id" validate:"event_id"`
ENVS map[string]string `json:"envs" validate:"envs"`
Kind string `json:"kind" validate:"kind|required"`
Action string `json:"action" validate:"action"`
ImageURL string `json:"image_url" validate:"image_url"`
DeployVersion string `json:"deploy_version" validate:"deploy_version|required"`
RepoURL string `json:"repo_url" validate:"repo_url"`
Branch string `json:"branch" validate:"branch"`
Lang string `json:"lang" validate:"lang"`
ServerType string `json:"server_type" validate:"server_type"`
Runtime string `json:"runtime" validate:"runtime"`
ServiceType string `json:"service_type" validate:"service_type"`
User string `json:"user" validate:"user"`
Password string `json:"password" validate:"password"`
Operator string `json:"operator" validate:"operator"`
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Cmd string `json:"cmd"`
SlugInfo struct {
SlugPath string `json:"slug_path"`
FTPHost string `json:"ftp_host"`
FTPPort string `json:"ftp_port"`
FTPUser string `json:"ftp_username"`
FTPPassword string `json:"ftp_password"`
} `json:"slug_info"`
}
}
type V1BuildServiceStruct struct {
ServiceID string `json:"service_id" validate:"service_id"`
Body struct {
ServiceID string `json:"service_id" validate:"service_id"`
EventID string `json:"event_id" validate:"event_id"`
ENVS string `json:"envs" validate:"envs"`
Kind string `json:"kind" validate:"kind"`
Action string `json:"action" validate:"action"`
ImageURL string `json:"image_url" validate:"image_url"`
DeployVersion string `json:"deploy_version" validate:"deploy_version|required"`
RepoURL string `json:"repo_url" validate:"repo_url"`
GitURL string `json:"gitUrl" validate:"gitUrl"`
Operator string `json:"operator" validate:"operator"`
}
}
type UpgradeServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
DeployVersion int `json:"deploy_version"`
Operator int `json:"operator"`
}
}
type StatusServiceStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
}
type StatusServiceListStruct struct {
TenantName string `json:"tenant_name"`
Body struct {
ServiceIDs []string `json:"service_ids" validate:"service_ids|required"`
}
}
type AddServiceLabelStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
LabelValues string `json:"label_values"`
}
}
type AddNodeLabelStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
LabelValues []string `json:"label_values" validate:"label_values|required"`
}
}
type LabelsStruct struct {
Labels []LabelStruct `json:"labels"`
}
type LabelStruct struct {
LabelKey string `json:"label_key" validate:"label_key|required"`
LabelValue string `json:"label_value" validate:"label_value|required"`
}
type GetSingleServiceInfoStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
}
type CheckCodeStruct struct {
TenantName string `json:"tenant_name"`
Body struct {
GitURL string `json:"git_url" validate:"git_url|required"`
URLRepos string `json:"url_repos" validate:"url_repos|required"`
CheckType string `json:"check_type" validate:"check_type|required"`
CodeVersion string `json:"code_version" validate:"code_version|required"`
GitProjectID int `json:"git_project_id" validate:"git_project_id|required"`
CodeFrom string `json:"code_from" validate:"code_from|required"`
TenantID string `json:"tenant_id" validate:"tenant_id"`
Action string `json:"action"`
ServiceID string `json:"service_id"`
}
}
type ServiceCheckStruct struct {
TenantName string `json:"tenant_name"`
Body struct {
CheckUUID string `json:"uuid"`
SourceType string `json:"source_type" validate:"source_type|required|in:docker-run,vm-run,docker-compose,sourcecode,third-party-service,package_build"`
CheckOS string `json:"check_os"`
SourceBody string `json:"source_body"`
Namespace string `json:"namespace"`
TenantID string
Username string `json:"username"`
Password string `json:"password"`
EventID string `json:"event_id"`
ComposeFilePath string `json:"compose_file_path"`
}
}
type GetServiceCheckInfoStruct struct {
TenantName string `json:"tenant_name"`
UUID string `json:"uuid"`
}
type PublicShare struct {
ServiceKey string `json:"service_key" validate:"service_key"`
APPVersion string `json:"app_version" validate:"app_version"`
IsOuter bool `json:"is_outer" validate:"is_outer"`
Action string `json:"action" validate:"action"`
ShareID string `json:"share_id" validate:"share_id"`
EventID string `json:"event_id" validate:"event_id"`
Dest string `json:"dest" validate:"dest|in:yb,ys"`
ServiceID string `json:"service_id" validate:"service_id"`
ShareConf ShareConfItems `json:"share_conf" validate:"share_conf"`
}
type SlugShare struct {
PublicShare
ServiceKey string `json:"service_key" validate:"service_key"`
APPVersion string `json:"app_version" validate:"app_version"`
DeployVersion string `json:"deploy_version" validate:"deploy_version"`
TenantID string `json:"tenant_id" validate:"tenant_id"`
Dest string `json:"dest" validate:"dest|in:yb,ys"`
}
type ImageShare struct {
PublicShare
Image string `json:"image" validate:"image"`
}
type ShareConfItems struct {
FTPHost string `json:"ftp_host" validate:"ftp_host"`
FTPPort int `json:"ftp_port" validate:"ftp_port"`
FTPUserName string `json:"ftp_username" valiate:"ftp_username"`
FTPPassWord string `json:"ftp_password" validate:"ftp_password"`
FTPNamespace string `json:"ftp_namespace" validate:"ftp_namespace"`
OuterRegistry string `json:"outer_registry" validate:"outer_registry"`
}
type AddDependencyStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
DepServiceID string `json:"dep_service_id"`
DepServiceType string `json:"dep_service_type"`
DepOrder string `json:"dep_order"`
}
}
type AddEnvStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ContainerPort int `json:"container_port"`
Name string `json:"name"`
AttrName string `json:"env_name"`
AttrValue string `json:"env_value"`
IsChange bool `json:"is_change"`
Scope string `json:"scope"`
}
}
type RollBackStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
EventID string `json:"event_id"`
DeployVersion string `json:"deploy_version"`
Operator string `json:"operator"`
}
}
type AddProbeStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ProbeID string `json:"probe_id"`
Mode string `json:"mode"`
Scheme string `json:"scheme"`
Path string `json:"path"`
Port int `json:"port"`
Cmd string `json:"cmd"`
HTTPHeader string `json:"http_header"`
InitialDelaySecond int `json:"initial_delay_second"`
PeriodSecond int `json:"period_second"`
TimeoutSecond int `json:"timeout_second"`
IsUsed int `json:"is_used"`
FailureThreshold int `json:"failure_threshold"`
SuccessThreshold int `json:"success_threshold"`
}
}
type DeleteProbeStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ProbeID string `json:"probe_id"`
}
}
type PodsStructStruct struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
}
type Login struct {
Body struct {
HostPort string `json:"hostport"`
LoginType bool `json:"type"`
HostType string `json:"hosttype"`
RootPwd string `json:"pwd,omitempty"`
}
}
type Labels struct {
NodeID string `json:"node"`
Body struct {
Labels []string `json:"labels"`
}
}
type Model struct {
ID uint
}
type AddTenantServiceEnvVar struct {
Model
TenantID string `validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `validate:"service_id|between:30,33" json:"service_id"`
ContainerPort int `validate:"container_port|numeric_between:1,65535" json:"container_port"`
Name string `validate:"name" json:"name"`
AttrName string `validate:"env_name|required" json:"env_name"`
OldAttrName string `validate:"old_env_name" json:"old_env_name"`
AttrValue string `validate:"env_value" json:"env_value"`
IsChange bool `validate:"is_change|bool" json:"is_change"`
Scope string `validate:"scope|in:outer,inner,both,build" json:"scope"`
}
func (a *AddTenantServiceEnvVar) DbModel(tenantID, componentID string) *dbmodel.TenantServiceEnvVar {
return &dbmodel.TenantServiceEnvVar{
TenantID: tenantID,
ServiceID: componentID,
Name: a.Name,
AttrName: a.AttrName,
AttrValue: a.AttrValue,
ContainerPort: a.ContainerPort,
IsChange: true,
Scope: a.Scope,
}
}
type DelTenantServiceEnvVar struct {
Model
TenantID string `validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `validate:"service_id|between:30,33" json:"service_id"`
ContainerPort int `validate:"container_port|numeric_between:1,65535" json:"container_port"`
Name string `validate:"name" json:"name"`
AttrName string `validate:"env_name|required" json:"env_name"`
AttrValue string `validate:"env_value" json:"env_value"`
IsChange bool `validate:"is_change|bool" json:"is_change"`
Scope string `validate:"scope|in:outer,inner,both,build" json:"scope"`
}
type ServicePorts struct {
Port []*TenantServicesPort
}
type TenantServicesPort struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" validate:"service_id|between:30,33" json:"service_id"`
ContainerPort int `gorm:"column:container_port" validate:"container_port|required|numeric_between:1,65535" json:"container_port"`
MappingPort int `gorm:"column:mapping_port" validate:"mapping_port|required|numeric_between:1,65535" json:"mapping_port"`
Protocol string `gorm:"column:protocol" validate:"protocol|required|in:http,https,stream,grpc" json:"protocol"`
PortAlias string `gorm:"column:port_alias" validate:"port_alias|required|alpha_dash" json:"port_alias"`
K8sServiceName string `gorm:"column:k8s_service_name" json:"k8s_service_name"`
IsInnerService bool `gorm:"column:is_inner_service" validate:"is_inner_service|bool" json:"is_inner_service"`
IsOuterService bool `gorm:"column:is_outer_service" validate:"is_outer_service|bool" json:"is_outer_service"`
Name string
}
func (p *TenantServicesPort) DbModel(tenantID, componentID string) *dbmodel.TenantServicesPort {
isInnerService := p.IsInnerService
isOuterService := p.IsOuterService
return &dbmodel.TenantServicesPort{
TenantID: tenantID,
ServiceID: componentID,
ContainerPort: p.ContainerPort,
MappingPort: p.MappingPort,
Protocol: p.Protocol,
PortAlias: p.PortAlias,
IsInnerService: &isInnerService,
IsOuterService: &isOuterService,
K8sServiceName: p.K8sServiceName,
Name: p.Name,
}
}
type AddServicePort struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ServicePorts
}
}
type HelmChartInformation struct {
Name string `json:"name"`
Version string
Keywords []string
Pic string
Abstract string
}
type HelmCommandRet struct {
Yaml string `json:"yaml"`
Status bool `json:"status"`
}
type plugin struct {
ContainerPort int32 `json:"container_port"`
MappingPort int32 `json:"mapping_port"`
Protocol string `json:"protocol"`
PortAlias string `json:"port_alias"`
Inner bool `json:"is_inner_service"`
Outer bool `json:"is_outer_service"`
}
type ServiceProbe struct {
Model
ServiceID string `gorm:"column:service_id;size:32" json:"service_id" validate:"service_id|between:30,33"`
ProbeID string `gorm:"column:probe_id;size:32" json:"probe_id" validate:"probe_id|required|between:30,33"`
Mode string `gorm:"column:mode;default:'liveness'" json:"mode" validate:"mode"`
Scheme string `gorm:"column:scheme;default:'scheme'" json:"scheme" validate:"scheme"`
Path string `gorm:"column:path" json:"path" validate:"path"`
Port int `gorm:"column:port;size:5;default:80" json:"port" validate:"port|numeric_between:1,65535"`
Cmd string `gorm:"column:cmd;size:150" json:"cmd" validate:"cmd"`
HTTPHeader string `gorm:"column:http_header;size:300" json:"http_header" validate:"http_header"`
InitialDelaySecond int `gorm:"column:initial_delay_second;size:2;default:1" json:"initial_delay_second" validate:"initial_delay_second"`
PeriodSecond int `gorm:"column:period_second;size:2;default:3" json:"period_second" validate:"period_second"`
TimeoutSecond int `gorm:"column:timeout_second;size:3;default:30" json:"timeout_second" validate:"timeout_second"`
IsUsed int `gorm:"column:is_used;size:1;default:0" json:"is_used" validate:"is_used|in:0,1"`
FailureThreshold int `gorm:"column:failure_threshold;size:2;default:3" json:"failure_threshold" validate:"failure_threshold"`
SuccessThreshold int `gorm:"column:success_threshold;size:2;default:1" json:"success_threshold" validate:"success_threshold"`
FailureAction string `json:"failure_action" validate:"failure_action"`
}
func (p *ServiceProbe) DbModel(componentID string) *dbmodel.TenantServiceProbe {
return &dbmodel.TenantServiceProbe{
ServiceID: componentID,
Cmd: p.Cmd,
FailureThreshold: p.FailureThreshold,
HTTPHeader: p.HTTPHeader,
InitialDelaySecond: p.InitialDelaySecond,
IsUsed: &p.IsUsed,
Mode: p.Mode,
Path: p.Path,
PeriodSecond: p.PeriodSecond,
Port: p.Port,
ProbeID: p.ProbeID,
Scheme: p.Scheme,
SuccessThreshold: p.SuccessThreshold,
TimeoutSecond: p.TimeoutSecond,
FailureAction: p.FailureAction,
}
}
type TenantServiceVolume struct {
Model
ServiceID string `gorm:"column:service_id;size:32" json:"service_id" validate:"service_id"`
Category string `gorm:"column:category;size:50" json:"category" validate:"category|required"`
HostPath string `gorm:"column:host_path" json:"host_path" validate:"host_path|required"`
VolumePath string `gorm:"column:volume_path" json:"volume_path" validate:"volume_path|required"`
IsReadOnly bool `gorm:"column:is_read_only;default:false" json:"is_read_only" validate:"is_read_only|bool"`
}
type GetSupportProtocols struct {
TenantName string `json:"tenant_name"`
}
type ServiceShare struct {
TenantName string `json:"tenant_name"`
ServiceAlias string `json:"service_alias"`
Body struct {
ServiceKey string `json:"service_key" validate:"service_key|required"`
AppVersion string `json:"app_version" validate:"app_version|required"`
DeployVersion string `json:"deploy_version,omitempty"`
EventID string `json:"event_id"`
ShareUser string `json:"share_user"`
ShareScope string `json:"share_scope"`
ImageInfo struct {
HubURL string `json:"hub_url"`
HubUser string `json:"hub_user"`
HubPassword string `json:"hub_password"`
Namespace string `json:"namespace"`
IsTrust bool `json:"is_trust,omitempty" validate:"is_trust"`
} `json:"image_info,omitempty"`
SlugInfo struct {
Namespace string `json:"namespace"`
FTPHost string `json:"ftp_host"`
FTPPort string `json:"ftp_port"`
FTPUser string `json:"ftp_username"`
FTPPassword string `json:"ftp_password"`
} `json:"slug_info,omitempty"`
}
}
type ExportAppStruct struct {
SourceDir string `json:"source_dir"`
Body struct {
EventID string `json:"event_id"`
GroupKey string `json:"group_key"`
Version string `json:"version"`
Format string `json:"format"`
GroupMetadata string `json:"group_metadata"`
}
}
type BatchOperationReq struct {
TenantName string `json:"tenant_name"`
Body struct {
Operation string `json:"operation" validate:"operation|required|in:start,stop,build,upgrade,export"`
Operator string `json:"operator"`
Builds []*ComponentBuildReq `json:"build_infos,omitempty"`
Starts []*ComponentStartReq `json:"start_infos,omitempty"`
Stops []*ComponentStopReq `json:"stop_infos,omitempty"`
Upgrades []*ComponentUpgradeReq `json:"upgrade_infos,omitempty"`
HelmChart *HelmChart `json:"helm_chart,omitempty"`
}
}
type BuildImageInfo struct {
ImageURL string `json:"image_url" validate:"image_url"`
User string `json:"user" validate:"user"`
Password string `json:"password" validate:"password"`
Cmd string `json:"cmd"`
VMImageSource string `json:"vm_image_source"`
}
type BuildCodeInfo struct {
RepoURL string `json:"repo_url" validate:"repo_url"`
Branch string `json:"branch" validate:"branch"`
Lang string `json:"lang" validate:"lang"`
ServerType string `json:"server_type" validate:"server_type"`
Runtime string `json:"runtime"`
User string `json:"user" validate:"user"`
Password string `json:"password" validate:"password"`
Cmd string `json:"cmd"`
DockerfilePath string `json:"dockerfile_path"`
BuildType string `json:"build_type"`
BuildStrategy string `json:"build_strategy"`
CNBVersionPolicy map[string]interface{} `json:"cnb_version_policy"`
}
type BuildSlugInfo struct {
SlugPath string `json:"slug_path"`
FTPHost string `json:"ftp_host"`
FTPPort string `json:"ftp_port"`
FTPUser string `json:"ftp_username"`
FTPPassword string `json:"ftp_password"`
}
var FromImageBuildKing = "build_from_image"
var FromVMBuildKing = "build_from_vm"
var FromCodeBuildKing = "build_from_source_code"
var FromMarketImageBuildKing = "build_from_market_image"
var ExportHelmChart = "export_helm_chart"
var FromMarketSlugBuildKing = "build_from_market_slug"
var FromKubeBlocksBuildKind = "kubeblocks"
type HelmChart struct {
AppName string `json:"app_name"`
AppVersion string `json:"app_version"`
}
type ComponentBuildReq struct {
ComponentOpGeneralReq
BuildENVs map[string]string `json:"envs" validate:"envs"`
Kind string `json:"kind" validate:"kind|required"`
Arch string `json:"arch" validate:"arch|required"`
Action string `json:"action" validate:"action"`
PlanVersion string `json:"plan_version"`
DeployVersion string `json:"deploy_version" validate:"deploy_version"`
Operator string `json:"operator" validate:"operator"`
ImageInfo BuildImageInfo `json:"image_info,omitempty"`
CodeInfo BuildCodeInfo `json:"code_info,omitempty"`
SlugInfo BuildSlugInfo `json:"slug_info,omitempty"`
TenantName string `json:"-"`
InRolling bool `json:"in_rolling"`
}
func (b *ComponentBuildReq) GetEventID() string {
if b.EventID == "" {
b.EventID = util.NewUUID()
}
return b.EventID
}
func (b *ComponentBuildReq) BatchOpFailureItem() *ComponentOpResult {
return &ComponentOpResult{
ServiceID: b.ServiceID,
EventID: b.EventID,
Operation: "build",
Status: BatchOpResultItemStatusFailure,
}
}
func (b *ComponentBuildReq) GetVersion() string {
return b.DeployVersion
}
func (b *ComponentBuildReq) SetVersion(string) {
return
}
func (b *ComponentBuildReq) SetInRolling(bool) {
return
}
func (b *ComponentBuildReq) OpType() string {
return "build-service"
}
func (b *ComponentBuildReq) GetComponentID() string {
return b.ServiceID
}
func (b *ComponentBuildReq) TaskBody(cpt *dbmodel.TenantServices) interface{} {
return nil
}
type UpdateBuildVersionReq struct {
PlanVersion string `json:"plan_version" validate:"required"`
}
type ComponentUpgradeReq struct {
ComponentOpGeneralReq
UpgradeVersion string `json:"upgrade_version"`
InRolling bool `json:"in_rolling"`
}
func (u *ComponentUpgradeReq) GetEventID() string {
if u.EventID == "" {
u.EventID = util.NewUUID()
}
return u.EventID
}
func (u *ComponentUpgradeReq) BatchOpFailureItem() *ComponentOpResult {
return &ComponentOpResult{
ServiceID: u.ServiceID,
EventID: u.GetEventID(),
Operation: "upgrade",
Status: BatchOpResultItemStatusFailure,
}
}
func (u *ComponentUpgradeReq) GetVersion() string {
return u.UpgradeVersion
}
func (u *ComponentUpgradeReq) SetVersion(version string) {
if u.UpgradeVersion == "" {
u.UpgradeVersion = version
}
}
func (u *ComponentUpgradeReq) SetInRolling(inRolling bool) {
u.InRolling = inRolling
}
func (u *ComponentUpgradeReq) GetComponentID() string {
return u.ServiceID
}
func (u *ComponentUpgradeReq) TaskBody(cpt *dbmodel.TenantServices) interface{} {
return &dmodel.RollingUpgradeTaskBody{
TenantID: cpt.TenantID,
ServiceID: cpt.ServiceID,
NewDeployVersion: u.UpgradeVersion,
EventID: u.GetEventID(),
Configs: u.Configs,
InRolling: u.InRolling,
}
}
func (u *ComponentUpgradeReq) OpType() string {
return "upgrade-service"
}
type RollbackInfoRequestStruct struct {
RollBackVersion string `json:"upgrade_version"`
EventID string `json:"event_id"`
ServiceID string `json:"service_id"`
Configs map[string]string `json:"configs"`
}
func BuildMQBodyFrom(app *ExportAppStruct) *MQBody {
return &MQBody{
EventID: app.Body.EventID,
GroupKey: app.Body.GroupKey,
Version: app.Body.Version,
Format: app.Body.Format,
SourceDir: app.SourceDir,
}
}
type MQBody struct {
EventID string `json:"event_id"`
GroupKey string `json:"group_key"`
Version string `json:"version"`
Format string `json:"format"`
SourceDir string `json:"source_dir"`
}
func NewAppStatusFromExport(app *ExportAppStruct) *dbmodel.AppStatus {
return &dbmodel.AppStatus{
Format: app.Body.Format,
EventID: app.Body.EventID,
SourceDir: app.SourceDir,
Status: "exporting",
}
}
type ImportAppStruct struct {
EventID string `json:"event_id"`
SourceDir string `json:"source_dir"`
Apps []string `json:"apps"`
Format string `json:"format"`
ServiceImage ServiceImage `json:"service_image"`
ServiceSlug ServiceSlug `json:"service_slug"`
}
type ServiceImage struct {
HubURL string `json:"hub_url"`
HubUser string `json:"hub_user"`
HubPassword string `json:"hub_password"`
NameSpace string `json:"namespace"`
}
type ServiceSlug struct {
FtpHost string `json:"ftp_host"`
FtpPort string `json:"ftp_port"`
FtpUsername string `json:"ftp_username"`
FtpPassword string `json:"ftp_password"`
NameSpace string `json:"namespace"`
}
func NewAppStatusFromImport(app *ImportAppStruct) *dbmodel.AppStatus {
var apps string
for _, app := range app.Apps {
app += ":pending"
if apps == "" {
apps += app
} else {
apps += "," + app
}
}
return &dbmodel.AppStatus{
EventID: app.EventID,
Format: app.Format,
SourceDir: app.SourceDir,
Apps: apps,
Status: "importing",
}
}
type Application struct {
EID string `json:"eid" validate:"required"`
AppName string `json:"app_name" validate:"required"`
AppType string `json:"app_type" validate:"required,oneof=rainbond helm"`
ConsoleAppID int64 `json:"console_app_id"`
AppID string `json:"app_id"`
TenantID string `json:"tenant_id"`
ServiceIDs []string `json:"service_ids"`
AppStoreName string `json:"app_store_name"`
AppStoreURL string `json:"app_store_url"`
AppTemplateName string `json:"app_template_name"`
Version string `json:"version"`
K8sApp string `json:"k8s_app" validate:"required"`
}
type CreateAppRequest struct {
AppsInfo []Application `json:"apps_info"`
}
type CreateAppResponse struct {
AppID int64 `json:"app_id"`
RegionAppID string `json:"region_app_id"`
}
type ListAppResponse struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
Total int64 `json:"total"`
Apps []*dbmodel.Application `json:"apps"`
}
type ListServiceResponse struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
Total int64 `json:"total"`
Services []*dbmodel.TenantServices `json:"services"`
}
type UpdateAppRequest struct {
AppName string `json:"app_name"`
GovernanceMode string `json:"governance_mode"`
Overrides []string `json:"overrides"`
Version string `json:"version"`
Revision int `json:"revision"`
K8sApp string `json:"k8s_app"`
}
func (u *UpdateAppRequest) NeedUpdateHelmApp() bool {
return len(u.Overrides) > 0 || u.Version != "" || u.Revision != 0
}
type BindServiceRequest struct {
ServiceIDs []string `json:"service_ids"`
}
type InstallAppReq struct {
Overrides []string `json:"overrides"`
}
type ParseAppServicesReq struct {
Values string `json:"values"`
}
type ConfigGroupService struct {
ServiceID string `json:"service_id"`
ServiceAlias string `json:"service_alias"`
}
func (c ConfigGroupService) DbModel(appID, configGroupName string) *dbmodel.ConfigGroupService {
return &dbmodel.ConfigGroupService{
AppID: appID,
ConfigGroupName: configGroupName,
ServiceID: c.ServiceID,
ServiceAlias: c.ServiceAlias,
}
}
type ConfigItem struct {
AppID string `json:"-"`
ConfigGroupName string `json:"-"`
ItemKey string `json:"item_key" validate:"required,max=255"`
ItemValue string `json:"item_value" validate:"required,max=65535"`
}
func (c ConfigItem) DbModel(appID, configGroupName string) *dbmodel.ConfigGroupItem {
return &dbmodel.ConfigGroupItem{
AppID: appID,
ConfigGroupName: configGroupName,
ItemKey: c.ItemKey,
ItemValue: c.ItemValue,
}
}
type ApplicationConfigGroup struct {
AppID string `json:"app_id"`
ConfigGroupName string `json:"config_group_name" validate:"required,alphanum,min=2,max=64"`
DeployType string `json:"deploy_type" validate:"required,oneof=env configfile"`
ServiceIDs []string `json:"service_ids"`
ConfigItems []ConfigItem `json:"config_items"`
Enable bool `json:"enable"`
}
type AppConfigGroup struct {
ConfigGroupName string `json:"config_group_name" validate:"required,alphanum,min=2,max=64"`
DeployType string `json:"deploy_type" validate:"required,oneof=env configfile"`
ConfigItems []ConfigItem `json:"config_items"`
ConfigGroupServices []ConfigGroupService `json:"config_group_services"`
Enable bool `json:"enable"`
}
func (a AppConfigGroup) DbModel(appID string) *dbmodel.ApplicationConfigGroup {
return &dbmodel.ApplicationConfigGroup{
AppID: appID,
ConfigGroupName: a.ConfigGroupName,
DeployType: a.DeployType,
Enable: a.Enable,
}
}
type ApplicationConfigGroupResp struct {
CreateTime time.Time `json:"create_time"`
AppID string `json:"app_id"`
ConfigGroupName string `json:"config_group_name"`
DeployType string `json:"deploy_type"`
Services []*dbmodel.ConfigGroupService `json:"services"`
ConfigItems []*dbmodel.ConfigGroupItem `json:"config_items"`
Enable bool `json:"enable"`
}
type UpdateAppConfigGroupReq struct {
ServiceIDs []string `json:"service_ids"`
ConfigItems []ConfigItem `json:"config_items" validate:"required"`
Enable bool `json:"enable"`
}
type ListApplicationConfigGroupResp struct {
ConfigGroup []ApplicationConfigGroupResp `json:"config_group"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type CheckResourceNameReq struct {
Name string `json:"name"`
Type string `json:"type"`
}
type CheckResourceNameResp struct {
Name string `json:"name"`
}
type HelmAppRelease struct {
Revision int `json:"revision"`
Updated string `json:"updated"`
Status string `json:"status"`
Chart string `json:"chart"`
AppVersion string `json:"app_version"`
Description string `json:"description"`
}
type AppConfigGroupRelations struct {
ConfigGroupName string `json:"config_group_name"`
}
func (a *AppConfigGroupRelations) DbModel(appID, serviceID, serviceAlias string) *dbmodel.ConfigGroupService {
return &dbmodel.ConfigGroupService{
AppID: appID,
ConfigGroupName: a.ConfigGroupName,
ServiceID: serviceID,
ServiceAlias: serviceAlias,
}
}
type SyncAppConfigGroup struct {
AppConfigGroups []AppConfigGroup `json:"app_config_groups"`
}
type AppStatusesReq struct {
AppIDs []string `json:"app_ids"`
}
type RbdResp struct {
RbdName string `json:"rbd_name"`
NodeName string `json:"node_name"`
PodName string `json:"pod_name"`
}
type ShellPod struct {
RegionName string `json:"region_name"`
PodName string `json:"pod_name"`
}
type RainbondComponent struct {
Name string `json:"name"`
Pods []corev1.Pod `json:"pods"`
RunPods int `json:"run_pods"`
AllPods int `json:"all_pods"`
}
type RainbondPlugins struct {
RegionAppID string `json:"region_app_id"`
Name string `json:"name"`
TeamName string `json:"team_name"`
Status string `json:"status"`
Alias string `json:"alias"`
Labels map[string]string `json:"labels"`
PluginType string `json:"plugin_type"`
PluginViews []string `json:"plugin_views"`
EnableStatus string `json:"enable_status"`
FrontendComponent string `json:"frontend_component"`
EntryPath string `json:"entry_path"`
MenuTitle string `json:"menu_title"`
RoutePath string `json:"route_path"`
Namespace string `json:"namespace"`
BackendService string `json:"backend_service"`
FrontendService string `json:"frontend_service"`
}
type CreateRBDPluginReq struct {
PluginID string `json:"plugin_id" validate:"required"`
PluginName string `json:"plugin_name"`
PluginType string `json:"plugin_type"`
FrontendComponent string `json:"frontend_component"`
EntryPath string `json:"entry_path"`
PluginViews []string `json:"plugin_views"`
MenuTitle string `json:"menu_title"`
RoutePath string `json:"route_path"`
Namespace string `json:"namespace"`
BackendService string `json:"backend_service"`
FrontendService string `json:"frontend_service"`
AppID string `json:"app_id"`
}
type CreateUpdateGovernanceModeReq struct {
Provisioner string `json:"provisioner" validate:"required"`
}
type GovernanceMode struct {
Name string `json:"name"`
IsDefault bool `json:"is_default"`
Description string `json:"description"`
}
type FileInfo struct {
Title string `json:"title"`
IsLeaf bool `json:"is_leaf"`
}
type GrayReleaseModeRet struct {
ComponentID string `json:"component_id"`
Hostname string `json:"hostname"`
IstioNamespace string `json:"istio_namespace"`
CanaryReadyReplicas int32 `json:"canary_ready_replicas"`
CanaryReplicas int32 `json:"canary_replicas"`
CurrentStepIndex int `json:"current_step_index"`
CurrentStepState string `json:"current_step_state"`
Message string `json:"message"`
Step int `json:"step"`
NewVersion string `json:"new_version"`
OldVersion string `json:"old_version"`
}
type GrayReleaseModeReq struct {
AppID string `json:"app_id"`
Namespace string `json:"namespace"`
EntryComponentID string `json:"entry_component_id"`
EntryHttpRoute string `json:"entry_http_route"`
FlowEntryRule [][]*FlowEntryRule `json:"flow_entry_rule"`
GrayStrategyType string `json:"gray_strategy_type"`
GrayStrategy []int `json:"gray_strategy"`
Status bool `json:"status"`
TraceType string `json:"trace_type"`
}
type FlowEntryRule struct {
HeaderKey string `json:"header_key"`
HeaderType string `json:"header_type"`
HeaderValue string `json:"header_value"`
}
type AppPeerAuthentications struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
AppID string `json:"app_id"`
OperateMode bool `json:"operating_mode"`
}
type AppAuthorizationPolicy struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
AppID string `json:"app_id"`
OperateMode bool `json:"operating_mode"`
TenantID string `json:"tenant_id"`
ComponentInfos []ComponentInfo `json:"component_infos"`
}
type ComponentInfo struct {
ComponentID string `json:"component_id"`
IsCreateSA bool `json:"is_create_sa"`
SAName string `json:"sa_name"`
DependentComponentSANames []string `json:"dependent_component_sa_names"`
PortOuter []string `json:"port_outer"`
}
type UploadChart struct {
EventID string `json:"event_id"`
Name string `json:"name"`
Version string `json:"version"`
Namespace string `json:"namespace"`
Overrides []string `json:"overrides"`
}
type UploadChartValueYaml struct {
Values map[string]string `json:"values"`
Readme string `json:"readme"`
}
type UpdateLangVersion struct {
Lang string `json:"lang"`
Version string `json:"version"`
EventID string `json:"event_id"`
FileName string `json:"file_name"`
Show bool `json:"show"`
FirstChoice bool `json:"first_choice"`
BuildStrategy *string `json:"build_strategy,omitempty"`
IsAllowed *bool `json:"is_allowed,omitempty"`
}
type OverScore struct {
OverScoreRate string `json:"over_score_rate"`
}