Documentation ¶
Index ¶
- Constants
- Variables
- func RegistModel(models ...Interface)
- type Application
- type ApplicationComponent
- type ApplicationPolicy
- type ApplicationRevision
- type ApplicationTrait
- type ApplicationTrigger
- type BaseModel
- type Cluster
- type ClusterSelector
- type ClusterTarget
- type CodeInfo
- type ComponentPatch
- type ComponentSelector
- type Env
- type EnvBinding
- type Interface
- type JSONStruct
- type Project
- type ProviderInfo
- type Target
- type TraitPatch
- type Workflow
- type WorkflowRecord
- type WorkflowStep
- type WorkflowStepStatus
Constants ¶
const ( // PayloadTypeCustom is the payload type custom PayloadTypeCustom = "custom" // PayloadTypeDockerhub is the payload type dockerhub PayloadTypeDockerhub = "dockerhub" )
const ( // ClusterStatusHealthy healthy cluster ClusterStatusHealthy = "Healthy" // ClusterStatusUnhealthy unhealthy cluster ClusterStatusUnhealthy = "Unhealthy" )
Variables ¶
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) )
var RevisionStatusComplete = "complete"
RevisionStatusComplete event status complete
var RevisionStatusFail = "failure"
RevisionStatusFail event status failure
var RevisionStatusInit = "init"
RevisionStatusInit event status init
var RevisionStatusRollback = "rollback"
RevisionStatusRollback event status rollback
var RevisionStatusRunning = "running"
RevisionStatusRunning event status running
var RevisionStatusTerminated = "terminated"
RevisionStatusTerminated event status terminated
Functions ¶
Types ¶
type Application ¶ added in v1.2.0
type Application struct { BaseModel Name string `json:"name"` Alias string `json:"alias"` Project string `json:"project"` 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 { BaseModel 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 { BaseModel 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 { BaseModel 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"` // CodeInfo is the code info of this application revision CodeInfo *CodeInfo `json:"codeInfo,omitempty"` }
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 ApplicationTrigger ¶ added in v1.2.0
type ApplicationTrigger struct { BaseModel AppPrimaryKey string `json:"appPrimaryKey"` WorkflowName string `json:"workflowName,omitempty"` Name string `json:"name"` Alias string `json:"alias,omitempty"` Description string `json:"description,omitempty"` Token string `json:"token"` Type string `json:"type"` PayloadType string `json:"payloadType"` }
ApplicationTrigger is the model for trigger
func (*ApplicationTrigger) Index ¶ added in v1.2.0
func (w *ApplicationTrigger) Index() map[string]string
Index return custom index
func (*ApplicationTrigger) PrimaryKey ¶ added in v1.2.0
func (w *ApplicationTrigger) PrimaryKey() string
PrimaryKey return custom primary key
func (*ApplicationTrigger) TableName ¶ added in v1.2.0
func (w *ApplicationTrigger) TableName() string
TableName return custom table name
type BaseModel ¶ added in v1.2.0
type BaseModel struct { CreateTime time.Time `json:"createTime"` UpdateTime time.Time `json:"updateTime"` }
BaseModel common model
func (*BaseModel) SetCreateTime ¶ added in v1.2.0
SetCreateTime set create time
func (*BaseModel) SetUpdateTime ¶ added in v1.2.0
SetUpdateTime set update time
type Cluster ¶ added in v1.2.0
type Cluster struct { BaseModel 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) PrimaryKey ¶ added in v1.2.0
PrimaryKey primary key for datastore
func (*Cluster) SetCreateTime ¶ added in v1.2.0
SetCreateTime for local cluster, create time is set to a large date which ensures the order of list
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 one kubernetes cluster delivery target
type CodeInfo ¶ added in v1.2.0
type CodeInfo struct { // Commit is the commit hash Commit string `json:"commit,omitempty"` // Branch is the branch name Branch string `json:"branch,omitempty"` // User is the user name User string `json:"user,omitempty"` }
CodeInfo is the code info for webhook request
type ComponentPatch ¶ added in v1.2.0
type ComponentPatch struct { Name string `json:"name"` Properties *JSONStruct `json:"properties,omitempty"` Disable bool `json:"disable"` TraitsPatch []TraitPatch `json:"traitsPatch,omitempty"` }
ComponentPatch Define differential patches for components in the environment.
type ComponentSelector ¶ added in v1.2.0
type ComponentSelector struct {
Components []string `json:"components"`
}
ComponentSelector component selector
type Env ¶ added in v1.2.0
type Env struct { BaseModel Name string `json:"name"` Alias string `json:"alias"` Description string `json:"description,omitempty"` // Project defines the project this Env belongs to Project string `json:"project"` // Namespace defines the K8s namespace of the Env in control plane Namespace string `json:"namespace"` // Targets defines the name of delivery target that belongs to this env // In one project, a delivery target can only belong to one env. Targets []string `json:"targets,omitempty"` }
Env models the data of env in database
func (*Env) PrimaryKey ¶ added in v1.2.0
PrimaryKey return custom primary key
type EnvBinding ¶ added in v1.2.0
type EnvBinding struct { BaseModel AppPrimaryKey string `json:"appPrimaryKey"` Name string `json:"name"` ComponentsPatch []ComponentPatch `json:"componentsPatchs"` }
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 Project ¶ added in v1.2.0
type Project struct { BaseModel Name string `json:"name"` Alias string `json:"alias"` Description string `json:"description,omitempty"` }
Project project model
func (*Project) PrimaryKey ¶ added in v1.2.0
PrimaryKey return custom primary key
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 Target ¶ added in v1.2.0
type Target struct { BaseModel Name string `json:"name"` Alias string `json:"alias,omitempty"` Description string `json:"description,omitempty"` Cluster *ClusterTarget `json:"cluster,omitempty"` Variable map[string]interface{} `json:"variable,omitempty"` }
Target defines the delivery target information for the application It includes kubernetes clusters or cloud service providers
func (*Target) PrimaryKey ¶ added in v1.2.0
PrimaryKey return custom primary key
type TraitPatch ¶ added in v1.2.0
type TraitPatch struct { Type string `json:"type"` Properties *JSONStruct `json:"properties,omitempty"` Disable bool `json:"disable"` }
TraitPatch Define differential patches for traits in the environment.
type Workflow ¶ added in v1.2.0
type Workflow struct { BaseModel 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) PrimaryKey ¶ added in v1.2.0
PrimaryKey return custom primary key
type WorkflowRecord ¶ added in v1.2.0
type WorkflowRecord struct { BaseModel 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