service

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cfg Config, fileWatcher *fsnotify.Watcher, logger log.Logger) (*service.Service, error)

New creates the service's HTTP server.

Types

type APIsConfig

type APIsConfig struct {
	GRPC server.Config `yaml:"grpc" json:"grpc"`
}

func (*APIsConfig) Validate

func (c *APIsConfig) Validate() error

type ClientsConfig

type ClientsConfig struct {
	Storage                StorageConfig     `yaml:"storage" json:"storage"`
	Eventbus               EventBusConfig    `yaml:"eventBus" json:"eventBus"`
	OpenTelemetryCollector otelClient.Config `yaml:"openTelemetryCollector" json:"openTelemetryCollector"`
}

func (*ClientsConfig) Validate

func (c *ClientsConfig) Validate() error

type Config

type Config struct {
	HubID   string        `yaml:"hubID" json:"hubId"`
	Log     log.Config    `yaml:"log" json:"log"`
	APIs    APIsConfig    `yaml:"apis" json:"apis"`
	Clients ClientsConfig `yaml:"clients" json:"clients"`
}

Config provides defaults and enables configuring via env variables.

func (Config) String

func (c Config) String() string

String return string representation of Config

func (*Config) Validate

func (c *Config) Validate() error

type EventBusConfig

type EventBusConfig struct {
	NATS natsClient.ConfigPublisher `yaml:"nats" json:"nats"`
}

func (*EventBusConfig) Validate

func (c *EventBusConfig) Validate() error

type Persistence

type Persistence = interface {
	NewTransaction(ctx context.Context) persistence.PersistenceTx
	Clear(ctx context.Context) error
	Close(ctx context.Context) error
}

type Server

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

Server is an HTTP server for the Service.

func NewServer

func NewServer(ctx context.Context, cfg Config, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider, publisher *publisher.Publisher, grpcOpts ...grpc.ServerOption) (*Server, error)

func (*Server) Close added in v2.5.0

func (s *Server) Close() error

Shutdown ends serving

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the service's GRPC and HTTP server and blocks.

type Service

type Service struct {
	pb.UnimplementedIdentityStoreServer
	// contains filtered or unexported fields
}

Service holds dependencies of IdentityStore.

func NewService

func NewService(persistence Persistence, publisher *publisher.Publisher, ownerClaim, hubID string, logger log.Logger) *Service

func (*Service) AddDevice

func (s *Service) AddDevice(ctx context.Context, request *pb.AddDeviceRequest) (*pb.AddDeviceResponse, error)

AddDevice adds a device to user. It is used by cloud2cloud connector.

func (*Service) DeleteDevices

func (s *Service) DeleteDevices(ctx context.Context, request *pb.DeleteDevicesRequest) (*pb.DeleteDevicesResponse, error)

DeleteDevices removes a devices from user.

func (*Service) GetDevices

func (s *Service) GetDevices(request *pb.GetDevicesRequest, srv pb.IdentityStore_GetDevicesServer) error

GetDevices returns a list of user's devices if the access token is valid.

type StorageConfig

type StorageConfig = config.Config

Jump to

Keyboard shortcuts

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