service

package
v0.0.0-...-3db0577 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CachedServices map[string]SwarmService

CachedServices stores the information about services processed by the system

Functions

This section is empty.

Types

type Notification

type Notification struct {
	CreateServiceAddr []string
	RemoveServiceAddr []string
}

Notification defines the structure with exported functions

func NewNotificationFromEnv

func NewNotificationFromEnv() *Notification

NewNotificationFromEnv returns `notification` instance

func (*Notification) ServicesCreate

func (m *Notification) ServicesCreate(services *[]SwarmService, retries, interval int) error

ServicesCreate sends create service notifications

func (*Notification) ServicesRemove

func (m *Notification) ServicesRemove(remove *[]string, retries, interval int) error

ServicesRemove sends remove service notifications

type Sender

type Sender interface {
	ServicesCreate(services *[]SwarmService, retries, interval int) error
	ServicesRemove(services *[]string, retries, interval int) error
}

Sender defines mandatory functions for sending notifications

type Service

type Service struct {
	Host                 string
	ServiceLastUpdatedAt time.Time
	DockerClient         *client.Client
}

Service defines the based structure

func NewService

func NewService(host string) *Service

NewService returns a new instance of the `Service` structure

func NewServiceFromEnv

func NewServiceFromEnv() *Service

NewServiceFromEnv returns a new instance of the `Service` structure using environment variable `DF_DOCKER_HOST` for the host

func (*Service) GetNewServices

func (m *Service) GetNewServices(services *[]SwarmService) (*[]SwarmService, error)

GetNewServices returns services that were not processed previously

func (*Service) GetRemovedServices

func (m *Service) GetRemovedServices(services *[]SwarmService) *[]string

GetRemovedServices returns services that were removed from the cluster

func (*Service) GetServices

func (m *Service) GetServices() (*[]SwarmService, error)

GetServices returns all services running in the cluster

func (*Service) GetServicesParameters

func (m *Service) GetServicesParameters(services *[]SwarmService) *[]map[string]string

GetServicesParameters returns parameters extracted from labels associated with input services

type Servicer

type Servicer interface {
	GetServices() (*[]SwarmService, error)
	GetNewServices(services *[]SwarmService) (*[]SwarmService, error)
	GetRemovedServices(services *[]SwarmService) *[]string
	GetServicesParameters(services *[]SwarmService) *[]map[string]string
}

Servicer defines interface with mandatory methods

type SwarmService

type SwarmService struct {
	swarm.Service
}

SwarmService defines internal structure with service information

Jump to

Keyboard shortcuts

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