types

package
v0.0.0-...-748440e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	ID        string     `json:"id" db:"id" bson:"_id"`
	Name      string     `json:"name" db:"name" bson:"name"`
	Host      string     `json:"host" db:"host" bson:"host"`
	Sort      int        `json:"sort" db:"sort" bson:"sort"`
	CreatedAt *time.Time `json:"created_at" db:"created_at" bson:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at" bson:"updated_at"`
}

type ClusterRepository

type ClusterRepository interface {
	ClusterCreate(ctx context.Context, target *Cluster) error
	ClusterUpdate(ctx context.Context, target *Cluster) error
	ClusterList(ctx context.Context) ([]*Cluster, error)
	ClusterByName(ctx context.Context, name string) (*Cluster, error)
}

type ClusterService

type ClusterService interface {
	ClusterCreate(ctx context.Context, target *Cluster) error
	ClusterUpdate(ctx context.Context, target *Cluster) error
	ClusterList(ctx context.Context) ([]*Cluster, error)
	ClusterByName(ctx context.Context, name string) (*Cluster, error)
}

type Config

type Config struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Data      string    `json:"data"`
	CreatedAt time.Time `json:"created_at"`
}

type ConfigListOption

type ConfigListOption struct {
}

type Deploy

type Deploy struct {
	Mode          string        `json:"mode" bson:"mode"`
	Replicas      uint64        `json:"replicas" bson:"replicas"`
	EndpointMode  string        `json:"endpoint_mode"`
	UpdateConfig  UpdateConfig  `json:"update_config"`
	RestartPolicy RestartPolicy `json:"restart_policy" bson:"restart_policy"`
	Constraints   []string      `json:"constraints" bson:"constraints"`
}

type DeploymentStatus

type DeploymentStatus struct {
	ServiceName       string `json:"-"`
	Image             string `json:"image"`
	Mode              string `json:"mode"`
	AvailableReplicas int    `json:"available_replicas"`
	Replicas          int    `json:"replicas"`
	UpdateState       string `json:"update_state"`
}

DeploymentStatus stores the information about mode and replicas to be used by template

type HealthCheck

type HealthCheck struct {
	ID        string     `json:"id" db:"id" bson:"_id"`
	ClusterID string     `json:"cluster_id" db:"cluster_id" bson:"cluster_id"`
	Name      string     `json:"name" db:"name" bson:"name"`
	URL       string     `json:"url" db:"url"`
	Interval  int        `json:"interval" db:"interval"`
	Timeout   int        `json:"timeout" db:"timeout"`
	Retries   int        `json:"retries" db:"retries"`
	IsEnabled int        `json:"is_enabled" db:"is_enabled"`
	IsHealth  bool       `json:"-" db:"-"`
	CreatedAt *time.Time `json:"created_at" db:"created_at" bson:"created_at"`
	UpdatedAt *time.Time `json:"updated_at" db:"updated_at" bson:"updated_at"`
}

type HealthCheckFilterOptions

type HealthCheckFilterOptions struct {
	ID        string
	ClusterID string
	Name      string
	IsEnabled int
}

type HealthChecker

type HealthChecker interface {
	Create(ctx context.Context, entity *HealthCheck) error
	List(ctx context.Context, opts HealthCheckFilterOptions) ([]*HealthCheck, error)
}

type HealthCheckerRepository

type HealthCheckerRepository interface {
	Insert(ctx context.Context, target *HealthCheck) error
	Update(ctx context.Context, target *HealthCheck) error
	Delete(ctx context.Context, id string) error
	FindOne(ctx context.Context, opts HealthCheckFilterOptions) (*HealthCheck, error)
	Find(ctx context.Context, opts HealthCheckFilterOptions) ([]*HealthCheck, error)
}

type Node

type Node struct {
	ID        string    `json:"id" bson:"_id"`
	ClusterID string    `json:"cluster_id" bson:"cluster_id"`
	Name      string    `json:"name" bson:"name"`
	Host      string    `json:"host" bson:"host"`
	CreatedAt time.Time `json:"created_at" bson:"created_at"`
	UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
}

type NodeListOptions

type NodeListOptions struct {
}

type NodeRepository

type NodeRepository interface {
	Insert(ctx context.Context, target *Node) error
	Update(ctx context.Context, target *Node) error
	Delete(ctx context.Context, id string) error
	Find(ctx context.Context, opts NodeListOptions) ([]*Node, error)
}

type Placement

type Placement struct {
	Constraints map[string]string `json:"name" bson:"constraints"`
}

type PortInfo

type PortInfo struct {
	Target    uint32 `json:"target" bson:"target"`
	Published uint32 `json:"published" bson:"plblished"`
	Protocol  string `json:"protocol" bson:"protocol"`
	Mode      string `json:"mode" bson:"mode"`
}

