events

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package events contains methods to publish group memberships info to the permissions-api

Index

Constants

View Source
const (
	// DirectMemberRelationship is the direct member relationship.
	DirectMemberRelationship = "direct_member"
	// GroupParentRelationship is the group parent relationship.
	GroupParentRelationship = "parent"
	// GroupTopic is the group topic.
	GroupTopic = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

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

Events represents a collection of relationships.

func NewEvents

func NewEvents(opts ...Opt) *Events

NewEvents creates a new Relationships instance with the given NATS URL and options.

func (*Events) AddGroupMembers

func (e *Events) AddGroupMembers(ctx context.Context, gid gidx.PrefixedID, subjIDs ...gidx.PrefixedID) error

AddGroupMembers adds subjects to a group.

func (*Events) CreateGroup

func (e *Events) CreateGroup(ctx context.Context, parentID, gid gidx.PrefixedID) error

CreateGroup creates a group.

func (*Events) DeleteGroup

func (e *Events) DeleteGroup(ctx context.Context, parentID, gid gidx.PrefixedID) error

DeleteGroup deletes a group.

func (*Events) RemoveGroupMembers

func (e *Events) RemoveGroupMembers(ctx context.Context, gid gidx.PrefixedID, subjIDs ...gidx.PrefixedID) error

RemoveGroupMembers removes subjects from a group.

type GroupService

type GroupService interface {
	// AddGroupMembers adds subjects to a group.
	AddGroupMembers(ctx context.Context, gid gidx.PrefixedID, subjIDs ...gidx.PrefixedID) error
	// RemoveGroupMembers removes subjects from a group.
	RemoveGroupMembers(ctx context.Context, gid gidx.PrefixedID, subjIDs ...gidx.PrefixedID) error
	// CreateGroup creates a group.
	CreateGroup(ctx context.Context, parentID, gid gidx.PrefixedID) error
	// DeleteGroup deletes a group.
	DeleteGroup(ctx context.Context, parentID, gid gidx.PrefixedID) error
}

GroupService provides group-related event publishing and handling.

type Opt

type Opt func(*Events)

Opt represents an option for configuring Relationships.

func WithLogger

func WithLogger(logger *zap.Logger) Opt

WithLogger is an option to set the logger for Relationships.

type Service

type Service interface {
	GroupService
}

Service is the interface for the events service.

Jump to

Keyboard shortcuts

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