biz

package
v0.0.0-...-3567eeb Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceModeReplicated    = "replicated"
	ServiceModeGlobal        = "global"
	ServiceModeReplicatedJob = "replicated-job"
	ServiceModeGlobalJob     = "global-job"
)
View Source
const (
	// UserTypeInternal is internal user of swirl
	UserTypeInternal = "internal"
	// UserTypeLDAP is external user of LDAP
	UserTypeLDAP = "ldap"
)
View Source
const (
	// UserStatusBlocked is the status which user is blocked
	UserStatusBlocked = 0
	// UserStatusActive is the normal status
	UserStatusActive = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig = registry.AuthConfig

type ChartBiz

type ChartBiz interface {
	Search(ctx context.Context, args *dao.ChartSearchArgs) (charts []*dao.Chart, total int, err error)
	Delete(ctx context.Context, id, title string, user web.User) (err error)
	Find(ctx context.Context, id string) (chart *dao.Chart, err error)
	Create(ctx context.Context, chart *dao.Chart, user web.User) (err error)
	Update(ctx context.Context, chart *dao.Chart, user web.User) (err error)
}

func NewChart

func NewChart(d dao.Interface, mb MetricBiz, eb EventBiz) ChartBiz

type Config

type Config struct {
	ID         string       `json:"id"`
	Name       string       `json:"name,omitempty"`
	Version    uint64       `json:"version"`
	Data       string       `json:"data"`
	Labels     data.Options `json:"labels,omitempty"`
	Templating Driver       `json:"templating"`
	CreatedAt  string       `json:"createdAt"`
	UpdatedAt  string       `json:"updatedAt"`
}

type ConfigBiz

type ConfigBiz interface {
	Search(ctx context.Context, name string, pageIndex, pageSize int) (configs []*Config, total int, err error)
	Find(ctx context.Context, id string) (config *Config, raw string, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Create(ctx context.Context, c *Config, user web.User) (err error)
	Update(ctx context.Context, c *Config, user web.User) (err error)
}

func NewConfig

func NewConfig(d *docker.Docker, eb EventBiz) ConfigBiz

type Container

type Container struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Image       string            `json:"image,omitempty"`
	Command     string            `json:"command,omitempty"`
	CreatedAt   string            `json:"createdAt"`
	Ports       []*ContainerPort  `json:"ports,omitempty"`
	SizeRw      int64             `json:"sizeRw"`
	SizeRootFs  int64             `json:"sizeRootFs"`
	Labels      data.Options      `json:"labels"`
	State       string            `json:"state"`
	Status      string            `json:"status"`
	NetworkMode string            `json:"networkMode"`
	Mounts      []*ContainerMount `json:"mounts"`
	PID         int               `json:"pid,omitempty"`
	StartedAt   string            `json:"startedAt,omitempty"`
}

type ContainerBiz

type ContainerBiz interface {
	Search(ctx context.Context, node, name, status string, pageIndex, pageSize int) ([]*Container, int, error)
	Find(ctx context.Context, node, id string) (container *Container, raw string, err error)
	Delete(ctx context.Context, node, id, name string, user web.User) (err error)
	FetchLogs(ctx context.Context, node, id string, lines int, timestamps bool) (stdout, stderr string, err error)
	ExecCreate(ctx context.Context, node, id string, cmd string) (resp IDResponse, err error)
	ExecAttach(ctx context.Context, node, id string) (resp HijackedResponse, err error)
	ExecStart(ctx context.Context, node, id string) error
	Prune(ctx context.Context, node string, user web.User) (count int, size uint64, err error)
}

func NewContainer

func NewContainer(d *docker.Docker, eb EventBiz) ContainerBiz

type ContainerMount

type ContainerMount struct {
	Type        mount.Type        `json:"type,omitempty"`
	Name        string            `json:"name,omitempty"`
	Source      string            `json:"source,omitempty"`
	Destination string            `json:"destination,omitempty"`
	Driver      string            `json:"driver,omitempty"`
	Mode        string            `json:"mode,omitempty"`
	RW          bool              `json:"rw,omitempty"`
	Propagation mount.Propagation `json:"propagation,omitempty"`
}

type ContainerPort

type ContainerPort struct {
	IP          string `json:"ip,omitempty"`
	PrivatePort uint16 `json:"privatePort,omitempty"`
	PublicPort  uint16 `json:"publicPort,omitempty"`
	Type        string `json:"type,omitempty"`
}

type ContainersPruneReport

type ContainersPruneReport = container.PruneReport

type DashboardBiz

type DashboardBiz interface {
	FetchData(ctx context.Context, key string, ids []string, period time.Duration) (data.Map, error)
	FindDashboard(ctx context.Context, name, key string) (dashboard *dao.Dashboard, err error)
	UpdateDashboard(ctx context.Context, dashboard *dao.Dashboard, user web.User) (err error)
}

func NewDashboard

func NewDashboard(d dao.Interface, mb MetricBiz, eb EventBiz) DashboardBiz

type Driver

type Driver struct {
	Name    string       `json:"name"`
	Options data.Options `json:"options,omitempty"`
}

type EndpointPort

type EndpointPort struct {
	Name          string                      `json:"name,omitempty"`
	Protocol      swarm.PortConfigProtocol    `json:"protocol,omitempty"`
	TargetPort    uint32                      `json:"targetPort,omitempty"`
	PublishedPort uint32                      `json:"publishedPort,omitempty"`
	PublishMode   swarm.PortConfigPublishMode `json:"mode,omitempty"`
}

EndpointPort represents the config of a port.

type EndpointVIP

type EndpointVIP struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	IP   string `json:"ip,omitempty"`
}