type RestartPolicy

type RestartPolicy struct {
	Condition   string        `json:"condition" bson:"condition"`
	Delay       time.Duration `json:"delay" bson:"delay"`
	MaxAttempts uint64        `json:"max_attempts" bson:"max_attempts"`
	Window      time.Duration `json:"window" bson:"window"`
}

type Service

type Service struct {
	ID               string             `json:"id" db:"id" bson:"_id"`
	ClusterID        string             `json:"cluster_id" db:"cluster_id" bson:"cluster_id"`
	Name             string             `json:"name" db:"name" bson:"name"`
	Spec             ServiceSpec        `json:"spec" db:"-" bson:"spec"`
	SpecJSON         sqlxTypes.JSONText `json:"-" db:"specJSON" bson:"-"`
	DeploymentStatus DeploymentStatus   `json:"deployment_status" db:"-" bson:"-"`
	CreatedAt        *time.Time         `json:"created_at" db:"created_at" bson:"created_at"`
	UpdatedAt        *time.Time         `json:"updated_at" db:"updated_at" bson:"updated_at"`
}

type ServiceConfig

type ServiceConfig struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

type ServiceFilterOptions

type ServiceFilterOptions struct {
	ClusterID   string
	ServiceID   string
	ServiceName string
}

type ServiceGetOptions

type ServiceGetOptions struct {
	ID   int
	Name string
}

type ServiceLogResult

type ServiceLogResult struct {
	Logs string `json:"logs"`
}

type ServiceRepository

type ServiceRepository interface {
	Insert(ctx context.Context, target *Service) error
	Update(ctx context.Context, target *Service) error
	Delete(ctx context.Context, id string) error
	FindOne(ctx context.Context, opts ServiceFilterOptions) (*Service, error)
	Find(ctx context.Context, opts ServiceFilterOptions) ([]*Service, error)
}

type ServiceSecret

type ServiceSecret struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

type ServiceService

type ServiceService interface {
	DockerClient() *client.Client
	ServiceCreate(ctx context.Context, target *Service) error
	ServiceGetByID(ctx context.Context, id string) (*Service, error)
	ServiceRawByID(ctx context.Context, id string) (*swarm.Service, error)
	ServiceLogsByID(ctx context.Context, id string) (string, error)
	ServiceGetByName(ctx context.Context, name string) (*Service, error)
	ServiceDelete(ctx context.Context, id string) error
	ServiceUpdate(ctx context.Context, target *Service) error
	ServiceStop(ctx context.Context, id string) error
	Redeploy(ctx context.Context, serviceName string) error
	List(ctx context.Context, opts ServiceFilterOptions) ([]*Service, error)
}

type ServiceSpec

type ServiceSpec struct {
	Image        string          `json:"image" db:"-" bson:"image"`
	Ports        []PortInfo      `json:"ports" db:"-" bson:"ports"`
	Volumes      []VolumeInfo    `json:"volumes" db:"-" bson:"volumes"`
	Command      []string        `json:"command" db:"-" bson:"command"`
	Environments []string        `json:"environments" db:"-" bson:"environments"`
	Configs      []ServiceConfig `json:"configs" db:"-" bson:"configs"`
	Secrets      []ServiceSecret `json:"secrets" db:"-" bson:"secrets"`
	Networks     []string        `json:"networks" db:"-" bson:"networks"`
	Deploy       Deploy          `json:"deploy" db:"-" bson:"deploy"`
}

type Task

type Task struct {
	ID     string     `json:"id"`
	Node   string     `json:"node"`
	Slot   int        `json:"slot"`
	Status TaskStatus `json:"status"`
}

type TaskListOption

type TaskListOption struct {
	ServiceID    string
	DesiredState string
}

type TaskService

type TaskService interface {
	DockerClient() *client.Client
	List(ctx context.Context, opts TaskListOption) ([]Task, error)
	Close(ctx context.Context) error
}

type TaskStatus

type TaskStatus struct {
	TimeStamp time.Time `json:"timestamp"`
	State     string    `json:"state"`
	Message   string    `json:"message"`
}

type UpdateConfig

type UpdateConfig struct {
	Parallelism uint64        `json:"parallelism"`
	Order       string        `json:"order"`
	Delay       time.Duration `json:"delay"`
}

type VolumeInfo

type VolumeInfo struct {
	Type     string `json:"type" bson:"type"`
	Source   string `json:"source" bson:"source"`
	Target   string `json:"target" bson:"target"`
	ReadOnly bool   `json:"read_only" bson:"read_only"`
}

Jump to

Keyboard shortcuts

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