provider

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate = errors.New("urn already exist")
)

Functions

This section is empty.

Types

type Filter

type Filter struct {
	URN  string
	Type string
}

type NotFoundError

type NotFoundError struct {
	ID uint64
}

func (NotFoundError) Error

func (err NotFoundError) Error() string

type Provider

type Provider struct {
	ID          uint64            `json:"id"`
	URN         string            `json:"urn"`
	Host        string            `json:"host"`
	Name        string            `json:"name"`
	Type        string            `json:"type"`
	Credentials map[string]any    `json:"credentials"`
	Labels      map[string]string `json:"labels"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
}

func FromV1beta1Proto added in v0.6.7

func FromV1beta1Proto(proto *sirenv1beta1.Provider) Provider

func (*Provider) ToV1beta1Proto added in v0.6.7

func (p *Provider) ToV1beta1Proto() (*sirenv1beta1.Provider, error)

type Repository

type Repository interface {
	List(context.Context, Filter) ([]Provider, error)
	Create(context.Context, *Provider) error
	Get(context.Context, uint64) (*Provider, error)
	Update(context.Context, *Provider) error
	Delete(context.Context, uint64) error
}

type Service

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

Service handles business logic

func NewService

func NewService(repository Repository, supportedProviders []string) *Service

NewService returns repository struct

func (*Service) Create

func (s *Service) Create(ctx context.Context, prov *Provider) error

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id uint64) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id uint64) (*Provider, error)

func (*Service) List

func (s *Service) List(ctx context.Context, flt Filter) ([]Provider, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, prov *Provider) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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