model

package
v1.2.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterStatusHealthy healthy cluster
	ClusterStatusHealthy = "Healthy"
	// ClusterStatusUnhealthy unhealthy cluster
	ClusterStatusUnhealthy = "Unhealthy"
)

Variables

View Source
var (
	// LocalClusterCreatedTime create time for local cluster, set to late date in order to ensure it is sorted to first
	LocalClusterCreatedTime = time.Date(2999, 1, 1, 0, 0, 0, 0, time.UTC)
)
View Source
var RevisionStatusComplete = "complete"

RevisionStatusComplete event status complete

View Source
var RevisionStatusFail = "failure"

RevisionStatusFail event status failure

View Source
var RevisionStatusInit = "init"

RevisionStatusInit event status init

View Source
var RevisionStatusRollback = "rollback"

RevisionStatusRollback event status rollback

View Source
var RevisionStatusRunning = "running"

RevisionStatusRunning event status running

View Source
var RevisionStatusTerminated = "terminated"

RevisionStatusTerminated event status terminated

Functions

func RegistModel added in v1.2.0

func RegistModel(models ...Interface)

RegistModel regist model

Types

type AddonRegistry

type AddonRegistry struct {
	Model
	Name string `json:"name"`

	Git *addon.GitAddonSource `json:"git,omitempty"`
	Oss *addon.OSSAddonSource `json:"oss,omitempty"`
}

AddonRegistry defines the data model of a AddonRegistry

func (*AddonRegistry) Index

func (a *AddonRegistry) Index() map[string]string

Index return custom index

func (*AddonRegistry) PrimaryKey

func (a *AddonRegistry) PrimaryKey() string

PrimaryKey return custom primary key

func (*AddonRegistry) TableName

func (a *AddonRegistry) TableName() string

TableName return custom table name

type Application added in v1.2.0

type Application struct {
	Model
	Name        string            `json:"name"`
	Alias       string            `json:"alias"`
	Project     string            `json:"project"`
	Namespace   string            `json:"namespace"`
	Description string            `json:"description"`
	Icon        string            `json:"icon"`
	Labels      map[string]string `json:"labels,omitempty"`
}

Application application delivery model

func (*Application) Index added in v1.2.0

func (a *Application) Index() map[string]string

Index return custom index

func (*Application) PrimaryKey added in v1.2.0

func (a *Application) PrimaryKey() string

PrimaryKey return custom primary key

func (*Application) TableName added in v1.2.0

func (a *Application) TableName() string

TableName return custom table name

type ApplicationComponent added in v1.2.0

