namespace

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate = errors.New("urn and provider pair already exist")
	ErrRelation  = errors.New("provider id does not exist")
)

Functions

This section is empty.

Types

type ConfigSyncer

type ConfigSyncer interface {
	SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error)
}

type EncryptedNamespace

type EncryptedNamespace struct {
	*Namespace
	CredentialString string
}

type Encryptor

type Encryptor interface {
	Encrypt(str secret.MaskableString) (secret.MaskableString, error)
	Decrypt(str secret.MaskableString) (secret.MaskableString, error)
}

type Namespace

type Namespace struct {
	ID          uint64            `json:"id"`
	URN         string            `json:"urn"`
	Name        string            `json:"name"`
	Provider    provider.Provider `json:"provider"`
	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.9

func FromV1beta1Proto(proto *sirenv1beta1.Namespace) Namespace

func (*Namespace) ToV1beta1Proto added in v0.6.9

func (n *Namespace) ToV1beta1Proto() (*sirenv1beta1.Namespace, error)

type NotFoundError

type NotFoundError struct {
	ID uint64
}

func (NotFoundError) Error

func (err NotFoundError) Error() string

type ProviderService

type ProviderService interface {
	Get(ctx context.Context, id uint64) (*provider.Provider, error)
}

type Service

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

Service handles business logic

func NewService

func NewService(cryptoClient Encryptor, repository Repository, providerService ProviderService, registry map[string]ConfigSyncer) *Service

NewService returns secure service struct

func (*Service) Create

func (s *Service) Create(ctx context.Context, ns *Namespace) 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) (*Namespace, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Namespace, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, ns *Namespace) error

type Transactor

type Transactor interface {
	WithTransaction(ctx context.Context) context.Context
	Rollback(ctx context.Context, err error) error
	Commit(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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