service

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderService

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

ProviderService provides the API for working with clouds. The provider service is a subset of the cloud service, and is used by the provider package to interact with the cloud service. By not exposing the full cloud service, the provider package is not able to modify the cloud entities, only read them.

func NewProviderService

func NewProviderService(st ProviderState) *ProviderService

NewProviderService returns a new service reference wrapping the input state.

func (*ProviderService) Cloud

func (s *ProviderService) Cloud(ctx context.Context, name string) (*cloud.Cloud, error)

Cloud returns the named cloud.

type ProviderState

type ProviderState interface {
	// Cloud returns the cloud with the specified name.
	Cloud(context.Context, string) (*cloud.Cloud, error)

	// WatchCloud returns a new NotifyWatcher watching for changes to the specified cloud.
	WatchCloud(
		ctx context.Context,
		getWatcher func(string, string, changestream.ChangeType) (watcher.NotifyWatcher, error),
		name string,
	) (watcher.NotifyWatcher, error)
}

type Service

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

Service provides the API for working with clouds.

func (*Service) Cloud

func (s *Service) Cloud(ctx context.Context, name string) (*cloud.Cloud, error)

Cloud returns the named cloud.

func (*Service) CreateCloud

func (s *Service) CreateCloud(ctx context.Context, owner user.Name, cloud cloud.Cloud) error

CreateCloud creates the input cloud entity and provides Admin permissions for the owner.

func (*Service) DeleteCloud

func (s *Service) DeleteCloud(ctx context.Context, name string) error

DeleteCloud removes the specified cloud.

func (*Service) ListAll

func (s *Service) ListAll(ctx context.Context) ([]cloud.Cloud, error)

ListAll returns all the clouds.

func (*Service) UpdateCloud

func (s *Service) UpdateCloud(ctx context.Context, cloud cloud.Cloud) error

UpdateCloud updates the specified cloud.

type State

type State interface {
	ProviderState

	// CreateCloud creates the input cloud entity and provides Admin
	// permissions for the owner.
	CreateCloud(ctx context.Context, owner user.Name, cloudUUID string, cloud cloud.Cloud) error

	// UpdateCloud updates the input cloud entity.
	UpdateCloud(context.Context, cloud.Cloud) error

	// DeleteCloud deletes the input cloud entity.
	DeleteCloud(context.Context, string) error

	// ListClouds returns the clouds matching the optional filter.
	ListClouds(context.Context) ([]cloud.Cloud, error)
}

State describes retrieval and persistence methods for storage.

type WatchableProviderService

type WatchableProviderService struct {
	ProviderService
	// contains filtered or unexported fields
}

WatchableProviderService returns a new provider service reference wrapping the input state and watcher factory.

func NewWatchableProviderService

func NewWatchableProviderService(st ProviderState, watcherFactory WatcherFactory) *WatchableProviderService

NewWatchableProviderService returns a new service reference wrapping the input state and watcher factory.

func (*WatchableProviderService) WatchCloud

WatchCloud returns a watcher that observes changes to the specified cloud.

type WatchableService

type WatchableService struct {
	Service
	// contains filtered or unexported fields
}

WatchableService defines a service for interacting with the underlying state and the ability to create watchers.

func NewWatchableService

func NewWatchableService(st State, watcherFactory WatcherFactory) *WatchableService

NewWatchableService returns a new service reference wrapping the input state and watcher factory.

func (*WatchableService) WatchCloud

func (s *WatchableService) WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error)

WatchCloud returns a watcher that observes changes to the specified cloud.

type WatcherFactory

type WatcherFactory interface {
	NewValueWatcher(
		namespace, uuid string, changeMask changestream.ChangeType,
	) (watcher.NotifyWatcher, error)
}

WatcherFactory instances return a watcher for a specified credential UUID,

Jump to

Keyboard shortcuts

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