EndpointVIP represents the virtual ip of a port.

type EventAction

type EventAction string
const (
	EventActionLogin      EventAction = "Login"
	EventActionCreate     EventAction = "Create"
	EventActionDelete     EventAction = "Delete"
	EventActionUpdate     EventAction = "Update"
	EventActionScale      EventAction = "Scale"
	EventActionRollback   EventAction = "Rollback"
	EventActionRestart    EventAction = "Restart"
	EventActionDisconnect EventAction = "Disconnect"
	EventActionDeploy     EventAction = "Deploy"
	EventActionShutdown   EventAction = "Shutdown"
	EventActionPrune      EventAction = "Prune"
)

type EventBiz

type EventBiz interface {
	Search(ctx context.Context, args *dao.EventSearchArgs) (events []*dao.Event, total int, err error)
	Prune(ctx context.Context, days int32) (err error)
	CreateRegistry(action EventAction, id, name string, user web.User)
	CreateNode(action EventAction, id, name string, user web.User)
	CreateNetwork(action EventAction, id, name string, user web.User)
	CreateService(action EventAction, name string, user web.User)
	CreateConfig(action EventAction, id, name string, user web.User)
	CreateSecret(action EventAction, id, name string, user web.User)
	CreateStack(action EventAction, name string, user web.User)
	CreateImage(action EventAction, node, id string, user web.User)
	CreateContainer(action EventAction, node, id, name string, user web.User)
	CreateVolume(action EventAction, node, name string, user web.User)
	CreateUser(action EventAction, id, name string, user web.User)
	CreateRole(action EventAction, id, name string, user web.User)
	CreateChart(action EventAction, id, title string, user web.User)
	CreateSetting(action EventAction, user web.User)
}

func NewEvent

func NewEvent(d dao.Interface) EventBiz

type EventType

type EventType string
const (
	EventTypeRegistry  EventType = "Registry"
	EventTypeNode      EventType = "Node"
	EventTypeNetwork   EventType = "Network"
	EventTypeService   EventType = "Service"
	EventTypeStack     EventType = "Stack"
	EventTypeConfig    EventType = "Config"
	EventTypeSecret    EventType = "Secret"
	EventTypeImage     EventType = "Image"
	EventTypeContainer EventType = "Container"
	EventTypeVolume    EventType = "Volume"
	EventTypeUser      EventType = "User"
	EventTypeRole      EventType = "Role"
	EventTypeChart     EventType = "Chart"
	EventTypeSetting   EventType = "Setting"
)

type HijackedResponse

type HijackedResponse = types.HijackedResponse

type IDResponse

type IDResponse = container.ExecCreateResponse

type IPAMConfig

type IPAMConfig struct {
	Subnet  string `json:"subnet,omitempty"`
	Gateway string `json:"gateway,omitempty"`
	Range   string `json:"range,omitempty"`
}

