cloudery

package
v0.0.0-...-a7c217f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidContext = errors.New("missing or invalid context")
)

Functions

func SaveInstance deprecated

func SaveInstance(inst *instance.Instance, cmd *SaveCmd) error

SaveInstance data into the cloudery matching the instance context.

Deprecated: Use ClouderyService.SaveInstance instead.

Types

type BlockingSubscription

type BlockingSubscription struct {
	Vendor string `json:"vendor,omitempty"`
}

type ClouderyService

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

ClouderyService handle all the Cloudery actions.

func NewService

func NewService(contexts map[string]config.ClouderyConfig) *ClouderyService

NewService instantiate a new ClouderyService.

If contexts arg is nil, nil will be returned.

func (*ClouderyService) BlockingSubscription

func (s *ClouderyService) BlockingSubscription(inst *instance.Instance) (*BlockingSubscription, error)

func (*ClouderyService) SaveInstance

func (s *ClouderyService) SaveInstance(inst *instance.Instance, cmd *SaveCmd) error

SaveInstance data into the cloudery matching the instance context.

type Mock

type Mock struct {
	mock.Mock
}

Mock impelementation of Service.

func NewMock

func NewMock(t *testing.T) *Mock

NewMock instantiates a new Mock.

func (*Mock) BlockingSubscription

func (m *Mock) BlockingSubscription(inst *instance.Instance) (*BlockingSubscription, error)

func (*Mock) SaveInstance

func (m *Mock) SaveInstance(inst *instance.Instance, cmd *SaveCmd) error

SaveInstance mock method.

type NoopService

type NoopService struct{}

NoopService implements Service.

This implem does nothing. It is used when no config is provided.

func (*NoopService) BlockingSubscription

func (s *NoopService) BlockingSubscription(inst *instance.Instance) (*BlockingSubscription, error)

func (*NoopService) SaveInstance

func (s *NoopService) SaveInstance(inst *instance.Instance, cmd *SaveCmd) error

SaveInstance does nothing.

type SaveCmd

type SaveCmd struct {
	Locale     string
	Email      string
	PublicName string
}

type Service

type Service interface {
	SaveInstance(inst *instance.Instance, cmd *SaveCmd) error
	BlockingSubscription(inst *instance.Instance) (*BlockingSubscription, error)
}

Service handle all the interactions with the cloudery

Several implementations exists: - ClouderyService interacts via HTTP - NoopService when no config is setup - Mock for the tests

func Init

func Init(contexts map[string]config.ClouderyConfig) Service

Jump to

Keyboard shortcuts

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