models

package
v0.0.0-...-162f8c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AppTableName = "app"
View Source
const AppVersionTableName = "app_version"
View Source
const ClusterCommonTableName = "cluster_common"
View Source
const ClusterLinkTableName = "cluster_link"
View Source
const ClusterLoadbalancerTableName = "cluster_loadbalancer"
View Source
const ClusterNodeTableName = "cluster_node"
View Source
const ClusterRoleTableName = "cluster_role"
View Source
const ClusterSnapshotTableName = "cluster_snapshot"
View Source
const ClusterTableName = "cluster"
View Source
const ClusterUpgradeAuditTableName = "cluster_upgrade_audit"
View Source
const JobTableName = "job"
View Source
const RepoLabelTableName = "repo_label"
View Source
const RepoSelectorTableName = "repo_selector"
View Source
const RepoTableName = "repo"
View Source
const RepoTaskTableName = "repo_task"
View Source
const RuntimeEnvAttachedCredentialTableName = "runtime_env_attached_credential"
View Source
const RuntimeEnvCredentialTableName = "runtime_env_credential"
View Source
const RuntimeEnvLabelTableName = "runtime_env_label"
View Source
const RuntimeEnvTableName = "runtime_env"
View Source
const TaskTableName = "task"

Variables

View Source
var AppColumns = GetColumnsFromStruct(&App{})
View Source
var AppVersionColumns = GetColumnsFromStruct(&AppVersion{})
View Source
var ClusterColumns = GetColumnsFromStruct(&Cluster{})
View Source
var ClusterCommonColumns = GetColumnsFromStruct(&ClusterCommon{})
View Source
var ClusterLinkColumns = GetColumnsFromStruct(&ClusterLink{})
View Source
var ClusterLoadbalancerColumns = GetColumnsFromStruct(&ClusterLoadbalancer{})
View Source
var ClusterNodeColumns = GetColumnsFromStruct(&ClusterNode{})
View Source
var ClusterRoleColumns = GetColumnsFromStruct(&ClusterRole{})
View Source
var ClusterSnapshotColumns = GetColumnsFromStruct(&ClusterSnapshot{})
View Source
var ClusterUpgradeAuditColumns = GetColumnsFromStruct(&ClusterUpgradeAudit{})
View Source
var IndexedColumns = map[string][]string{
	AppTableName: {
		"app_id", "name", "repo_id", "description", "status",
		"home", "icon", "screenshots", "maintainers", "sources",
		"readme", "owner", "chart_name",
	},
	AppVersionTableName: {
		"version_id", "app_id", "name", "owner", "description",
		"package_name", "status",
	},
	JobTableName: {
		"job_id", "cluster_id", "app_id", "app_version", "status",
	},
	TaskTableName: {
		"job_id", "task_id", "status",
	},
	RepoTableName: {
		"repo_id", "name", "type", "visibility", "status",
	},
	RuntimeEnvTableName: {
		"runtime_env_id", "status", "owner",
	},
	RuntimeEnvCredentialTableName: {
		"runtime_env_credential_id", "status", "owner",
	},
	RepoLabelTableName: {
		"repo_id", "repo_label_id", "status",
	},
	RepoSelectorTableName: {
		"repo_id", "repo_selector_id", "status",
	},
	RepoTaskTableName: {
		"repo_task_id", "repo_id", "status",
	},
}

columns that can be search through sql '=' operator

View Source
var JobColumns = GetColumnsFromStruct(&Job{})
View Source
var RepoColumns = GetColumnsFromStruct(&Repo{})
View Source
var RepoColumnsWithTablePrefix = GetColumnsFromStructWithPrefix(RepoTableName, &Repo{})
View Source
var RepoLabelColumns = GetColumnsFromStruct(&RepoLabel{})
View Source
var RepoSelectorColumns = GetColumnsFromStruct(&RepoSelector{})
View Source
var RepoTaskColumns = GetColumnsFromStruct(&RepoTask{})
View Source
var RuntimeEnvAttachedCredentialColumns = GetColumnsFromStruct(&RuntimeEnvAttachedCredential{})
View Source
var RuntimeEnvColumns = GetColumnsFromStruct(&RuntimeEnv{})
View Source
var RuntimeEnvCredentialColumns = GetColumnsFromStruct(&RuntimeEnvCredential{})
View Source
var RuntimeEnvLabelColumns = GetColumnsFromStruct(&RuntimeEnvLabel{})
View Source
var SearchColumns = map[string][]string{
	AppTableName: {
		"app_id", "name", "repo_id", "owner", "chart_name",
	},
	AppVersionTableName: {
		"version_id", "app_id", "name", "description", "owner", "package_name",
	},
	JobTableName: {
		"job_id", "cluster_id", "app_id", "app_version", "status",
	},
	TaskTableName: {
		"job_id", "task_id", "status",
	},
	RuntimeEnvTableName: {
		"runtime_env_id", "name",
	},
	RuntimeEnvCredentialTableName: {
		"runtime_env_credential_id", "name",
	},
}

