repository

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: Migrate to common fields introduced in https://github.com/metal-stack/masterdata-api/pull/127
	TenantTagEmail     = "metal-stack.io/email"
	TenantTagAvatarURL = "metal-stack.io/avatarurl"
	TenantTagCreator   = "metal-stack.io/creator"

	// TODO: Use scoped memberships: https://github.com/metal-stack/masterdata-api/issues/130
	TenantRoleAnnotation = "metal-stack.io/tenant-role"
)
View Source
const (
	ProjectRoleAnnotation = "metal-stack.io/project-role"
)

Variables

This section is empty.

Functions

func GetNewNicState added in v0.1.0

func GetNewNicState(current *apiv2.NicState, status apiv2.SwitchPortStatus) (*apiv2.NicState, bool)

func NewTenantCreateOptWithCreator added in v0.0.7

func NewTenantCreateOptWithCreator(creator string) *tenantCreateOptWithCreator

func TenantRoleFromMap added in v0.0.6

func TenantRoleFromMap(annotations map[string]string) apiv2.TenantRole

Types

type Config added in v0.1.2

type Config struct {
	Log              *slog.Logger
	Datastore        generic.Datastore
	MasterdataClient mdm.Client
	Ipam             ipamv1connect.IpamServiceClient
	Task             *task.Client
	Queue            *queue.Queue
}

type CreateMessage

type CreateMessage any

CreateMessage is an external request to create an entity for consumers. TODO: ideally all update messages should clearly expose the identifier in order to get the entity with it! UpdateMessage interface{ ID() string }

type Entity

type Entity interface {
	SetChanged(t time.Time)
}

Entity is the internal representation of an api resource, which is stored in the backend.

type IP

type Machine added in v0.0.6

type Message

type Message any

Message is the external representation of an api resource for consumers.

type ProjectMember added in v0.0.6

type ProjectMember interface {
	Repository[*projectMemberRepository, *apiv2.ProjectMember, *ProjectMemberCreateRequest, *ProjectMemberUpdateRequest, *ProjectMemberQuery]
}

type ProjectMemberCreateRequest added in v0.0.6

type ProjectMemberCreateRequest struct {
	TenantId string
	Role     apiv2.ProjectRole
}

type ProjectMemberQuery added in v0.0.6

type ProjectMemberQuery struct {
	TenantId    *string
	Annotations map[string]string
}

type ProjectMemberUpdateRequest added in v0.0.6

type ProjectMemberUpdateRequest struct {
	Role apiv2.ProjectRole
	Meta apiv2.Meta
}

func (*ProjectMemberUpdateRequest) GetUpdateMeta added in v0.0.8

func (*ProjectMemberUpdateRequest) GetUpdateMeta() *apiv2.UpdateMeta

type ProjectScope

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

type ProjectsAndTenants added in v0.0.6

type ProjectsAndTenants struct {
	Projects      []*apiv2.Project
	Tenants       []*apiv2.Tenant
	DefaultTenant *apiv2.Tenant
	ProjectRoles  map[string]apiv2.ProjectRole
	TenantRoles   map[string]apiv2.TenantRole
}

type Query

type Query any

Query is an external representation to filter an entity for consumers.

type Repo added in v0.0.4

type Repo any

Repo is the typed repository in order to expose public functions on the repository to the consumers.

type Repository

type Repository[R Repo, M Message, C CreateMessage, U UpdateMessage, Q Query] interface {
	Get(ctx context.Context, id string) (M, error)
	Create(ctx context.Context, c C) (M, error)
	Update(ctx context.Context, id string, u U) (M, error)
	Delete(ctx context.Context, id string) (M, error)
	Find(ctx context.Context, query Q) (M, error)
	List(ctx context.Context, query Q) ([]M, error)
	AdditionalMethods() R
}

type Size added in v0.0.5

type Store

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

func New

func New(c Config) (*Store, error)

func (*Store) FilesystemLayout

func (s *Store) FilesystemLayout() FilesystemLayout

func (*Store) IP

func (s *Store) IP(project string) IP

func (*Store) Image

func (s *Store) Image() Image

func (*Store) IpDeleteHandleFn

func (r *Store) IpDeleteHandleFn(ctx context.Context, t *asynq.Task) error

func (*Store) Machine added in v0.0.6

func (s *Store) Machine(project string) Machine

func (*Store) MachineBMCCommandHandleFn added in v0.1.2

func (r *Store) MachineBMCCommandHandleFn(ctx context.Context, t *asynq.Task) error

func (*Store) MachineDeleteHandleFn added in v0.0.6

func (r *Store) MachineDeleteHandleFn(ctx context.Context, t *asynq.Task) error

func (*Store) Network

func (s *Store) Network(project string) Network

func (*Store) NetworkDeleteHandleFn added in v0.0.3

func (r *Store) NetworkDeleteHandleFn(ctx context.Context, t *asynq.Task) error

NetworkDeleteHandleFn is called async to ensure all dependent entities are deleted Async deletion must be scheduled by async.NewNetworkDeleteTask

func (*Store) Partition

func (s *Store) Partition() Partition

func (*Store) Project

func (s *Store) Project(project string) Project

func (*Store) Size added in v0.0.5

func (s *Store) Size() Size

func (*Store) Switch added in v0.0.8

func (s *Store) Switch() Switch

func (*Store) Task added in v0.1.2

func (s *Store) Task() *task.Client

func (*Store) Tenant

func (s *Store) Tenant() Tenant

func (*Store) UnscopedIP

func (s *Store) UnscopedIP() IP

func (*Store) UnscopedMachine added in v0.0.6

func (s *Store) UnscopedMachine() Machine

func (*Store) UnscopedNetwork

func (s *Store) UnscopedNetwork() Network

func (*Store) UnscopedProject

func (s *Store) UnscopedProject() Project

type Switch added in v0.0.8

type SwitchServiceCreateRequest added in v0.0.8

type SwitchServiceCreateRequest struct {
	Switch *apiv2.Switch
}

type SwitchStatus added in v0.1.0

type SwitchStatus struct {
	ID            string
	LastSync      *apiv2.SwitchSync
	LastSyncError *apiv2.SwitchSync
}

func (*SwitchStatus) GetID added in v0.1.2

func (s *SwitchStatus) GetID() string

type TenantMember added in v0.0.6

type TenantMember interface {
	Repository[*tenantMemberRepository, *apiv2.TenantMember, *TenantMemberCreateRequest, *TenantMemberUpdateRequest, *TenantMemberQuery]
}

type TenantMemberCreateRequest added in v0.0.6

type TenantMemberCreateRequest struct {
	MemberID string
	Role     apiv2.TenantRole
}

type TenantMemberQuery added in v0.0.6

type TenantMemberQuery struct {
	MemberId    *string
	Annotations map[string]string
}

type TenantMemberUpdateRequest added in v0.0.6

type TenantMemberUpdateRequest struct {
	Role apiv2.TenantRole
}

func (*TenantMemberUpdateRequest) GetUpdateMeta added in v0.0.8

func (*TenantMemberUpdateRequest) GetUpdateMeta() *apiv2.UpdateMeta

type TenantScope added in v0.0.6

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

type TenantWithMembershipAnnotations added in v0.0.9

type TenantWithMembershipAnnotations struct {
	Tenant             *apiv2.Tenant
	ProjectAnnotations map[string]string
	TenantAnnotations  map[string]string
	ProjectIds         []string
}

type UpdateMessage

type UpdateMessage interface {
	GetUpdateMeta() *apiv2.UpdateMeta
}

UpdateMessage is an external request to update an entity for consumers.

Jump to

Keyboard shortcuts

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