clients

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBackend is returned when an invalid backend type is provided
	ErrInvalidBackend = errors.New("invalid backend")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// Fetches all the users onboarded over the platform
	// returns 2 maps where:
	// 1st map will have ID as key in order to map with team membership response
	// and 2nd will have email as key
	FetchAllUsers(ctx context.Context) (map[string]*structs.User, map[string]*structs.User, error)
	// Fetches user details based on unique userID
	FetchUserDetails(ctx context.Context, userID string) (*structs.User, error)
	// Onboards the user on the backend
	CreateUser(ctx context.Context, u *structs.User) (*structs.User, error)
	// Drop User from the backend
	DeleteUser(ctx context.Context, userID string) error

	// Fetches all the teams on the backend
	FetchAllTeams(ctx context.Context) (map[string]structs.Team, error)
	// Fetch team details by ID or unique key
	FetchTeamDetails(ctx context.Context, teamID string) (*structs.Team, error)
	// Create a new team/role
	CreateTeam(ctx context.Context, team *structs.Team) (*structs.Team, error)
	// Drop the team from respective backend
	DeleteTeamByID(ctx context.Context, teamID string) error

	// Returns the list of users present under a team
	FetchTeamMembersByTeamID(ctx context.Context, teamID string) (map[string]*structs.User, error)
	// Adds a member to the team
	AddUserToTeam(ctx context.Context, teamID string, userIDs []string) error
	// Removes a member from the team
	RemoveUserFromTeam(ctx context.Context, teamID string, userIDs []string) error
}

func New

func New(backendName, backendType string, backends map[string]map[string]config.Backend) (Client, error)

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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