columns that can be search through sql 'like' operator

View Source
var TaskColumns = GetColumnsFromStruct(&Task{})

Functions

func AppToPb

func AppToPb(app *App) *pb.App

func AppVersionToPb

func AppVersionToPb(appVersion *AppVersion) *pb.AppVersion

func AppVersionsToPbs

func AppVersionsToPbs(appVersions []*AppVersion) (pbAppVersions []*pb.AppVersion)

func AppsToPbs

func AppsToPbs(apps []*App) (pbApps []*pb.App)

func ClusterNodeToPb

func ClusterNodeToPb(clusterNode *ClusterNode) *pb.ClusterNode

func ClusterNodesToPbs

func ClusterNodesToPbs(clusterNodes []*ClusterNode) (pbClusterNodes []*pb.ClusterNode)

func ClusterToPb

func ClusterToPb(cluster *Cluster) *pb.Cluster

func ClustersToPbs

func ClustersToPbs(clusters []*Cluster) (pbClusters []*pb.Cluster)

func GetColumnsFromStruct

func GetColumnsFromStruct(s interface{}) []string

func GetColumnsFromStructWithPrefix

func GetColumnsFromStructWithPrefix(prefix string, s interface{}) []string

func JobToPb

func JobToPb(job *Job) *pb.Job

func JobsToPbs

func JobsToPbs(jobs []*Job) (pbJobs []*pb.Job)

func NewAppId

func NewAppId() string

func NewAppVersionId

func NewAppVersionId() string

func NewClusterId

func NewClusterId() string

func NewClusterNodeId

func NewClusterNodeId() string

func NewJobId

func NewJobId() string

func NewRepoId

func NewRepoId() string

func NewRepoLabelId

func NewRepoLabelId() string

func NewRepoSelectorId

func NewRepoSelectorId() string

func NewRepoTaskId

func NewRepoTaskId() string

func NewRuntimeEnvCrentialId

func NewRuntimeEnvCrentialId() string

func NewRuntimeEnvId

func NewRuntimeEnvId() string

func NewRuntimeEnvLabelId

func NewRuntimeEnvLabelId() string

func NewTaskId

func NewTaskId() string

func RepoLabelToPb

func RepoLabelToPb(repoLabel *RepoLabel) *pb.RepoLabel

func RepoLabelsToPbs

func RepoLabelsToPbs(repoLabels []*RepoLabel) (pbRepoLabels []*pb.RepoLabel)

func RepoSelectorToPb

func RepoSelectorToPb(repoSelector *RepoSelector) *pb.RepoSelector

func RepoSelectorsToPbs

func RepoSelectorsToPbs(repoSelectors []*RepoSelector) (pbRepoSelectors []*pb.RepoSelector)

func RepoTaskToPb

func RepoTaskToPb(repoTask *RepoTask) *pb.RepoTask

func RepoTasksToPbs

func RepoTasksToPbs(repoTasks []*RepoTask) (pbRepoTasks []*pb.RepoTask)

func RepoToPb

func RepoToPb(repo *Repo) *pb.Repo

func ReposToPbs

func ReposToPbs(repos []*Repo) (pbRepos []*pb.Repo)

func RuntimeEnvCredentialContentMapToString

func RuntimeEnvCredentialContentMapToString(mapContent map[string]string) string

func RuntimeEnvCredentialContentStringToMap

func RuntimeEnvCredentialContentStringToMap(stringContent string) map[string]string

func RuntimeEnvCredentialToPb

func RuntimeEnvCredentialToPb(runtimeEnvCredential *RuntimeEnvCredential) *pb.RuntimeEnvCredential

func RuntimeEnvCredentialToPbs

func RuntimeEnvCredentialToPbs(runtimeEnvCredentials []*RuntimeEnvCredential) (pbRuntimeEnvCredentials []*pb.RuntimeEnvCredential)

