servicedata

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDetail = errors.New("invalid service data detail")
	ErrConflict      = errors.New("key already exist")
	ErrNotExist      = errors.New("service data not exist")
	ErrLogActivity   = errors.New("error while logging activity")
)

Functions

This section is empty.

Types

type ActivityService added in v0.6.26

type ActivityService interface {
	Log(ctx context.Context, action string, actor activity.Actor, data any) error
}

type Filter added in v0.6.22

type Filter struct {
	ID        string
	Namespace string
	Entities  []string
	EntityIDs [][]string
	Project   string
}

type Key

type Key struct {
	ID          string
	URN         string
	ProjectID   string
	ProjectSlug string
	Key         string
	Description string
	ResourceID  string
}

func (Key) CreateURN

func (key Key) CreateURN() string

func (Key) ToKeyLogData added in v0.6.26

func (key Key) ToKeyLogData() KeyLogData

type KeyLogData added in v0.6.26

type KeyLogData struct {
	Entity      string `mapstructure:"entity"`
	URN         string `mapstructure:"urn"`
	ProjectSlug string `mapstructure:"project_slug"`
	Key         string `mapstructure:"key"`
	Description string `mapstructure:"description"`
}

type ProjectService

type ProjectService interface {
	Get(ctx context.Context, idOrSlug string) (project.Project, error)
}

type RelationService

type RelationService interface {
	Create(ctx context.Context, rel relation.RelationV2) (relation.RelationV2, error)
	CheckPermission(ctx context.Context, usr user.User, resourceNS namespace.Namespace, resourceIdxa string, action action.Action) (bool, error)
	LookupResources(ctx context.Context, resourceType, permission, subjectType, subjectID string) ([]string, error)
}

type Repository

type Repository interface {
	Transactor
	CreateKey(ctx context.Context, key Key) (Key, error)
	Upsert(ctx context.Context, servicedata ServiceData) (ServiceData, error)
	GetKeyByURN(ctx context.Context, URN string) (Key, error)
	Get(ctx context.Context, filter Filter) ([]ServiceData, error)
}

type ResourceService

type ResourceService interface {
	Create(ctx context.Context, res resource.Resource) (resource.Resource, error)
	GetByURN(ctx context.Context, urn string) (resource.Resource, error)
}

type Service

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

func NewService

func NewService(logger log.Logger, repository Repository, resourceService ResourceService, relationService RelationService, projectService ProjectService, userService UserService, activityService ActivityService) *Service

func (Service) CreateKey

func (s Service) CreateKey(ctx context.Context, key Key) (Key, error)

func (Service) Get added in v0.6.22

func (s Service) Get(ctx context.Context, filter Filter) ([]ServiceData, error)

func (Service) Upsert added in v0.6.22

func (s Service) Upsert(ctx context.Context, sd ServiceData) (ServiceData, error)

type ServiceData added in v0.6.22

type ServiceData struct {
	ID          string
	NamespaceID string
	EntityID    string
	Key         Key
	Value       string
}

type Transactor

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

type UserService

type UserService interface {
	FetchCurrentUser(ctx context.Context) (user.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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