serviceapi

package
v0.2024.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package serviceapi implements gen.ServiceApi backed by a service.Map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	gen.UnimplementedServicesApiServer
	// contains filtered or unexported fields
}

Api implements a gen.ServicesApiServer backed by service.Map.

func NewApi

func NewApi(m *service.Map, opts ...Option) *Api

func (*Api) ConfigureService

func (a *Api) ConfigureService(ctx context.Context, request *gen.ConfigureServiceRequest) (*gen.Service, error)

func (*Api) CreateService

func (a *Api) CreateService(ctx context.Context, request *gen.CreateServiceRequest) (*gen.Service, error)

func (*Api) DeleteService

func (a *Api) DeleteService(ctx context.Context, request *gen.DeleteServiceRequest) (*gen.Service, error)

func (*Api) GetService

func (a *Api) GetService(_ context.Context, request *gen.GetServiceRequest) (*gen.Service, error)

func (*Api) GetServiceMetadata

func (a *Api) GetServiceMetadata(_ context.Context, request *gen.GetServiceMetadataRequest) (*gen.ServiceMetadata, error)

func (*Api) ListServices

func (a *Api) ListServices(_ context.Context, request *gen.ListServicesRequest) (*gen.ListServicesResponse, error)

func (*Api) PullService

func (a *Api) PullService(request *gen.PullServiceRequest, server gen.ServicesApi_PullServiceServer) error

func (*Api) PullServiceMetadata

func (a *Api) PullServiceMetadata(request *gen.PullServiceMetadataRequest, server gen.ServicesApi_PullServiceMetadataServer) error

func (*Api) PullServices

func (a *Api) PullServices(request *gen.PullServicesRequest, server gen.ServicesApi_PullServicesServer) error

func (*Api) StartService

func (a *Api) StartService(_ context.Context, request *gen.StartServiceRequest) (*gen.Service, error)

func (*Api) StopService

func (a *Api) StopService(_ context.Context, request *gen.StopServiceRequest) (*gen.Service, error)

type Marshaller

type Marshaller interface {
	MarshalConfig([]byte) ([]byte, error)
}

func MarshalArrayConfig

func MarshalArrayConfig(prop string) Marshaller

func MarshalMapConfig

func MarshalMapConfig(prop, key string) Marshaller

type Option

type Option func(a *Api)

func WithKnownTypes

func WithKnownTypes(t ...string) Option

func WithKnownTypesFromMapKeys

func WithKnownTypesFromMapKeys[M ~map[string]T, T any](m M) Option

func WithLogger

func WithLogger(l *zap.Logger) Option

func WithMarshaller

func WithMarshaller(m Marshaller) Option

func WithStore

func WithStore(s Store) Option

type PageToken

type PageToken struct {
	NextId string `json:"n,omitempty"`
}

func DecodePageToken

func DecodePageToken(data string) (PageToken, error)

func (PageToken) Encode

func (p PageToken) Encode() (string, error)

type Store

type Store interface {
	Save(ctx context.Context, path string, data []byte) error
}

type StoreDir

type StoreDir string

func (StoreDir) Save

func (d StoreDir) Save(_ context.Context, path string, data []byte) error

Jump to

Keyboard shortcuts

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