provider

package
v0.5.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TypeCortex string = "cortex"
)

Variables

View Source
var (
	ErrDuplicate = errors.New("urn already exist")
)
View Source
var SupportedTypes = []string{
	TypeCortex,
}

Functions

func IsTypeSupported added in v0.5.0

func IsTypeSupported(providerType string) bool

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]interface{} `json:"credentials"`
	Labels      map[string]string      `json:"labels"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
}

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) *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