func RuntimeEnvLabelToPb

func RuntimeEnvLabelToPb(runtimeEnvLabel *RuntimeEnvLabel) *pb.RuntimeEnvLabel

func RuntimeEnvLabelsToPbs

func RuntimeEnvLabelsToPbs(runtimeEnvLabels []*RuntimeEnvLabel) (pbRuntimeEnvLabels []*pb.RuntimeEnvLabel)

func RuntimeEnvToPb

func RuntimeEnvToPb(runtimeEnv *RuntimeEnv) *pb.RuntimeEnv

func RuntimeEnvToPbs

func RuntimeEnvToPbs(runtimeEnvs []*RuntimeEnv) (pbRuntimeEnvs []*pb.RuntimeEnv)

func TaskToPb

func TaskToPb(task *Task) *pb.Task

func TasksToPbs

func TasksToPbs(tasks []*Task) (pbTasks []*pb.Task)

Types

type App

type App struct {
	AppId       string
	Name        string
	RepoId      string
	Description string
	Status      string
	Home        string
	Icon        string
	Screenshots string
	Maintainers string
	Sources     string
	Readme      string
	Owner       string
	ChartName   string
	CreateTime  time.Time
	StatusTime  time.Time
}

func NewApp

func NewApp(name, repoId, description, owner, chartName string) *App

type AppVersion

type AppVersion struct {
	VersionId   string
	AppId       string
	Owner       string
	Name        string
	Description string
	PackageName string
	Status      string
	CreateTime  time.Time
	StatusTime  time.Time
}

func NewAppVersion

func NewAppVersion(appId, name, description, owner, packageName string) *AppVersion

type Cluster

type Cluster struct {
	ClusterId          string
	Name               string
	Description        string
	AppId              string
	VersionId          string
	VxnetId            string
	FrontgateId        string
	ClusterType        int32
	Endpoints          string
	Status             string
	TransitionStatus   string
	MetadataRootAccess bool
	Owner              string
	GlobalUuid         string
	UpgradeStatus      string
	UpgradeTime        time.Time
	RuntimeEnvId       string
	CreateTime         time.Time
	StatusTime         time.Time
}

func NewCluster

func NewCluster() *Cluster

type ClusterCommon

type ClusterCommon struct {
	ClusterId                  string
	Role                       string
	ServerIdUpperBound         int32
	AdvancedActions            string
	InitService                string
	StartService               string
	StopService                string
	ScaleOutService            string
	ScaleInService             string
	RestartService             string
	DestroyService             string
	UpgradeService             string
	CustomService              string
	BackupService              string
	RestoreService             string
	DeleteSnapshotService      string
	HealthCheck                string
	Monitor                    string
	Passphraseless             string
	VerticalScalingPolicy      string
	AgentInstalled             bool
	CustomMetadataScript       string
	ImageId                    string
	BackupPolicy               string
	IncrementalBackupSupported bool
	Hypervisor                 string
}

type ClusterJsonMustache

type ClusterJsonMustache struct {
	AppId                      string                 `json:"app_id"`
	VersionId                  string                 `json:"version_id"`
	GlobalUuid                 string                 `json:"global_uuid"`
	Name                       string                 `json:"name"`
	Description                string                 `json:"description"`
	Vxnet                      string                 `json:"vxnet"`
	Links                      map[string]string      `json:"links"`
	BackupPolicy               string                 `json:"backup_policy"`
	IncrementalBackupSupported *bool                  `json:"incremental_backup_supported"`
	UpgradePolicy              []string               `json:"upgrade_policy"`
	Nodes                      []Node                 `json:"nodes"`
	Env                        map[string]interface{} `json:"env"`
	AdvancedActions            []string               `json:"advanced_actions"`
	Endpoints                  map[string]struct {
		Port     int32  `json:"port"`
		Protocol string `json:"protocol"`
	} `json:"endpoints"`
	MetadataRootAccess *bool        `json:"metadata_root_access"`
	HealthCheck        *HealthCheck `json:"health_check"`
	Monitor            *Monitor     `json:"monitor"`
	DisplayTabs        struct {
		DisplayTabsItems map[string]struct {
			Cmd              string   `json:"cmd"`
			RolesToExecuteOn []string `json:"roles_to_execute_on"`
			Description      string   `json:"description"`
			Timeout          int32    `json:"timeout"`
		}
	} `json:"display_tabs"`
}
type ClusterLink struct {
	ClusterId         string
	Name              string
	ExternalClusterId string
	Owner             string
}