type Image

type Image struct {
	/* Summary */
	ID          string       `json:"id"`
	ParentID    string       `json:"pid,omitempty"`
	Created     string       `json:"created"`
	Containers  int64        `json:"containers"`
	Digests     []string     `json:"digests"`
	Tags        []string     `json:"tags"`
	Labels      data.Options `json:"labels"`
	Size        int64        `json:"size"`
	SharedSize  int64        `json:"sharedSize"`
	VirtualSize int64        `json:"virtualSize"`

	/* Detail */
	Comment       string           `json:"comment,omitempty"`
	Container     string           `json:"container,omitempty"`
	DockerVersion string           `json:"dockerVersion,omitempty"`
	Author        string           `json:"author,omitempty"`
	Architecture  string           `json:"arch,omitempty"`
	Variant       string           `json:"variant,omitempty"`
	OS            string           `json:"os,omitempty"`
	OSVersion     string           `json:"osVersion,omitempty"`
	GraphDriver   ImageGraphDriver `json:"graphDriver"`
	RootFS        ImageRootFS      `json:"rootFS"`
	LastTagTime   string           `json:"lastTagTime,omitempty"`
	Histories     []*ImageHistory  `json:"histories,omitempty"`
}

type ImageBiz

type ImageBiz interface {
	Search(ctx context.Context, node, name string, pageIndex, pageSize int) ([]*Image, int, error)
	Find(ctx context.Context, node, name string) (image *Image, raw string, err error)
	Delete(ctx context.Context, node, id string, user web.User) (err error)
	Prune(ctx context.Context, node string, user web.User) (count int, size uint64, err error)
}

func NewImage

func NewImage(d *docker.Docker, eb EventBiz) ImageBiz

type ImageGraphDriver

type ImageGraphDriver struct {
	Name string       `json:"name,omitempty"`
	Data data.Options `json:"data,omitempty"`
}

type ImageHistory

type ImageHistory struct {
	ID        string   `json:"id,omitempty"`
	Comment   string   `json:"comment,omitempty"`
	Size      int64    `json:"size,omitempty"`
	Tags      []string `json:"tags,omitempty"`
	CreatedAt string   `json:"createdAt,omitempty"`
	CreatedBy string   `json:"createdBy,omitempty"`
}

type ImageInspect

type ImageInspect = image.InspectResponse

type ImageRootFS

type ImageRootFS struct {
	Type      string   `json:"type"`
	Layers    []string `json:"layers,omitempty"`
	BaseLayer string   `json:"baseLayer,omitempty"`
}

type ImageSummary

type ImageSummary = image.Summary

type ImagesPruneReport

type ImagesPruneReport = image.PruneReport

type MatrixData

type MatrixData struct {
	Legend []string     `json:"legend"`
	Series []MatrixLine `json:"series"`
}

type MatrixLine

type MatrixLine struct {
	Name string        `json:"name"`
	Data []MatrixPoint `json:"data"`
}

type MatrixPoint

type MatrixPoint struct {
	X int64   `json:"x"`
	Y float64 `json:"y"`
}

func (*MatrixPoint) MarshalJSON

func (p *MatrixPoint) MarshalJSON() ([]byte, error)

type MetricBiz

type MetricBiz interface {
	Enabled() bool
	GetMatrix(ctx context.Context, query, legend string, start, end time.Time) (data *MatrixData, err error)
	GetScalar(ctx context.Context, query string, t time.Time) (data float64, err error)
	GetVector(ctx context.Context, query, label string, t time.Time) (data *VectorData, err error)
}

func NewMetric

func NewMetric(setting *misc.Setting) MetricBiz

type Mount

type Mount struct {
	Type        mount.Type        `json:"type,omitempty"`
	Source      string            `json:"source,omitempty"`
	Target      string            `json:"target,omitempty"`
	Readonly    bool              `json:"readonly,omitempty"`
	Consistency mount.Consistency `json:"consistency,omitempty"`
}

Mount represents a mount (volume).

type Network

