provider

package
v0.0.0-...-e105d0e Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationHeader string = "auth.api_key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	ID     uuid.UUID      `json:"id"`
	Name   string         `json:"name"`
	State  ProviderState  `json:"state"`
	Config map[string]any `json:"config"`
}

func (*Provider) GetConfig

func (c *Provider) GetConfig(keys []string) map[string]any

func (*Provider) MergeConfig

func (c *Provider) MergeConfig(kv map[string]any) (err error)

type ProviderState

type ProviderState string
const (
	ProviderStateActive   ProviderState = "active"
	ProviderStateInactive ProviderState = "inactive"
)

func (ProviderState) String

func (s ProviderState) String() string

type Repository

type Repository interface {
	GetAll(context.Context) ([]Provider, error)
	Upsert(context.Context, Provider) (Provider, error)
	GetByID(context.Context, uuid.UUID) (Provider, error)
	GetByName(context.Context, string) (Provider, error)
	DeleteByID(context.Context, uuid.UUID) error
}

type Service

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

func NewService

func NewService(providerRepo Repository) *Service

func (*Service) DeleteByID

func (s *Service) DeleteByID(ctx context.Context, providerID uuid.UUID) error

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context) ([]Provider, error)

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, providerID uuid.UUID) (Provider, error)

func (*Service) GetByName

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

func (*Service) Upsert

func (s *Service) Upsert(ctx context.Context, c Provider) (Provider, error)

Jump to

Keyboard shortcuts

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