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 ImageInfo
- type ImageRepository
- type ImageResource
- type Interface
- type JSONStruct
- type Project
- type ProviderInfo
- type SystemInfo
- 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"
// PayloadTypeACR is the payload type acr
PayloadTypeACR = "acr"
// PayloadTypeHarbor is the payload type harbor
PayloadTypeHarbor = "harbor"
// ComponentTypeWebservice is the component type webservice
ComponentTypeWebservice = "webservice"
// ComponentTypeWorker is the component type worker
ComponentTypeWorker = "worker"
// ComponentTypeTask is the component type task
ComponentTypeTask = "task"
)
const (
// ClusterStatusHealthy healthy cluster
ClusterStatusHealthy = "Healthy"
// ClusterStatusUnhealthy unhealthy cluster
ClusterStatusUnhealthy = "Unhealthy"
)
const (
// HarborEventTypePushArtifact is the event type PUSH_ARTIFACT
HarborEventTypePushArtifact = "PUSH_ARTIFACT"
)
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
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
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
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"`
// ImageInfo is the image info of this application revision
ImageInfo *ImageInfo `json:"imageInfo,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
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
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
func (m *BaseModel) SetCreateTime(time time.Time)
SetCreateTime set create time
func (*BaseModel) SetUpdateTime ¶ added in v1.2.0
func (m *BaseModel) SetUpdateTime(time time.Time)
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) 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
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) Index ¶ added in v1.2.0
func (p *Env) Index() map[string]string
Index return custom index
func (*Env) PrimaryKey ¶ added in v1.2.0
func (p *Env) PrimaryKey() string
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
type ImageInfo ¶ added in v1.2.0
type ImageInfo struct {
// Type is the image type, ACR or Harbor or DockerHub
Type string `json:"type"`
// Resource is the image resource
Resource *ImageResource `json:"resource,omitempty"`
// Repository is the image repository
Repository *ImageRepository `json:"repository,omitempty"`
}
ImageInfo is the image info for webhook request
type ImageRepository ¶ added in v1.2.0
type ImageRepository struct {
// Name is the image repository name
Name string `json:"name"`
// Namespace is the image repository namespace
Namespace string `json:"namespace"`
// FullName is the image repository full name
FullName string `json:"fullName"`
// Region is the image repository region
Region string `json:"region,omitempty"`
// Type is the image repository type, public or private
Type string `json:"type"`
// CreateTime is the image repository create time
CreateTime time.Time `json:"createTime,omitempty"`
}
ImageRepository is the image repository
type ImageResource ¶ added in v1.2.0
type ImageResource struct {
// Digest is the image digest
Digest string `json:"digest"`
// Tag is the image tag
Tag string `json:"tag"`
// URL is the image url
URL string `json:"url"`
// CreateTime is the image create time
CreateTime time.Time `json:"createTime,omitempty"`
}
ImageResource is the image resource
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) 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
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 SystemInfo ¶ added in v1.2.0
type SystemInfo struct {
BaseModel
InstallID string `json:"installID"`
EnableCollection bool `json:"enableCollection"`
}
SystemInfo systemInfo model
func (*SystemInfo) Index ¶ added in v1.2.0
func (u *SystemInfo) Index() map[string]string
Index return custom index
func (*SystemInfo) PrimaryKey ¶ added in v1.2.0
func (u *SystemInfo) PrimaryKey() string
PrimaryKey return custom primary key
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) Index ¶ added in v1.2.0
func (d *Target) Index() map[string]string
Index return custom index
func (*Target) PrimaryKey ¶ added in v1.2.0
func (d *Target) PrimaryKey() string
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) 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
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
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