type Network struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Created    string `json:"created"`
	Driver     string `json:"driver"`
	Scope      string `json:"scope"`
	Internal   bool   `json:"internal"`
	Attachable bool   `json:"attachable"`
	Ingress    bool   `json:"ingress"`
	IPv6       bool   `json:"ipv6"`
	IPAM       struct {
		Driver  string        `json:"driver"`
		Options data.Options  `json:"options"`
		Config  []*IPAMConfig `json:"config"`
	} `json:"ipam"`
	Options    data.Options        `json:"options"`
	Labels     data.Options        `json:"labels"`
	Containers []*NetworkContainer `json:"containers"`
}

type NetworkBiz

type NetworkBiz interface {
	Search(ctx context.Context) ([]*Network, error)
	Find(ctx context.Context, name string) (network *Network, raw string, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Create(ctx context.Context, n *Network, user web.User) (err error)
	Disconnect(ctx context.Context, networkId, networkName, container string, user web.User) (err error)
}

func NewNetwork

func NewNetwork(d *docker.Docker, eb EventBiz) NetworkBiz

type NetworkContainer

type NetworkContainer struct {
	ID   string `json:"id"`   // container id
	Name string `json:"name"` // container name
	Mac  string `json:"mac"`  // mac address
	IPv4 string `json:"ipv4"` // IPv4 address
	IPv6 string `json:"ipv6"` // IPv6 address
}

type NetworkCreate

type NetworkCreate = network.CreateRequest

type NetworkResource

type NetworkResource = network.Inspect

type Node

type Node struct {
	ID            string                 `json:"id"`
	Name          string                 `json:"name,omitempty"`
	Hostname      string                 `json:"hostname"`
	Version       uint64                 `json:"version"`
	Role          swarm.NodeRole         `json:"role"`
	Availability  swarm.NodeAvailability `json:"availability"`
	EngineVersion string                 `json:"engineVersion"`
	Architecture  string                 `json:"arch"`
	OS            string                 `json:"os"`
	CPU           int64                  `json:"cpu"`
	Memory        float32                `json:"memory"`
	Address       string                 `json:"address"`
	State         swarm.NodeState        `json:"state"`
	Manager       *NodeManager           `json:"manager,omitempty"`
	Labels        data.Options           `json:"labels,omitempty"`
	CreatedAt     string                 `json:"createdAt"`
	UpdatedAt     string                 `json:"updatedAt"`
}

type NodeBiz

type NodeBiz interface {
	List(agent bool) ([]*docker.Node, error)
	Search(ctx context.Context) ([]*Node, error)
	Find(ctx context.Context, id string) (node *Node, raw string, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Update(ctx context.Context, n *Node, user web.User) (err error)
}

func NewNode

func NewNode(d *docker.Docker, eb EventBiz) NodeBiz

type NodeManager

type NodeManager struct {
	Leader       bool               `json:"leader,omitempty"`
	Reachability swarm.Reachability `json:"reachability,omitempty"`
	Addr         string             `json:"addr,omitempty"`
}

type PlacementConstraint

type PlacementConstraint struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Operator string `json:"op"`
}

func NewPlacementConstraint

func NewPlacementConstraint(c string) PlacementConstraint

func (*PlacementConstraint) ToConstraint

func (pc *PlacementConstraint) ToConstraint() string

type RegistryBiz

type RegistryBiz interface {
	Search(ctx context.Context) ([]*dao.Registry, error)
	Find(ctx context.Context, id string) (*dao.Registry, error)
	GetAuth(ctx context.Context, url string) (auth string, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Create(ctx context.Context, registry *dao.Registry, user web.User) (err error)
	Update(ctx context.Context, registry *dao.Registry, user web.User) (err error)
}

func NewRegistry

func NewRegistry(d dao.Interface, eb EventBiz) RegistryBiz

type RestartPolicy

type RestartPolicy struct {
	Condition   swarm.RestartPolicyCondition `json:"condition,omitempty"`
	Delay       string                       `json:"delay,omitempty"`
	MaxAttempts uint64                       `json:"maxAttempts,omitempty"`
	Window      string                       `json:"window,omitempty"`
}

func (*RestartPolicy) Convert

func (p *RestartPolicy) Convert() *swarm.RestartPolicy

type RoleBiz

type RoleBiz interface {
	Search(ctx context.Context, name string) ([]*dao.Role, error)
	Find(ctx context.Context, id string) (role *dao.Role, err error)
	Create(ctx context.Context, role *dao.Role, user web.User) (err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Update(ctx context.Context, r *dao.Role, user web.User) (err error)
	GetPerms(ctx context.Context, ids []string) ([]string, error)
}

func NewRole

func NewRole(d dao.Interface, eb EventBiz) RoleBiz

type Secret

type Secret struct {
	ID         string       `json:"id"`
	Name       string       `json:"name,omitempty"`
	Version    uint64       `json:"version"`
	Data       string       `json:"data"`
	Labels     data.Options `json:"labels,omitempty"`
	Driver     Driver       `json:"driver"`
	Templating Driver       `json:"templating"`
	CreatedAt  string       `json:"createdAt"`
	UpdatedAt  string       `json:"updatedAt"`
}

type SecretBiz

type SecretBiz interface {
	Search(ctx context.Context, name string, pageIndex, pageSize int) (secrets []*Secret, total int, err error)
	Find(ctx context.Context, id string) (secret *Secret, raw string, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	Create(ctx context.Context, secret *Secret, user web.User) (err error)
	Update(ctx context.Context, secret *Secret, user web.User) (err error)
}

func NewSecret

func NewSecret(d *docker.Docker, eb EventBiz) SecretBiz

type Service

type Service struct {
	ServiceBase
	ID              string       `json:"id"`
	Version         uint64       `json:"version"`
	Command         string       `json:"command"`
	Args            string       `json:"args"`
	Dir             string       `json:"dir"`
	User            string       `json:"user"`
	Hostname        string       `json:"hostname"`
	Env             data.Options `json:"env,omitempty"`
	Labels          data.Options `json:"labels,omitempty"`
	ContainerLabels data.Options `json:"containerLabels,omitempty"`
	Networks        []string     `json:"networks,omitempty"` // only for edit
	Mounts          []Mount      `json:"mounts,omitempty"`
	Update          struct {
		State   string `json:"state,omitempty"`
		Message string `json:"message,omitempty"`
	} `json:"update,omitempty"`
	Endpoint struct {
		Mode  swarm.ResolutionMode `json:"mode,omitempty"`
		Ports []EndpointPort       `json:"ports,omitempty"`
		VIPs  []EndpointVIP        `json:"vips,omitempty"`
	} `json:"endpoint"`
	Configs        []*ServiceFile `json:"configs"`
	Secrets        []*ServiceFile `json:"secrets"`
	UpdatePolicy   UpdatePolicy   `json:"updatePolicy"`
	RollbackPolicy UpdatePolicy   `json:"rollbackPolicy"`
	RestartPolicy  RestartPolicy  `json:"restartPolicy"`
	Resource       struct {
		Limit   ServiceResource `json:"limit"`
		Reserve ServiceResource `json:"reserve"`
	} `json:"resource"`
	Placement struct {
		Constraints []PlacementConstraint `json:"constraints"`
		Preferences []string              `json:"preferences"`
	} `json:"placement"`
	LogDriver struct {
		Name    string       `json:"name"`
		Options data.Options `json:"options"`
	} `json:"logDriver"`
	DNS struct {
		Servers []string `json:"servers"`
		Search  []string `json:"search"`
		Options []string `json:"options"`
	} `json:"dns"`
	Hosts []string `json:"hosts"`
}

func (*Service) MergeTo

func (s *Service) MergeTo(spec *swarm.ServiceSpec) (err error)

type ServiceBase

type ServiceBase struct {
	Name           string `json:"name"`
	Image          string `json:"image"`
	Mode           string `json:"mode"`
	Replicas       uint64 `json:"replicas"`
	DesiredTasks   uint64 `json:"desiredTasks"`
	RunningTasks   uint64 `json:"runningTasks"`
	CompletedTasks uint64 `json:"completedTasks"`
	CreatedAt      string `json:"createdAt"`
	UpdatedAt      string `json:"updatedAt"`
}

type ServiceBiz

type ServiceBiz interface {
	Search(ctx context.Context, name, mode string, pageIndex, pageSize int) (services []*ServiceBase, total int, err error)
	Find(ctx context.Context, name string, status bool) (service *Service, raw string, err error)
	Delete(ctx context.Context, name string, user web.User) (err error)
	Rollback(ctx context.Context, name string, user web.User) (err error)
	Restart(ctx context.Context, name string, user web.User) (err error)
	Scale(ctx context.Context, name string, count, version uint64, user web.User) (err error)
	Create(ctx context.Context, s *Service, user web.User) (err error)
	Update(ctx context.Context, s *Service, user web.User) (err error)
	FetchLogs(ctx context.Context, name string, lines int, timestamps bool) (stdout, stderr string, err error)
}

func NewService

func NewService(d *docker.Docker, rb RegistryBiz, eb EventBiz) ServiceBiz

type ServiceFile

type ServiceFile struct {
	//ID   string      `json:"id"`
	//Name string      `json:"name"`
	Key  string `json:"key"` // ID:Name
	Path string `json:"path"`
	GID  string `json:"gid"`
	UID  string `json:"uid"`
	Mode uint32 `json:"mode"`
}

func (*ServiceFile) ToConfig

func (f *ServiceFile) ToConfig() *swarm.ConfigReference

func (*ServiceFile) ToSecret

func (f *ServiceFile) ToSecret() *swarm.SecretReference

type ServiceResource

type ServiceResource struct {
	CPU    float64 `json:"cpu,omitempty"`
	Memory string  `json:"memory,omitempty"`
}

func (ServiceResource) IsSet

func (r ServiceResource) IsSet() bool

func (ServiceResource) ToLimit

func (r ServiceResource) ToLimit() (res *swarm.Limit, err error)

func (ServiceResource) ToResources

func (r ServiceResource) ToResources() (res *swarm.Resources, err error)

type SessionBiz

type SessionBiz interface {
	Find(ctx context.Context, token string) (session *dao.Session, err error)
	Create(ctx context.Context, session *dao.Session) (err error)
	Update(ctx context.Context, session *dao.Session) (err error)
	UpdateExpiry(ctx context.Context, id string, expiry time.Time) (err error)
}

func NewSession

func NewSession(d dao.Interface, rb RoleBiz) SessionBiz

type SettingBiz

type SettingBiz interface {
	Find(ctx context.Context, id string) (options interface{}, err error)
	Load(ctx context.Context) (options data.Map, err error)
	Save(ctx context.Context, id string, options interface{}, user web.User) (err error)
}

func NewSetting

func NewSetting(d dao.Interface, eb EventBiz) SettingBiz

type StackBiz

type StackBiz interface {
	Search(ctx context.Context, name, filter string) (stacks []*dao.Stack, err error)
	Find(ctx context.Context, name string) (stack *dao.Stack, err error)
	Delete(ctx context.Context, name string, user web.User) (err error)
	Shutdown(ctx context.Context, name string, user web.User) (err error)
	Deploy(ctx context.Context, name string, user web.User) (err error)
	Create(ctx context.Context, s *dao.Stack, user web.User) (err error)
	Update(ctx context.Context, s *dao.Stack, user web.User) (err error)
}

func NewStack

func NewStack(d *docker.Docker, s dao.Interface, eb EventBiz) StackBiz

type SystemBiz

type SystemBiz interface {
	Init(ctx context.Context) (err error)
	CheckState(ctx context.Context) (state *SystemState, err error)
}

func NewSystem

func NewSystem(d dao.Interface, ub UserBiz, sb SettingBiz, s *misc.Setting) SystemBiz

type SystemState

type SystemState struct {
	Fresh bool `json:"fresh"`
}

type Task

type Task struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Version     uint64          `json:"version"`
	Image       string          `json:"image"`
	Slot        int             `json:"slot"`
	State       swarm.TaskState `json:"state"`
	ServiceID   string          `json:"serviceId"`
	ServiceName string          `json:"serviceName"`
	NodeID      string          `json:"nodeId"`
	NodeName    string          `json:"nodeName"`
	ContainerID string          `json:"containerId"`
	PID         int             `json:"pid"`
	ExitCode    int             `json:"exitCode"`
	Message     string          `json:"message"`
	Error       string          `json:"error"`
	Env         data.Options    `json:"env,omitempty"`
	Labels      data.Options    `json:"labels,omitempty"`
	Networks    []TaskNetwork   `json:"networks"`
	CreatedAt   string          `json:"createdAt"`
	UpdatedAt   string          `json:"updatedAt"`
}

type TaskBiz

type TaskBiz interface {
	Search(ctx context.Context, node, service, mode string, pageIndex, pageSize int) (tasks []*Task, total int, err error)
	Find(ctx context.Context, id string) (task *Task, raw string, err error)
	FetchLogs(ctx context.Context, id string, lines int, timestamps bool) (stdout, stderr string, err error)
}

func NewTask

func NewTask(d *docker.Docker) TaskBiz

type TaskNetwork

type TaskNetwork struct {
	ID   string   `json:"id"`
	Name string   `json:"name"`
	IPs  []string `json:"ips"`
}

type UpdatePolicy

type UpdatePolicy struct {
	Parallelism   uint64 `json:"parallelism,omitempty"`
	Delay         string `json:"delay,omitempty"`
	FailureAction string `json:"failureAction,omitempty"`
	Order         string `json:"order,omitempty"`
}

func (*UpdatePolicy) Convert

func (p *UpdatePolicy) Convert() *swarm.UpdateConfig

type UserBiz

type UserBiz interface {
	Search(ctx context.Context, name, loginName, filter string, pageIndex, pageSize int) (users []*dao.User, total int, err error)
	Create(ctx context.Context, user *dao.User, ctxUser web.User) (id string, err error)
	Update(ctx context.Context, user *dao.User, ctxUser web.User) (err error)
	FindByID(ctx context.Context, id string) (user *dao.User, err error)
	FindByName(ctx context.Context, loginName string) (user *dao.User, err error)
	FindByToken(ctx context.Context, token string) (user *dao.User, err error)
	FindPrivacy(ctx context.Context, loginName string) (privacy *UserPrivacy, err error)
	Count(ctx context.Context) (count int, err error)
	Delete(ctx context.Context, id, name string, user web.User) (err error)
	SetStatus(ctx context.Context, id string, status int32, user web.User) (err error)
	ModifyPassword(ctx context.Context, oldPwd, newPwd string, user web.User) (err error)
	ModifyProfile(ctx context.Context, user *dao.User, ctxUser web.User) (err error)
}

func NewUser

func NewUser(d dao.Interface, eb EventBiz) UserBiz

type UserPrivacy

type UserPrivacy struct {
	ID       string
	Name     string
	Password string `json:"-"`
	Salt     string `json:"-"`
	Type     string
	Status   int32
}

type VectorData

type VectorData struct {
	Legend []string      `json:"legend"`
	Data   []VectorValue `json:"data"`
}

type VectorValue

type VectorValue struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

type Volume

type Volume struct {
	Node         string                 `json:"node"`
	Name         string                 `json:"name"`
	Driver       string                 `json:"driver,omitempty"`
	CustomDriver string                 `json:"customDriver,omitempty"`
	CreatedAt    string                 `json:"createdAt"`
	MountPoint   string                 `json:"mountPoint,omitempty"`
	Scope        string                 `json:"scope"`
	Labels       data.Options           `json:"labels,omitempty"`
	Options      data.Options           `json:"options,omitempty"`
	Status       map[string]interface{} `json:"status,omitempty"`
	RefCount     int64                  `json:"refCount"`
	Size         int64                  `json:"size"`
}

type VolumeBiz

type VolumeBiz interface {
	Search(ctx context.Context, node, name string, pageIndex, pageSize int) ([]*Volume, int, error)
	Find(ctx context.Context, node, name string) (volume *Volume, raw string, err error)
	Delete(ctx context.Context, node, name string, user web.User) (err error)
	Create(ctx context.Context, volume *Volume, user web.User) (err error)
	Prune(ctx context.Context, node string, user web.User) (count int, size uint64, err error)
}

func NewVolume

func NewVolume(d *docker.Docker, eb EventBiz) VolumeBiz

type VolumeType

type VolumeType = volume.Volume

type VolumesPruneReport

type VolumesPruneReport = volume.PruneReport

Source Files

  • biz.go
  • chart.go
  • config.go
  • container.go
  • dashboard.go
  • event.go
  • image.go
  • metric.go
  • network.go
  • node.go
  • registry.go
  • role.go
  • secret.go
  • service.go
  • session.go
  • setting.go
  • stack.go
  • system.go
  • task.go
  • user.go
  • volume.go

Jump to

Keyboard shortcuts

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