type ApplicationComponent struct {
	Model
	AppPrimaryKey string            `json:"appPrimaryKey"`
	Description   string            `json:"description,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
	Icon          string            `json:"icon,omitempty"`
	Creator       string            `json:"creator"`
	Name          string            `json:"name"`
	Alias         string            `json:"alias"`
	Type          string            `json:"type"`

	// ExternalRevision specified the component revisionName
	ExternalRevision string             `json:"externalRevision,omitempty"`
	Properties       *JSONStruct        `json:"properties,omitempty"`
	DependsOn        []string           `json:"dependsOn,omitempty"`
	Inputs           common.StepInputs  `json:"inputs,omitempty"`
	Outputs          common.StepOutputs `json:"outputs,omitempty"`
	// Traits define the trait of one component, the type must be array to keep the order.
	Traits []ApplicationTrait `json:"traits,omitempty"`
	// scopes in ApplicationComponent defines the component-level scopes
	// the format is <scope-type:scope-instance-name> pairs, the key represents type of `ScopeDefinition` while the value represent the name of scope instance.
	Scopes map[string]string `json:"scopes,omitempty"`
}

ApplicationComponent component database model

func (*ApplicationComponent) Index added in v1.2.0

func (a *ApplicationComponent) Index() map[string]string

Index return custom index

func (*ApplicationComponent) PrimaryKey added in v1.2.0

func (a *ApplicationComponent) PrimaryKey() string

PrimaryKey return custom primary key

func (*ApplicationComponent) TableName added in v1.2.0

func (a *ApplicationComponent) TableName() string

TableName return custom table name

type ApplicationPolicy added in v1.2.0

type ApplicationPolicy struct {
	Model
	AppPrimaryKey string      `json:"appPrimaryKey"`
	Name          string      `json:"name"`
	Description   string      `json:"description"`
	Type          string      `json:"type"`
	Creator       string      `json:"creator"`
	Properties    *JSONStruct `json:"properties,omitempty"`
}

ApplicationPolicy app policy

func (*ApplicationPolicy) Index added in v1.2.0

func (a *ApplicationPolicy) Index() map[string]string

Index return custom index

func (*ApplicationPolicy) PrimaryKey added in v1.2.0

func (a *ApplicationPolicy) PrimaryKey() string

PrimaryKey return custom primary key

func (*ApplicationPolicy) TableName added in v1.2.0

func (a *ApplicationPolicy) TableName() string

TableName return custom table name

type ApplicationRevision added in v1.2.0

type ApplicationRevision struct {
	Model
	AppPrimaryKey   string `json:"appPrimaryKey"`
	Version         string `json:"version"`
	RollbackVersion string `json:"rollbackVersion,omitempty"`
	// ApplyAppConfig Stores the application configuration during the current deploy.
	ApplyAppConfig string `json:"applyAppConfig,omitempty"`

	// Deploy event status
	Status string `json:"status"`
	Reason string `json:"reason"`

	// The user that triggers the deploy.
	DeployUser string `json:"deployUser"`

	// Information that users can note.
	Note string `json:"note"`
	// TriggerType the event trigger source, Web or API
	TriggerType string `json:"triggerType"`

	// WorkflowName deploy controller by workflow
	WorkflowName string `json:"workflowName"`
	// EnvName is the env name of this application revision
	EnvName string `json:"envName"`
}

ApplicationRevision be created when an application initiates deployment and describes the phased version of the application.

func (*ApplicationRevision) Index added in v1.2.0

func (a *ApplicationRevision) Index() map[string]string

Index return custom index

func (*ApplicationRevision) PrimaryKey added in v1.2.0

func (a *ApplicationRevision) PrimaryKey() string

PrimaryKey return custom primary key

func (*ApplicationRevision) TableName added in v1.2.0

func (a *ApplicationRevision) TableName() string

TableName return custom table name

type ApplicationTrait added in v1.2.0

type ApplicationTrait struct {
	Alias       string      `json:"alias"`
	Description string      `json:"description"`
	Type        string      `json:"type"`
	Properties  *JSONStruct `json:"properties,omitempty"`
	CreateTime  time.Time   `json:"createTime"`
	UpdateTime  time.Time   `json:"updateTime"`
}

ApplicationTrait application trait

type Cluster added in v1.2.0

type Cluster struct {
	Model            `json:"model"`
	Name             string            `json:"name"`
	Alias            string            `json:"alias"`
	Description      string            `json:"description"`
	Icon             string            `json:"icon"`
	Labels           map[string]string `json:"labels"`
	Status           string            `json:"status"`
	Reason           string            `json:"reason"`
	Provider         ProviderInfo      `json:"provider"`
	APIServerURL     string            `json:"apiServerURL"`
	DashboardURL     string            `json:"dashboardURL"`
	KubeConfig       string            `json:"kubeConfig"`
	KubeConfigSecret string            `json:"kubeConfigSecret"`
}

Cluster describes the model of cluster in apiserver

func (*Cluster) DeepCopy added in v1.2.0

func (c *Cluster) DeepCopy() *Cluster

DeepCopy create a copy of cluster

func (*Cluster) Index added in v1.2.0

func (c *Cluster) Index() map[string]string

Index set to nil for list

func (*Cluster) PrimaryKey added in v1.2.0

func (c *Cluster) PrimaryKey() string

PrimaryKey primary key for datastore

func (*Cluster) SetCreateTime added in v1.2.0

func (c *Cluster) SetCreateTime(t time.Time)

SetCreateTime for local cluster, create time is set to a large date which ensures the order of list

func (*Cluster) TableName added in v1.2.0

func (c *Cluster) TableName() string

TableName table name for datastore

type ClusterSelector added in v1.2.0

type ClusterSelector struct {
	Name string `json:"name"`
	// Adapt to a scenario where only one Namespace is available or a user-defined Namespace is available.
	Namespace string `json:"namespace,omitempty"`
}

ClusterSelector cluster selector

type ClusterTarget added in v1.2.0

type ClusterTarget struct {
	ClusterName string `json:"clusterName" validate:"checkname"`
	Namespace   string `json:"namespace" optional:"true"`
}

ClusterTarget kubernetes delivery target

type ComponentSelector added in v1.2.0

type ComponentSelector struct {
	Components []string `json:"components"`
}

ComponentSelector component selector

type DeliveryTarget

type DeliveryTarget struct {
	Model
	Name        string                 `json:"name"`
	Project     string                 `json:"project"`
	Namespace   string                 `json:"namespace"`
	Alias       string                 `json:"alias,omitempty"`
	Description string                 `json:"description,omitempty"`
	Cluster     *ClusterTarget         `json:"cluster,omitempty"`
	Variable    map[string]interface{} `json:"variable,omitempty"`
}

DeliveryTarget defines the delivery target information for the application It includes kubernetes clusters or cloud service providers

func (*DeliveryTarget) Index

func (d *DeliveryTarget) Index() map[string]string

Index return custom index

func (*DeliveryTarget) PrimaryKey

func (d *DeliveryTarget) PrimaryKey() string

PrimaryKey return custom primary key

func (*DeliveryTarget) TableName

func (d *DeliveryTarget) TableName() string

TableName return custom table name

type EnvBinding added in v1.2.0

type EnvBinding struct {
	Model
	AppPrimaryKey     string             `json:"appPrimaryKey"`
	Name              string             `json:"name"`
	Alias             string             `json:"alias"`
	Description       string             `json:"description,omitempty"`
	TargetNames       []string           `json:"targetNames"`
	ComponentSelector *ComponentSelector `json:"componentSelector"`
}

EnvBinding application env binding

func (*EnvBinding) Index added in v1.2.0

func (e *EnvBinding) Index() map[string]string

Index return custom index

func (*EnvBinding) PrimaryKey added in v1.2.0

func (e *EnvBinding) PrimaryKey() string

PrimaryKey return custom primary key

func (*EnvBinding) TableName added in v1.2.0

func (e *EnvBinding) TableName() string

TableName return custom table name

type Interface added in v1.2.0

type Interface interface {
	TableName() string
}

Interface model interface

type JSONStruct added in v1.2.0

type JSONStruct map[string]interface{}

JSONStruct json struct, same with runtime.RawExtension

func NewJSONStruct added in v1.2.0

func NewJSONStruct(raw *runtime.RawExtension) (*JSONStruct, error)

NewJSONStruct new jsonstruct from runtime.RawExtension

func NewJSONStructByString added in v1.2.0

func NewJSONStructByString(source string) (*JSONStruct, error)

NewJSONStructByString new jsonstruct from string

func NewJSONStructByStruct added in v1.2.0

func NewJSONStructByStruct(object interface{}) (*JSONStruct, error)

NewJSONStructByStruct new jsonstruct from strcut object

func (*JSONStruct) JSON added in v1.2.0

func (j *JSONStruct) JSON() string

JSON Encoded as a JSON string

func (*JSONStruct) RawExtension added in v1.2.0

func (j *JSONStruct) RawExtension() *runtime.RawExtension

RawExtension Encoded as a RawExtension

type Model

type Model struct {
	CreateTime time.Time `json:"createTime"`
	UpdateTime time.Time `json:"updateTime"`
}

Model common model

func (*Model) SetCreateTime

func (m *Model) SetCreateTime(time time.Time)

SetCreateTime set create time

func (*Model) SetUpdateTime

func (m *Model) SetUpdateTime(time time.Time)

SetUpdateTime set update time

type Project added in v1.2.0

type Project struct {
	Model
	Name        string `json:"name"`
	Alias       string `json:"alias"`
	Description string `json:"description,omitempty"`
	// Namespace Control cluster namespace
	Namespace string `json:"namespace"`
}

Project project model

func (*Project) Index added in v1.2.0

func (p *Project) Index() map[string]string

Index return custom index

func (*Project) PrimaryKey added in v1.2.0

func (p *Project) PrimaryKey() string

PrimaryKey return custom primary key

func (*Project) TableName added in v1.2.0

func (p *Project) TableName() string

TableName return custom table name

type ProviderInfo added in v1.2.0

type ProviderInfo struct {
	Provider    string            `json:"provider"`
	ClusterID   string            `json:"clusterID"`
	ClusterName string            `json:"clusterName,omitempty"`
	Zone        string            `json:"zone,omitempty"`
	ZoneID      string            `json:"zoneID,omitempty"`
	RegionID    string            `json:"regionID,omitempty"`
	VpcID       string            `json:"vpcID,omitempty"`
	Labels      map[string]string `json:"labels"`
}

ProviderInfo describes the information from provider API

type Workflow added in v1.2.0

type Workflow struct {
	Model
	Name        string `json:"name"`
	Alias       string `json:"alias"`
	Description string `json:"description"`
	// Workflow used by the default
	Default       *bool          `json:"default"`
	AppPrimaryKey string         `json:"appPrimaryKey"`
	EnvName       string         `json:"envName"`
	Steps         []WorkflowStep `json:"steps,omitempty"`
}

Workflow application delivery database model

func (*Workflow) Index added in v1.2.0

func (w *Workflow) Index() map[string]string

Index return custom primary key

func (*Workflow) PrimaryKey added in v1.2.0

func (w *Workflow) PrimaryKey() string

PrimaryKey return custom primary key

func (*Workflow) TableName added in v1.2.0

func (w *Workflow) TableName() string

TableName return custom table name

type WorkflowRecord added in v1.2.0

type WorkflowRecord struct {
	Model
	WorkflowName       string               `json:"workflowName"`
	WorkflowAlias      string               `json:"workflowAlias"`
	AppPrimaryKey      string               `json:"appPrimaryKey"`
	RevisionPrimaryKey string               `json:"revisionPrimaryKey"`
	Name               string               `json:"name"`
	Namespace          string               `json:"namespace"`
	StartTime          time.Time            `json:"startTime,omitempty"`
	Finished           string               `json:"finished"`
	Steps              []WorkflowStepStatus `json:"steps,omitempty"`
	Status             string               `json:"status"`
}

WorkflowRecord is the workflow record database model

func (*WorkflowRecord) Index added in v1.2.0

func (w *WorkflowRecord) Index() map[string]string

Index return custom primary key

func (*WorkflowRecord) PrimaryKey added in v1.2.0

func (w *WorkflowRecord) PrimaryKey() string

PrimaryKey return custom primary key

func (*WorkflowRecord) TableName added in v1.2.0

func (w *WorkflowRecord) TableName() string

TableName return custom table name

type WorkflowStep added in v1.2.0

type WorkflowStep struct {
	// Name is the unique name of the workflow step.
	Name        string             `json:"name"`
	Alias       string             `json:"alias"`
	Type        string             `json:"type"`
	Description string             `json:"description"`
	OrderIndex  int                `json:"orderIndex"`
	Inputs      common.StepInputs  `json:"inputs,omitempty"`
	Outputs     common.StepOutputs `json:"outputs,omitempty"`
	DependsOn   []string           `json:"dependsOn"`
	Properties  *JSONStruct        `json:"properties,omitempty"`
}

WorkflowStep defines how to execute a workflow step.

type WorkflowStepStatus added in v1.2.0

type WorkflowStepStatus struct {
	ID               string                   `json:"id"`
	Name             string                   `json:"name"`
	Alias            string                   `json:"alias"`
	Type             string                   `json:"type,omitempty"`
	Phase            common.WorkflowStepPhase `json:"phase,omitempty"`
	Message          string                   `json:"message,omitempty"`
	Reason           string                   `json:"reason,omitempty"`
	FirstExecuteTime time.Time                `json:"firstExecuteTime,omitempty"`
	LastExecuteTime  time.Time                `json:"lastExecuteTime,omitempty"`
}

WorkflowStepStatus is the workflow step status database model

Jump to

Keyboard shortcuts

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