service

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware func(Service) Service

Middleware describes a service middleware.

func NewInstrumentingService

func NewInstrumentingService(duration metrics.Histogram) Middleware

NewInstrumentingService returns a new instance of an instrumented Service. It used for business-domain instrumenting.

func NewLoggingService

func NewLoggingService(logger log.Logger) Middleware

NewLoggingService returns a new instance of a logging Service. It used for business-domain logging.

type Service

type Service interface {
	GetConfig() *config.Config

	// Info returns some info about the Service
	Info() (string, string)

	// Healthz is a liveness probe
	Healthz() bool

	// Readyz is a readyness probe
	Readyz() bool

	// VMList returns list of VMs
	VMList(context.Context, *types.VMListParams) (map[string]string, error)

	// VMInfo provide summary information about VM
	VMInfo(context.Context, *types.VMInfoParams) (*types.VMSummary, error)

	// VMDelete destroys a Virtual Machine
	VMDelete(context.Context, *types.VMDeleteParams) error

	// VMFind find VM by path and return its UUID
	VMFind(context.Context, *types.VMFindParams) (*types.VMFound, error)

	// VMDeploy create VM from OVA file
	VMDeploy(context.Context, *types.VMDeployParams) (string, error)

	// VMSnapshotsList returns VM snapshots list
	VMSnapshotsList(context.Context, *types.VMSnapshotsListParams) ([]types.Snapshot, error)

	// VMSnapshotCreate creates a VM snapshot
	VMSnapshotCreate(context.Context, *types.SnapshotCreateParams) (int32, error)

	// VMRestoreFromSnapshot creates a VM snapshot
	VMRestoreFromSnapshot(context.Context, *types.VMRestoreFromSnapshotParams) error

	// VMSnapshotDelete deletes snapshot
	VMSnapshotDelete(context.Context, *types.VMSnapshotDeleteParams) error

	VMRolesList(context.Context, *types.VMRolesListParams) ([]types.Role, error)

	VMAddRole(context.Context, *types.VMAddRoleParams) error

	RoleList(context.Context) ([]types.Role, error)

	TaskInfo(context.Context, string) (map[string]interface{}, error)

	// Reads Open API spec file
	OpenAPI(context.Context) ([]byte, error)
}

Service is the interface that represents methods of the business logic

func New

func New(
	logger log.Logger,
	cfg *config.Config,
	client *vim25.Client,
	duration metrics.Histogram,
	statuses Statuser,
) Service

New creates a new instance of the Service with wrapped middlewares

func NewSimpleService

func NewSimpleService(
	logger log.Logger,
	cfg *config.Config,
	client *vim25.Client,
	statuses Statuser,
) Service

NewSimpleService creates a new instance of the Service with minimal preconfigured options

type Statuser

type Statuser interface {
	NewTask() TaskStatuser
	FindByID(id string) TaskStatuser
}

Statuser represents behavior of storage that keeps statuses nolint: misspell

type TaskStatuser added in v0.5.0

type TaskStatuser interface {
	ID() string
	Str(keyvals ...string) TaskStatuser
	StrArr(key string, arr []string) TaskStatuser
	Get() (statuses map[string]interface{})
}

TaskStatuser represents behavior of every single task

Jump to

Keyboard shortcuts

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