model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2017 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltEnvironmentRepository added in v0.2.0

type BoltEnvironmentRepository struct {
	// contains filtered or unexported fields
}

func NewEnvironmentRepository added in v0.2.0

func NewEnvironmentRepository(db *bolt.DB) *BoltEnvironmentRepository

func (*BoltEnvironmentRepository) Get added in v0.2.0

func (*BoltEnvironmentRepository) Save added in v0.2.0

type BoltInstanceRepository

type BoltInstanceRepository struct {
	// contains filtered or unexported fields
}

func NewInstanceRepository

func NewInstanceRepository(db *bolt.DB) *BoltInstanceRepository

func (*BoltInstanceRepository) Delete

func (r *BoltInstanceRepository) Delete(id string) error

func (*BoltInstanceRepository) FindAll

func (r *BoltInstanceRepository) FindAll() ([]Instance, error)

func (*BoltInstanceRepository) FindByIPAddress

func (r *BoltInstanceRepository) FindByIPAddress(IPAddress string) (*Instance, error)

func (*BoltInstanceRepository) FindByMACAddress

func (r *BoltInstanceRepository) FindByMACAddress(MACAddress string) (*Instance, error)

func (*BoltInstanceRepository) FindOne

func (r *BoltInstanceRepository) FindOne(id string) (*Instance, error)

func (*BoltInstanceRepository) Save

func (r *BoltInstanceRepository) Save(item *Instance) (*Instance, error)

type CloudInitData added in v0.2.0

type CloudInitData struct {
	UserData string `json:"userData"`
	MetaData string `json:"metaData"`
}

type CloudInitService added in v0.2.0

type CloudInitService interface {
	PreviewCloudInitData(userDataTemplate, metaDataTemplate string) (*CloudInitData, error)
	GetCloudInitDataForClient(ipAddress, userAgent string) (*CloudInitData, error)
}

type CloudInitServiceImpl added in v0.2.0

type CloudInitServiceImpl struct {
	InstanceService    InstanceService
	EnvironmentService EnvironmentService
}

func NewCloudInitService added in v0.2.0

func NewCloudInitService(instanceService InstanceService, environmentService EnvironmentService) *CloudInitServiceImpl

func (*CloudInitServiceImpl) GetCloudInitDataForClient added in v0.2.0

func (c *CloudInitServiceImpl) GetCloudInitDataForClient(ipAddress, userAgent string) (*CloudInitData, error)

func (*CloudInitServiceImpl) PreviewCloudInitData added in v0.2.0

func (c *CloudInitServiceImpl) PreviewCloudInitData(userDataTemplate, metaDataTemplate string) (*CloudInitData, error)

type Environment added in v0.2.0

type Environment struct {
	Config    string    `json:"config" validate:"yaml"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type EnvironmentRepository added in v0.2.0

type EnvironmentRepository interface {
	Get() (*Environment, error)
	Save(item *Environment) (*Environment, error)
}

type EnvironmentService added in v0.2.0

type EnvironmentService interface {
	GetEnvironment() (*Environment, error)
	Update(newItem *Environment) (*Environment, error)
}

type EnvironmentServiceImpl added in v0.2.0

type EnvironmentServiceImpl struct {
	Repository EnvironmentRepository
}

func NewEnvironmentService added in v0.2.0

func NewEnvironmentService(repository EnvironmentRepository, validator *validator.Validate) *EnvironmentServiceImpl

func (*EnvironmentServiceImpl) GetEnvironment added in v0.2.0

func (c *EnvironmentServiceImpl) GetEnvironment() (*Environment, error)

func (*EnvironmentServiceImpl) Update added in v0.2.0

func (c *EnvironmentServiceImpl) Update(newItem *Environment) (*Environment, error)

type Instance

type Instance struct {
	ID          bson.ObjectId `json:"id"`
	Name        string        `json:"name" validate:"required"`
	IPAddress   string        `json:"ipAddress" validate:"required,ip,uniqueIP"`
	MACAddress  string        `json:"macAddress" validate:"required,mac,uniqueMAC"`
	UserData    string        `json:"userData"`
	MetaData    string        `json:"metaData"`
	CreatedAt   time.Time     `json:"createdAt"`
	UpdatedAt   time.Time     `json:"updatedAt"`
	RequestedAt time.Time     `json:"requestedAt"`
	RequestedBy string        `json:"requestedBy"`
}

type InstanceRepository

type InstanceRepository interface {
	FindAll() ([]Instance, error)
	FindOne(id string) (*Instance, error)
	FindByIPAddress(IPAddress string) (*Instance, error)
	FindByMACAddress(MACAddress string) (*Instance, error)
	Save(item *Instance) (*Instance, error)
	Delete(id string) error
}

type InstanceService

type InstanceService interface {
	FindAll() ([]Instance, error)
	FindOne(id string) (*Instance, error)
	FindByIPForUserAgent(ipAddress, userAgent string) (*Instance, error)
	Create(item *Instance) (*Instance, error)
	Update(id string, newItem *Instance) (*Instance, error)
	Delete(id string) error
}

type InstanceServiceImpl

type InstanceServiceImpl struct {
	Repository         InstanceRepository
	EnvironmentService EnvironmentService
}

func NewInstanceService

func NewInstanceService(repository InstanceRepository, validator *validator.Validate) *InstanceServiceImpl

func (*InstanceServiceImpl) Create

func (c *InstanceServiceImpl) Create(item *Instance) (*Instance, error)

func (*InstanceServiceImpl) Delete

func (c *InstanceServiceImpl) Delete(id string) error

func (*InstanceServiceImpl) FindAll

func (c *InstanceServiceImpl) FindAll() ([]Instance, error)

func (*InstanceServiceImpl) FindByIPForUserAgent added in v0.2.0

func (c *InstanceServiceImpl) FindByIPForUserAgent(ipAddress, userAgent string) (*Instance, error)

func (*InstanceServiceImpl) FindOne

func (c *InstanceServiceImpl) FindOne(id string) (*Instance, error)

func (*InstanceServiceImpl) Update

func (c *InstanceServiceImpl) Update(id string, newItem *Instance) (*Instance, error)

Jump to

Keyboard shortcuts

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