type ClusterLoadbalancer

type ClusterLoadbalancer struct {
	ClusterId              string
	Role                   string
	LoadbalancerListenerId string
	LoadbalancerPort       int32
	LoadbalancerPolicyId   string
}

type ClusterNode

type ClusterNode struct {
	NodeId           string
	ClusterId        string
	Name             string
	InstanceId       string
	VolumeId         string
	VxnetId          string
	PrivateIp        string
	ServerId         int32
	Role             string
	Status           string
	TransitionStatus string
	GroupId          int32
	Owner            string
	GlobalServerId   string
	CustomMetadata   string
	PubKey           string
	HealthStatus     string
	IsBackup         bool
	AutoBackup       bool
	CreateTime       time.Time
	StatusTime       time.Time
}

func NewClusterNode

func NewClusterNode() *ClusterNode

type ClusterRole

type ClusterRole struct {
	ClusterId    string
	Role         string
	Cpu          int32
	Gpu          int32
	Memory       int32
	InstanceSize int32
	StorageSize  int32
	Env          string
}

type ClusterSnapshot

type ClusterSnapshot struct {
	SnapshotId string
	Role       string
	ServerIds  string

	AppId            string
	VersionId        string
	ChildSnapshotIds string
	Size             int32
	// contains filtered or unexported fields
}

type ClusterUpgradeAudit

type ClusterUpgradeAudit struct {
	ClusterUpgradeAuditId string
	ClusterId             string
	FromVersionId         string
	ToVersionId           string
	ServiceParams         string
	CreateTime            time.Time
	StatusTime            time.Time
	Status                string
	Owner                 string
}

type ClusterWrapper

type ClusterWrapper struct {
	Cluster              *Cluster
	ClusterNodes         []*ClusterNode
	ClusterCommons       []*ClusterCommon
	ClusterLinks         []*ClusterLink
	ClusterRoles         []*ClusterRole
	ClusterLoadbalancers []*ClusterLoadbalancer
}

type HealthCheck

type HealthCheck struct {
	Enable             *bool  `json:"enable"`
	IntervalSec        int32  `json:"interval_sec"`
	TimeoutSec         int32  `json:"timeout_sec"`
	ActionTimeoutSec   int32  `json:"action_timeout_sec"`
	HealthyThreshold   int32  `json:"healthy_threshold"`
	UnhealthyThreshold int32  `json:"unhealthy_threshold"`
	CheckCmd           string `json:"check_cmd"`
	ActionCmd          string `json:"action_cmd"`
}

type Job

type Job struct {
	JobId      string
	ClusterId  string
	AppId      string
	VersionId  string
	JobAction  string
	Directive  string
	Runtime    string
	Owner      string
	Status     string
	ErrorCode  uint32
	Executor   string
	TaskCount  uint32
	CreateTime time.Time
	StatusTime time.Time
}

func NewJob

func NewJob(jobId, clusterId, appId, versionId, jobAction, directive, runtime, userId string) *Job

type Monitor

type Monitor struct {
	Enable *bool  `json:"enable"`
	Cmd    string `json:"cmd"`
	Items  map[string]struct {
		Unit                   string   `json:"unit"`
		ValueType              string   `json:"value_type"`
		StatisticsType         string   `json:"statistics_type"`
		ScaleFactorWhenDisplay int32    `json:"scale_factor_when_display"`
		Enums                  []string `json:"enums"`
	} `json:"items"`
	Groups  map[string][]string `json:"groups"`
	Display []string            `json:"display"`
	Alarm   []string            `json:"alarm"`
}

type Node

