groups

package
v0.0.0-...-217a8d3 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: 20 Imported by: 0

Documentation

Overview

Package groups contains Groups server implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthGroupJSON

type AuthGroupJSON struct {
	Name            string   `json:"name"`
	Description     string   `json:"description"`
	Owners          string   `json:"owners"`
	Members         []string `json:"members"`
	Globs           []string `json:"globs"`
	Nested          []string `json:"nested"`
	CreatedBy       string   `json:"created_by"`
	CreatedTS       int64    `json:"created_ts"`
	ModifiedBy      string   `json:"modified_by"`
	ModifiedTS      int64    `json:"modified_ts"`
	CallerCanModify bool     `json:"caller_can_modify"`
}

AuthGroupJSON is the underlying data structure returned by the legacy method of getting an AuthGroup.

type AuthGroupsProvider

type AuthGroupsProvider interface {
	GetAllAuthGroups(ctx context.Context) ([]*model.AuthGroup, error)
	RefreshPeriodically(ctx context.Context)
}

AuthGroupsProvider is the interface to get all AuthGroup entities.

type AuthGroupsSnapshot

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

type CachingGroupsProvider

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

func (*CachingGroupsProvider) GetAllAuthGroups

func (cgp *CachingGroupsProvider) GetAllAuthGroups(ctx context.Context) (groups []*model.AuthGroup, err error)

func (*CachingGroupsProvider) RefreshPeriodically

func (cgp *CachingGroupsProvider) RefreshPeriodically(ctx context.Context)

RefreshPeriodically runs a loop that periodically refreshes the cached snapshot of AuthGroups.

type ListingJSON

type ListingJSON struct {
	Members []listingPrincipal `json:"members"`
	Globs   []listingPrincipal `json:"globs"`
	Nested  []listingPrincipal `json:"nested"`
}

ListingJSON is the underlying data structure returned by the legacy method of getting the expanded listing of an AuthGroup.

type Server

type Server struct {
	rpcpb.UnimplementedGroupsServer
	// contains filtered or unexported fields
}

Server implements Groups server.

func NewServer

func NewServer(dryRun bool) *Server

func (*Server) CreateGroup

func (srv *Server) CreateGroup(ctx context.Context, request *rpcpb.CreateGroupRequest) (*rpcpb.AuthGroup, error)

CreateGroup implements the corresponding RPC method.

func (*Server) DeleteGroup

func (srv *Server) DeleteGroup(ctx context.Context, request *rpcpb.DeleteGroupRequest) (*emptypb.Empty, error)

DeleteGroup implements the corresponding RPC method.

func (*Server) GetExpandedGroup

func (srv *Server) GetExpandedGroup(ctx context.Context, request *rpcpb.GetGroupRequest) (*rpcpb.AuthGroup, error)

GetExpandedGroup implements the corresponding RPC method.

Possible Errors:

Internal error for datastore access issues.
NotFound error wrapping a graph.ErrNoSuchGroup if group is not present in groups graph.

func (*Server) GetGroup

func (*Server) GetGroup(ctx context.Context, request *rpcpb.GetGroupRequest) (*rpcpb.AuthGroup, error)

GetGroup implements the corresponding RPC method.

func (*Server) GetLegacyAuthGroup

func (srv *Server) GetLegacyAuthGroup(ctx *router.Context) error

GetLegacyAuthGroup serves the legacy REST API GET request for an AuthGroup.

func (*Server) GetLegacyListing

func (srv *Server) GetLegacyListing(ctx *router.Context) error

GetLegacyListing serves the legacy REST API GET request for the listing of an AuthGroup.

func (*Server) GetSubgraph

func (srv *Server) GetSubgraph(ctx context.Context, request *rpcpb.GetSubgraphRequest) (*rpcpb.Subgraph, error)

GetSubgraph implements the corresponding RPC method.

Possible Errors:

Internal error for datastore access issues.
NotFound error wrapping a graph.ErrNoSuchGroup if group is not present in groups graph.
InvalidArgument error if the PrincipalKind is unspecified.
Annotated error if the subgraph building fails, this may be an InvalidArgument or NotFound error.

func (*Server) ListGroups

func (srv *Server) ListGroups(ctx context.Context, _ *emptypb.Empty) (*rpcpb.ListGroupsResponse, error)

ListGroups implements the corresponding RPC method.

func (*Server) RefreshPeriodically

func (srv *Server) RefreshPeriodically(ctx context.Context)

RefreshPeriodically wraps the groups provider's refresh method.

func (*Server) UpdateGroup

func (srv *Server) UpdateGroup(ctx context.Context, request *rpcpb.UpdateGroupRequest) (*rpcpb.AuthGroup, error)

UpdateGroup implements the corresponding RPC method.

func (*Server) Warmup

func (srv *Server) Warmup(ctx context.Context)

Warmup does the setup for the groups server; it should be called before the main serving loop.

Jump to

Keyboard shortcuts

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