Documentation ¶
Index ¶
- Constants
- type Archive
- type ArchiveListArgs
- type AuthUser
- type Chart
- type ChartDashboard
- type ChartLine
- type ChartMatrixData
- type ChartMetric
- type ChartOption
- type ChartPoint
- type ChartValue
- type ChartVectorData
- type ConfigCreateInfo
- type ConfigInfo
- type ConfigUpdateInfo
- type ContainerListArgs
- type ContainerListInfo
- type Driver
- type EndpointPort
- type Event
- type EventAction
- type EventListArgs
- type EventType
- type ImageListInfo
- type Mount
- type Network
- type NetworkCreateInfo
- type NodeListInfo
- type NodeUpdateInfo
- type Option
- type Options
- type Pager
- type Perm
- type PlacementConstraint
- type PlacementPreference
- type Registry
- type ResourceInfo
- type Role
- type ServiceDetailInfo
- type ServiceInfo
- type ServiceListInfo
- type Session
- type Setting
- type Stack
- type StackListArgs
- type TaskInfo
- type TaskListArgs
- type Template
- type TemplateListArgs
- type User
- type UserListArgs
- type UserStatus
- type UserType
- type VolumeCreateInfo
Constants ¶
View Source
const ( PermNone = 0 PermWrite = 1 PermReadWrite = 2 )
Perm control scope
View Source
const PageSize = 25
PageSize is default page size.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct { ID string `bson:"_id" json:"id,omitempty" bind:"id=path"` Name string `bson:"name" json:"name,omitempty"` Content string `bson:"content" json:"content,omitempty" bind:"content=form,content=file"` CreatedBy string `bson:"created_by" json:"created_by,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedBy string `bson:"updated_by" json:"updated_by,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
type ArchiveListArgs ¶
type AuthUser ¶
type AuthUser struct {
// contains filtered or unexported fields
}
func NewAuthUser ¶
type Chart ¶
type Chart struct { Name string `json:"name" bson:"_id" valid:"required"` // unique, the name of build-in charts has '$' prefix. Title string `json:"title" valid:"required"` Description string `json:"desc"` Legend string `json:"-"` Query string `json:"-"` Metrics []ChartMetric `json:"metrics" valid:"required"` Kind string `json:"kind"` // builtin/custom Dashboard string `json:"dashboard"` // home/service/task... Type string `json:"type"` // pie/line... Unit string `json:"unit"` // bytes/milliseconds/percent:100... Width int32 `json:"width"` // 1-12(12 columns total) Height int32 `json:"height"` // default 50 Options data.Map `json:"options"` }
Chart represents a dashboard chart.
type ChartDashboard ¶
type ChartDashboard struct { Name string `json:"name"` Key string `json:"key"` Period int32 `json:"period"` // minutes RefreshInterval int32 `json:"refresh_interval"` // seconds, 0 means disabled. Charts []ChartOption `json:"charts"` }
func (*ChartDashboard) ID ¶
func (cd *ChartDashboard) ID() string
type ChartLine ¶
type ChartLine struct { Name string `json:"name"` Data []ChartPoint `json:"data"` }
type ChartMatrixData ¶
type ChartMetric ¶ added in v0.8.3
type ChartOption ¶
type ChartPoint ¶
func (*ChartPoint) MarshalJSON ¶
func (p *ChartPoint) MarshalJSON() ([]byte, error)
type ChartValue ¶
type ChartVectorData ¶
type ChartVectorData struct { Legend []string `json:"legend"` Data []ChartValue `json:"data"` }
type ConfigCreateInfo ¶
type ConfigInfo ¶
type ConfigInfo struct { ID string `json:"id"` Name string `json:"name"` FileName string `json:"file_name"` UID string `json:"uid"` GID string `json:"gid"` Mode uint32 `json:"mode"` }
func NewConfigInfo ¶
func NewConfigInfo(ref *swarm.ConfigReference) ConfigInfo
func NewSecretInfo ¶
func NewSecretInfo(ref *swarm.SecretReference) ConfigInfo
func (ConfigInfo) ToConfig ¶
func (ci ConfigInfo) ToConfig() *swarm.ConfigReference
func (ConfigInfo) ToSecret ¶
func (ci ConfigInfo) ToSecret() *swarm.SecretReference
type ConfigUpdateInfo ¶
type ConfigUpdateInfo struct { ID string `json:"id"` Version uint64 `json:"version"` ConfigCreateInfo }
type ContainerListArgs ¶
type ContainerListInfo ¶
func NewContainerListInfo ¶
func NewContainerListInfo(container types.Container) *ContainerListInfo
type EndpointPort ¶
type EndpointPort struct { Name string `json:"name"` Protocol swarm.PortConfigProtocol `json:"protocol"` // TargetPort is the port inside the container TargetPort uint32 `json:"target_port"` // PublishedPort is the port on the swarm hosts PublishedPort uint32 `json:"published_port"` // PublishMode is the mode in which port is published PublishMode swarm.PortConfigPublishMode `json:"publish_mode"` }
type Event ¶
type EventAction ¶
type EventAction string
const ( EventActionLogin EventAction = "Login" //EventActionLogout EventAction = "Logout" 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" )
type EventListArgs ¶
type EventType ¶
type EventType string
const ( EventTypeRegistry EventType = "Registry" EventTypeNode EventType = "Node" EventTypeNetwork EventType = "Network" EventTypeService EventType = "Service" EventTypeServiceTemplate EventType = "Service Template" EventTypeStack EventType = "Stack" EventTypeSecret EventType = "Secret" EventTypeConfig EventType = "Config" EventTypeVolume EventType = "Volume" EventTypeAuthentication EventType = "Authentication" EventTypeRole EventType = "Role" EventTypeUser EventType = "User" EventTypeSetting EventType = "Setting" )
type ImageListInfo ¶
type ImageListInfo struct { types.ImageSummary CreatedAt time.Time }
func NewImageListInfo ¶
func NewImageListInfo(image types.ImageSummary) *ImageListInfo
type NetworkCreateInfo ¶
type NetworkCreateInfo struct { Name string `json:"name"` Driver string `json:"driver"` CustomDriver string `json:"custom_driver"` Internal bool `json:"internal"` Attachable bool IPV4 struct { Subnet string `json:"subnet"` Gateway string `json:"gateway"` IPRange string `json:"ip_range"` } `json:"ipv4"` IPV6 struct { Enabled bool `json:"enabled"` Subnet string `json:"subnet"` Gateway string `json:"gateway"` } `json:"ipv6"` Options Options `json:"options"` Labels Options `json:"labels"` LogDriver struct { Name string `json:"name"` Options Options `json:"options"` } `json:"log_driver"` }
type NodeListInfo ¶
type NodeListInfo struct { ID string Name string Role swarm.NodeRole Version string CPU int64 Memory float32 Address string Status swarm.NodeState Leader bool }
func NewNodeListInfo ¶
func NewNodeListInfo(node swarm.Node) *NodeListInfo
type NodeUpdateInfo ¶
type Pager ¶
type Pager struct { Count int Size int Page int Pages []int Previous int Next int MaxPage int URL func(page int) string }
Pager holds pagination info.
type Perm ¶
type Perm struct { ResType string `json:"res_type"` ResID string `json:"res_id"` Scope int32 `json:"scope"` Roles []string `json:"roles"` Users []string `json:"users"` }
Perm holds permissions of Docker resource.
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 PlacementPreference ¶
type PlacementPreference struct {
Spread string `json:"spread"`
}
type Registry ¶
type Registry struct { ID string `bson:"_id" json:"id,omitempty"` Name string `bson:"name" json:"name,omitempty" valid:"required"` URL string `bson:"url" json:"url,omitempty" valid:"required,url"` Username string `bson:"username" json:"username,omitempty" valid:"required"` Password string `bson:"password" json:"password,omitempty" valid:"required"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
func (*Registry) GetEncodedAuth ¶
type ResourceInfo ¶
func NewResourceInfo ¶
func NewResourceInfo(res *swarm.Resources) ResourceInfo
func (ResourceInfo) IsSet ¶
func (r ResourceInfo) IsSet() bool
func (ResourceInfo) ToResources ¶
func (r ResourceInfo) ToResources() (res *swarm.Resources, err error)
type Role ¶
type Role struct { ID string `bson:"_id" json:"id,omitempty"` Name string `bson:"name" json:"name,omitempty" valid:"required"` Description string `bson:"desc" json:"desc,omitempty"` Perms []string `bson:"perms" json:"perms,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
type ServiceDetailInfo ¶
type ServiceDetailInfo struct { swarm.Service // Name string // Image string // Mode string // Actives uint64 Replicas uint64 // UpdatedAt time.Time Env map[string]string Networks []Network Command string Args string }
func NewServiceDetailInfo ¶
func NewServiceDetailInfo(service swarm.Service) *ServiceDetailInfo
type ServiceInfo ¶
type ServiceInfo struct { Name string `json:"name"` Version uint64 `json:"version"` Registry string `json:"registry"` RegistryURL string `json:"-"` RegistryAuth string `json:"-"` Image string `json:"image"` Mode string `json:"mode"` Replicas uint64 `json:"replicas"` Command string `json:"command"` Args string `json:"args"` Dir string `json:"dir"` User string `json:"user"` Networks []string `json:"networks"` Secrets []ConfigInfo `json:"secrets"` Configs []ConfigInfo `json:"configs"` Environments Options `json:"envs"` ServiceLabels Options `json:"slabels"` ContainerLabels Options `json:"clabels"` Endpoint struct { Mode swarm.ResolutionMode `json:"mode"` Ports []EndpointPort `json:"ports"` } `json:"endpoint"` Mounts []Mount `json:"mounts"` LogDriver struct { Name string `json:"name"` Options Options `json:"options"` } `json:"log_driver"` Placement struct { Constraints []PlacementConstraint `json:"constraints"` Preferences []PlacementPreference `json:"preferences"` } `json:"placement"` UpdatePolicy struct { // Maximum number of tasks updated simultaneously (0 to update all at once), default 1. Parallelism uint64 `json:"parallelism"` // Amount of time between updates. Delay string `json:"delay,omitempty"` // FailureAction is the action to take when an update failures. (“pause”|“continue”|“rollback”) (default “pause”) FailureAction string `json:"failure_action"` // Update order (“start-first”|“stop-first”) (default “stop-first”) Order string `json:"order"` } `json:"update_policy"` RollbackPolicy struct { // Maximum number of tasks updated simultaneously (0 to update all at once), default 1. Parallelism uint64 `json:"parallelism"` // Amount of time between updates. Delay string `json:"delay,omitempty"` // FailureAction is the action to take when an update failures. (“pause”|“continue”) (default “pause”) FailureAction string `json:"failure_action"` // Update order (“start-first”|“stop-first”) (default “stop-first”) Order string `json:"order"` } `json:"rollback_policy"` RestartPolicy struct { // Restart when condition is met (“none”|“on-failure”|“any”) (default “any”) Condition swarm.RestartPolicyCondition `json:"condition"` // Maximum number of restarts before giving up MaxAttempts uint64 `json:"max_attempts"` // Delay between restart attempts Delay string `json:"delay,omitempty"` // Window used to evaluate the restart policy. Window string `json:"window,omitempty"` } `json:"restart_policy"` Resource struct { Limit ResourceInfo `json:"limit"` Reserve ResourceInfo `json:"reserve"` } `json:"resource"` DNS struct { Nameservers string `json:"nameservers,omitempty"` Search string `json:"search,omitempty"` Options string `json:"options,omitempty"` } `json:"dns"` Hostname string `json:"hostname"` Hosts string `json:"hosts"` }
func NewServiceInfo ¶
func NewServiceInfo(service swarm.Service) *ServiceInfo
func (*ServiceInfo) GetDNSConfig ¶
func (si *ServiceInfo) GetDNSConfig() *swarm.DNSConfig
func (*ServiceInfo) Normalize ¶
func (si *ServiceInfo) Normalize()
func (*ServiceInfo) ToServiceSpec ¶
func (si *ServiceInfo) ToServiceSpec() swarm.ServiceSpec
TODO: finish this method
type ServiceListInfo ¶
type ServiceListInfo struct { Name string Image string Mode string Actives uint64 Replicas uint64 Rollback bool UpdatedAt time.Time UpdateStatus string }
func NewServiceListInfo ¶
func NewServiceListInfo(service swarm.Service, actives uint64) *ServiceListInfo
type Setting ¶
type Setting struct { Version string LDAP struct { Enabled bool `bson:"enabled" json:"enabled,omitempty"` Address string `bson:"address" json:"address,omitempty"` Security int32 `bson:"security" json:"security,omitempty"` // 0-None/1-TLS/2-StartTLS //TLSCert string `bson:"tls_cert" json:"tls_cert,omitempty"` // TLS cert //TLSVerify bool `bson:"tls_verify" json:"tls_verify,omitempty"` // Verify cert Authentication int32 `bson:"auth" json:"auth,omitempty"` // 0-Simple/1-Bind BindDN string `bson:"bind_dn" json:"bind_dn,omitempty"` // DN to bind with BindPassword string `bson:"bind_pwd" json:"bind_pwd,omitempty"` // Bind DN password BaseDN string `bson:"base_dn" json:"base_dn,omitempty"` // Base search path for users UserDN string `bson:"user_dn" json:"user_dn,omitempty"` // Template for the DN of the user for simple auth UserFilter string `bson:"user_filter" json:"user_filter,omitempty"` // Search filter for user NameAttr string `bson:"name_attr" json:"name_attr,omitempty"` EmailAttr string `bson:"email_attr" json:"email_attr,omitempty"` } `bson:"ldap" json:"ldap,omitempty"` TimeZone struct { Name string `bson:"name" json:"name,omitempty"` // Asia/Shanghai Offset int32 `bson:"offset" json:"offset,omitempty"` // seconds east of UTC } `bson:"tz" json:"tz,omitempty"` Language string `bson:"lang" json:"lang,omitempty"` Metrics struct { Prometheus string `bson:"prometheus" json:"prometheus"` } `bson:"metrics" json:"metrics"` UpdatedBy string `bson:"updated_by" json:"updated_by,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
Setting represents the options of swirl.
type Stack ¶ added in v0.8.3
type Stack struct { Name string `bson:"_id" json:"name,omitempty"` Content string `bson:"content" json:"content,omitempty" bind:"content=form,content=file"` CreatedBy string `bson:"created_by" json:"created_by,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedBy string `bson:"updated_by" json:"updated_by,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` Services []string `bson:"-" json:"services,omitempty"` Internal bool `bson:"-" json:"internal"` }
type StackListArgs ¶ added in v0.8.3
type TaskListArgs ¶
type Template ¶
type Template struct { ID string `bson:"_id" json:"id,omitempty"` Name string `bson:"name" json:"name,omitempty"` Content string `bson:"content" json:"content,omitempty"` CreatedBy string `bson:"created_by" json:"created_by,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedBy string `bson:"updated_by" json:"updated_by,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
type TemplateListArgs ¶
type User ¶
type User struct { ID string `bson:"_id" json:"id,omitempty"` Name string `bson:"name" json:"name,omitempty" valid:"required"` LoginName string `bson:"login_name" json:"login_name,omitempty" valid:"required"` Password string `bson:"password" json:"password,omitempty"` Salt string `bson:"salt" json:"salt,omitempty"` Email string `bson:"email" json:"email,omitempty" valid:"required"` Admin bool `bson:"admin" json:"admin,omitempty"` Type UserType `bson:"type" json:"type,omitempty"` Status UserStatus `bson:"status" json:"status,omitempty"` Roles []string `bson:"roles" json:"roles,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at,omitempty"` }
type UserListArgs ¶
type UserStatus ¶
type UserStatus int32
const ( // UserStatusBlocked is the status which user is blocked UserStatusBlocked UserStatus = 0 // UserStatusActive is the normal status UserStatusActive UserStatus = 1 )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.