type Node struct {
	Role            string   `json:"role"`
	AdvancedActions []string `json:"advanced_actions"`
	Loadbalancer    []struct {
		Listener string `json:"listener"`
		Port     int32  `json:"port"`
		Policy   string `json:"policy"`
	} `json:"loadbalancer"`
	Container struct {
		Type  string `json:"type"`
		Image string `json:"image"`
	} `json:"container"`
	Count  int32 `json:"count"`
	CPU    int32 `json:"cpu"`
	Memory int32 `json:"memory"`
	GPU    int32 `json:"gpu"`
	Volume struct {
		Size         int32       `json:"size"`
		InstanceSize int32       `json:"instance_size"`
		MountPoint   interface{} `json:"mount_point"`
		MountOptions string      `json:"mount_options"`
		Filesystem   string      `json:"filesystem"`
	} `json:"volume"`
	Replica               int32                  `json:"replica"`
	Passphraseless        string                 `json:"passphraseless"`
	VerticalScalingPolicy string                 `json:"vertical_scaling_policy"`
	UserAccess            *bool                  `json:"user_access"`
	Services              map[string]interface{} `json:"services"`
	ServerIDUpperBound    int32                  `json:"server_id_upper_bound"`
	Env                   map[string]interface{} `json:"env"`
	AgentInstalled        *bool                  `json:"agent_installed"`
	CustomMetadata        map[string]interface{} `json:"custom_metadata"`
	HealthCheck           *HealthCheck           `json:"health_check"`
	Monitor               *Monitor               `json:"monitor"`
}

type Repo

type Repo struct {
	RepoId      string
	Name        string
	Description string
	Type        string
	Url         string
	Credential  string
	Visibility  string
	Owner       string

	Status     string
	CreateTime time.Time
	StatusTime time.Time
}

func NewRepo

func NewRepo(name, description, typ, url, credential, visibility, owner string) *Repo

type RepoLabel

type RepoLabel struct {
	RepoLabelId string
	RepoId      string
	LabelKey    string
	LabelValue  string

	Status     string
	CreateTime time.Time
	StatusTime time.Time
}

func NewRepoLabel

func NewRepoLabel(repoId, labelKey, labelValue string) *RepoLabel

type RepoSelector

type RepoSelector struct {
	RepoSelectorId string
	RepoId         string
	SelectorKey    string
	SelectorValue  string

	Status     string
	CreateTime time.Time
	StatusTime time.Time
}

func NewRepoSelector

func NewRepoSelector(repoId, selectorKey, selectorValue string) *RepoSelector

type RepoTask

type RepoTask struct {
	RepoTaskId string
	RepoId     string
	Status     string
	Result     string
	Owner      string
	CreateTime time.Time
	StatusTime time.Time
}

func NewRepoTask

func NewRepoTask(repoId, owner string) *RepoTask

type RuntimeEnv

type RuntimeEnv struct {
	RuntimeEnvId  string
	Name          string
	Description   string
	RuntimeEnvUrl string
	Owner         string
	Status        string
	CreateTime    time.Time
	StatusTime    time.Time
}

func NewRuntimeEnv

func NewRuntimeEnv(name, description, runtimeEnvUrl, owner string) *RuntimeEnv

type RuntimeEnvAttachedCredential

type RuntimeEnvAttachedCredential struct {
	RuntimeEnvId           string
	RuntimeEnvCredentialId string
}

func NewRuntimeEnvAttachedCredential

func NewRuntimeEnvAttachedCredential(runtimeEnvId, runtimeEnvCredentialId string) *RuntimeEnvAttachedCredential

type RuntimeEnvCredential

type RuntimeEnvCredential struct {
	RuntimeEnvCredentialId string
	Name                   string
	Description            string
	Owner                  string
	Content                string
	Status                 string
	CreateTime             time.Time
	StatusTime             time.Time
}

func NewRuntimeEnvCredential

func NewRuntimeEnvCredential(name, description, owner string, content map[string]string) *RuntimeEnvCredential

type RuntimeEnvLabel

type RuntimeEnvLabel struct {
	RuntimeEnvLabelId string
	RuntimeEnvId      string
	LabelKey          string
	LabelValue        string
}

func NewRuntimeEnvLabel

func NewRuntimeEnvLabel(runtimeEnvId, labelKey, labelValue string) *RuntimeEnvLabel

type ServiceParams

type ServiceParams struct {
	Params map[string]interface{}
}

type Task

type Task struct {
	TaskId     string
	JobId      string
	TaskAction string
	Directive  string
	Owner      string
	Status     string
	ErrorCode  uint32
	Executor   string
	Target     string
	NodeId     string
	CreateTime time.Time
	StatusTime time.Time
}

func NewTask

func NewTask(taskId, jobId, nodeId, target, taskAction, directive, userId string) *Task

type TaskLayer

type TaskLayer struct {
	Tasks []*Task
	Child *TaskLayer
}

func (*TaskLayer) WalkTree

func (m *TaskLayer) WalkTree(cb WalkFunc) error

type WalkFunc

type WalkFunc func(parent *TaskLayer, current *TaskLayer) error

WalkFunc is a callback type for use with TaskLayer.WalkTree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL