diff --git a/controller/northbound/server/auth.go b/controller/northbound/server/auth.go index 9abf3a936b6ac0568d125b5ca71f920c67bfba01..18eccd0c438b54eeb1d9866d8eae6dd1b9655b3c 100644 --- a/controller/northbound/server/auth.go +++ b/controller/northbound/server/auth.go @@ -17,23 +17,23 @@ import ( "google.golang.org/grpc/status" ) -// Auth holds a JWTManager and represents a AuthServiceServer. -type Auth struct { +// AuthServer holds a JWTManager and represents a AuthServiceServer. +type AuthServer struct { apb.UnimplementedAuthServiceServer jwtManager *rbac.JWTManager userService rbacInterfaces.UserService } // NewAuthServer receives a JWTManager and a userService and returns a new Auth interface. -func NewAuthServer(jwtManager *rbac.JWTManager, userService rbacInterfaces.UserService) *Auth { - return &Auth{ +func NewAuthServer(jwtManager *rbac.JWTManager, userService rbacInterfaces.UserService) *AuthServer { + return &AuthServer{ jwtManager: jwtManager, userService: userService, } } // Login logs a user in -func (s Auth) Login(ctx context.Context, request *apb.LoginRequest) (*apb.LoginResponse, error) { +func (s AuthServer) Login(ctx context.Context, request *apb.LoginRequest) (*apb.LoginResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -75,7 +75,7 @@ func (s Auth) Login(ctx context.Context, request *apb.LoginRequest) (*apb.LoginR } // Logout logs a user out -func (s Auth) Logout(ctx context.Context, request *apb.LogoutRequest) (*apb.LogoutResponse, error) { +func (s AuthServer) Logout(ctx context.Context, request *apb.LogoutRequest) (*apb.LogoutResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -92,7 +92,7 @@ func (s Auth) Logout(ctx context.Context, request *apb.LogoutRequest) (*apb.Logo } // isValidUser checks if the provided user name fits to a stored one and then checks if the provided password is correct. -func (s Auth) isValidUser(user rbac.User) error { +func (s AuthServer) isValidUser(user rbac.User) error { storedUser, err := s.userService.Get(store.Query{Name: user.Name()}) if err != nil { return err @@ -109,7 +109,7 @@ func (s Auth) isValidUser(user rbac.User) error { } // isCorrectPassword checks if the provided password fits with the hashed user password taken from the storage. -func (s Auth) isCorrectPassword(storedPassword, salt, loginPassword string) error { +func (s AuthServer) isCorrectPassword(storedPassword, salt, loginPassword string) error { hashedPasswordFromLogin := base64.RawStdEncoding.EncodeToString(argon2.IDKey([]byte(loginPassword), []byte(salt), 1, 64*1024, 4, 32)) if storedPassword == hashedPasswordFromLogin { @@ -121,7 +121,7 @@ func (s Auth) isCorrectPassword(storedPassword, salt, loginPassword string) erro // handleLogout checks if the provided user name matches with the one associated with token and // replaces the stored token of the user with an empty string. -func (s Auth) handleLogout(ctx context.Context, userName string) error { +func (s AuthServer) handleLogout(ctx context.Context, userName string) error { md, ok := metadata.FromIncomingContext(ctx) if !ok { return status.Errorf(codes.Aborted, "metadata is not provided") diff --git a/controller/northbound/server/auth_interceptor_test.go b/controller/northbound/server/auth_interceptor_test.go index a1863957682e90d9068aee629233ea54e67f2bf7..045774ba57b49e928c149d3fe6227a683c035a68 100644 --- a/controller/northbound/server/auth_interceptor_test.go +++ b/controller/northbound/server/auth_interceptor_test.go @@ -18,7 +18,7 @@ import ( "google.golang.org/grpc/test/bufconn" ) -func getTestAuthInterceptorServer(t *testing.T) (*AuthInterceptor, *User, *Role, *SbiServer) { +func getTestAuthInterceptorServer(t *testing.T) (*AuthInterceptor, *UserServer, *RoleServer, *SbiServer) { initUUIDs(t) jwtManager := rbac.NewJWTManager("test", time.Minute) eventService := eventservice.NewMockEventService() @@ -46,7 +46,7 @@ func getTestAuthInterceptorServer(t *testing.T) (*AuthInterceptor, *User, *Role, return s, u, r, sbiServer } -func dialer(interceptorServer *AuthInterceptor, userServer *User, roleServer *Role, sbiServer *SbiServer) func(context.Context, string) (net.Conn, error) { +func dialer(interceptorServer *AuthInterceptor, userServer *UserServer, roleServer *RoleServer, sbiServer *SbiServer) func(context.Context, string) (net.Conn, error) { listener := bufconn.Listen(1024 * 1024) interceptor := interceptorServer diff --git a/controller/northbound/server/auth_test.go b/controller/northbound/server/auth_test.go index 8d916d80c92cc0e8eacc8149cf9d1bcbedcb4d82..a24cee7648730eb04324f774e3710fba7b702193 100644 --- a/controller/northbound/server/auth_test.go +++ b/controller/northbound/server/auth_test.go @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc/metadata" ) -func getTestAuthServer(t *testing.T) *Auth { +func getTestAuthServer(t *testing.T) *AuthServer { jwtManager := rbac.NewJWTManager("test", time.Minute) eventService := eventservice.NewMockEventService() diff --git a/controller/northbound/server/core.go b/controller/northbound/server/core.go index 5a167a4b46a10851871709d9916056f7d108cf8a..451be03548f3d559e850c256e15e9b23c09d49c4 100644 --- a/controller/northbound/server/core.go +++ b/controller/northbound/server/core.go @@ -14,21 +14,21 @@ import ( "github.com/prometheus/client_golang/prometheus" ) -// Core represents a core server -type Core struct { +// CoreServer represents a core server +type CoreServer struct { pb.UnimplementedCoreServiceServer pndStore networkdomain.PndStore } // NewCoreServer receives a pndStore and returns a new coreServer. -func NewCoreServer(pndStore networkdomain.PndStore) *Core { - return &Core{ +func NewCoreServer(pndStore networkdomain.PndStore) *CoreServer { + return &CoreServer{ pndStore: pndStore, } } // GetPnd returns a existing pnd -func (s Core) GetPnd(ctx context.Context, request *pb.GetPndRequest) (*pb.GetPndResponse, error) { +func (s CoreServer) GetPnd(ctx context.Context, request *pb.GetPndRequest) (*pb.GetPndResponse, error) { labels := prometheus.Labels{"service": "core", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -56,7 +56,7 @@ func (s Core) GetPnd(ctx context.Context, request *pb.GetPndRequest) (*pb.GetPnd } // GetPndList returns all existing pnds -func (s Core) GetPndList(ctx context.Context, request *pb.GetPndListRequest) (*pb.GetPndListResponse, error) { +func (s CoreServer) GetPndList(ctx context.Context, request *pb.GetPndListRequest) (*pb.GetPndListResponse, error) { labels := prometheus.Labels{"service": "core", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -81,7 +81,7 @@ func (s Core) GetPndList(ctx context.Context, request *pb.GetPndListRequest) (*p } // CreatePndList creates a pnd list -func (s Core) CreatePndList(ctx context.Context, request *pb.CreatePndListRequest) (*pb.CreatePndListResponse, error) { +func (s CoreServer) CreatePndList(ctx context.Context, request *pb.CreatePndListRequest) (*pb.CreatePndListResponse, error) { labels := prometheus.Labels{"service": "core", "rpc": "set"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -101,7 +101,7 @@ func (s Core) CreatePndList(ctx context.Context, request *pb.CreatePndListReques } // DeletePnd deletes an existing pnd -func (s Core) DeletePnd(ctx context.Context, request *pb.DeletePndRequest) (*pb.DeletePndResponse, error) { +func (s CoreServer) DeletePnd(ctx context.Context, request *pb.DeletePndRequest) (*pb.DeletePndResponse, error) { labels := prometheus.Labels{"service": "core", "rpc": "set"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) diff --git a/controller/northbound/server/core_test.go b/controller/northbound/server/core_test.go index 333ac2eb6707fae6ecf467c8f5f57b3e9ffcaf25..78941a2bccb49357ce9a277ff997311391b452f7 100644 --- a/controller/northbound/server/core_test.go +++ b/controller/northbound/server/core_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/mock" ) -func getTestCoreServer(t *testing.T) *Core { +func getTestCoreServer(t *testing.T) *CoreServer { var err error pndUUID, err = uuid.Parse(pndID) if err != nil { diff --git a/controller/northbound/server/csbi.go b/controller/northbound/server/csbi.go index 31bf08b981c88d15094486408464f3ece382a6a4..00a68aea1517bec97371a9dfc7eadcdbfdf14abf 100644 --- a/controller/northbound/server/csbi.go +++ b/controller/northbound/server/csbi.go @@ -19,21 +19,21 @@ import ( "google.golang.org/grpc/status" ) -// Csbi represents a csbi server -type Csbi struct { +// CsbiServer represents a csbi server +type CsbiServer struct { cpb.UnimplementedCsbiServiceServer pndStore networkdomain.PndStore } // NewCsbiServer receives a pndStore and returns a new csbiServer. -func NewCsbiServer(pndStore networkdomain.PndStore) *Csbi { - return &Csbi{ +func NewCsbiServer(pndStore networkdomain.PndStore) *CsbiServer { + return &CsbiServer{ pndStore: pndStore, } } // Hello is used for tests -func (s Csbi) Hello(ctx context.Context, syn *cpb.Syn) (*cpb.Ack, error) { +func (s CsbiServer) Hello(ctx context.Context, syn *cpb.Syn) (*cpb.Ack, error) { labels := prometheus.Labels{"service": "csbi", "rpc": "hello"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) diff --git a/controller/northbound/server/nbi.go b/controller/northbound/server/nbi.go index 3fb3bb65cea4d596e40aa424b1c99f1cd1338278..75efc8af288e4cd9bf252ba3e4f4976a9c9a0259 100644 --- a/controller/northbound/server/nbi.go +++ b/controller/northbound/server/nbi.go @@ -19,13 +19,13 @@ import ( // gRPC services used provided. type NorthboundInterface struct { Pnd *PndServer - Core *Core - Csbi *Csbi + Core *CoreServer + Csbi *CsbiServer Sbi *SbiServer - Auth *Auth - User *User - Role *Role - Topology *Topology + Auth *AuthServer + User *UserServer + Role *RoleServer + Topology *TopologyServer } // NewNBI receives a PndStore and returns a new gRPC *NorthboundInterface diff --git a/controller/northbound/server/role.go b/controller/northbound/server/role.go index 4141c6250d51b81984b652430e852f6f0a3a4eb4..58d42d01b7893a1c7448c766cfd3092624d2730a 100644 --- a/controller/northbound/server/role.go +++ b/controller/northbound/server/role.go @@ -17,23 +17,23 @@ import ( "google.golang.org/grpc/status" ) -// Role holds a JWTManager and represents a RoleServiceServer. -type Role struct { +// RoleServer holds a JWTManager and represents a RoleServiceServer. +type RoleServer struct { apb.UnimplementedRoleServiceServer jwtManager *rbac.JWTManager roleService rbacInterfaces.RoleService } // NewRoleServer receives a JWTManager and a RoleService and returns a new RoleServer. -func NewRoleServer(jwtManager *rbac.JWTManager, roleService rbacInterfaces.RoleService) *Role { - return &Role{ +func NewRoleServer(jwtManager *rbac.JWTManager, roleService rbacInterfaces.RoleService) *RoleServer { + return &RoleServer{ jwtManager: jwtManager, roleService: roleService, } } // CreateRoles creates one are multiple new roles. -func (r Role) CreateRoles(ctx context.Context, request *apb.CreateRolesRequest) (*apb.CreateRolesResponse, error) { +func (r RoleServer) CreateRoles(ctx context.Context, request *apb.CreateRolesRequest) (*apb.CreateRolesResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -55,7 +55,7 @@ func (r Role) CreateRoles(ctx context.Context, request *apb.CreateRolesRequest) } // GetRole returns one role with its permissions found by name. -func (r Role) GetRole(ctx context.Context, request *apb.GetRoleRequest) (*apb.GetRoleResponse, error) { +func (r RoleServer) GetRole(ctx context.Context, request *apb.GetRoleRequest) (*apb.GetRoleResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -85,7 +85,7 @@ func (r Role) GetRole(ctx context.Context, request *apb.GetRoleRequest) (*apb.Ge } // GetRoles returns all roles with their permissions. -func (r Role) GetRoles(ctx context.Context, request *apb.GetRolesRequest) (*apb.GetRolesResponse, error) { +func (r RoleServer) GetRoles(ctx context.Context, request *apb.GetRolesRequest) (*apb.GetRolesResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -113,7 +113,7 @@ func (r Role) GetRoles(ctx context.Context, request *apb.GetRolesRequest) (*apb. } // UpdateRoles updates data of the provided roles. -func (r Role) UpdateRoles(ctx context.Context, request *apb.UpdateRolesRequest) (*apb.UpdateRolesResponse, error) { +func (r RoleServer) UpdateRoles(ctx context.Context, request *apb.UpdateRolesRequest) (*apb.UpdateRolesResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -142,7 +142,7 @@ func (r Role) UpdateRoles(ctx context.Context, request *apb.UpdateRolesRequest) } // DeletePermissionsForRole deletes the provided permissions from one role found by name. -func (r Role) DeletePermissionsForRole(ctx context.Context, request *apb.DeletePermissionsForRoleRequest) (*apb.DeletePermissionsForRoleResponse, error) { +func (r RoleServer) DeletePermissionsForRole(ctx context.Context, request *apb.DeletePermissionsForRoleRequest) (*apb.DeletePermissionsForRoleResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "delete"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -184,7 +184,7 @@ func (r Role) DeletePermissionsForRole(ctx context.Context, request *apb.DeleteP } // DeleteRoles deletes all the provided roles with their permissions. -func (r Role) DeleteRoles(ctx context.Context, request *apb.DeleteRolesRequest) (*apb.DeleteRolesResponse, error) { +func (r RoleServer) DeleteRoles(ctx context.Context, request *apb.DeleteRolesRequest) (*apb.DeleteRolesResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "delete"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) diff --git a/controller/northbound/server/role_test.go b/controller/northbound/server/role_test.go index b9d0a62bbd992f585e08197930c61573eb440a0f..2ad31431d68eba2c9c4b528554024af541b3ebd9 100644 --- a/controller/northbound/server/role_test.go +++ b/controller/northbound/server/role_test.go @@ -13,7 +13,7 @@ import ( eventservice "code.fbi.h-da.de/danet/gosdn/controller/eventService" ) -func getTestRoleServer(t *testing.T) *Role { +func getTestRoleServer(t *testing.T) *RoleServer { jwtManager := rbac.NewJWTManager("test", time.Second) eventService := eventservice.NewMockEventService() diff --git a/controller/northbound/server/topology.go b/controller/northbound/server/topology.go index 0557f2eee98a60aecca6dc5038511e9cd90b18ca..6c74306b80ed97c9df5a8fdade2785bb80c7198f 100644 --- a/controller/northbound/server/topology.go +++ b/controller/northbound/server/topology.go @@ -17,8 +17,8 @@ import ( "google.golang.org/grpc/status" ) -// Topology holds a topologyService and represents a TopologyServiceServer. -type Topology struct { +// TopologyServer holds a topologyService and represents a TopologyServiceServer. +type TopologyServer struct { topopb.UnimplementedTopologyServiceServer topologyService topology.Service nodeService nodes.Service @@ -30,8 +30,8 @@ func NewTopologyServer( service topology.Service, nodeService nodes.Service, portService ports.Service, -) *Topology { - return &Topology{ +) *TopologyServer { + return &TopologyServer{ topologyService: service, nodeService: nodeService, portService: portService, @@ -39,7 +39,7 @@ func NewTopologyServer( } // AddLink adds a new link to the topology -func (t *Topology) AddLink(ctx context.Context, request *topopb.AddLinkRequest) (*topopb.AddLinkResponse, error) { +func (t *TopologyServer) AddLink(ctx context.Context, request *topopb.AddLinkRequest) (*topopb.AddLinkResponse, error) { sourceNode, sourcePort, err := t.ensureNodeAndPortExists(request.Link.SourceNode, request.Link.SourcePort) if err != nil { return nil, status.Errorf(codes.Aborted, "%v", err) @@ -70,7 +70,7 @@ func (t *Topology) AddLink(ctx context.Context, request *topopb.AddLinkRequest) } // GetTopology returns the current topology in the form of all links -func (t *Topology) GetTopology(ctx context.Context, request *topopb.GetTopologyRequest) (*topopb.GetTopologyResponse, error) { +func (t *TopologyServer) GetTopology(ctx context.Context, request *topopb.GetTopologyRequest) (*topopb.GetTopologyResponse, error) { topo, err := t.topologyService.GetAll() if err != nil { return nil, status.Errorf(codes.Aborted, "%v", err) @@ -117,7 +117,7 @@ func (t *Topology) GetTopology(ctx context.Context, request *topopb.GetTopologyR } // DeleteLink deletes a link -func (t *Topology) DeleteLink(ctx context.Context, request *topopb.DeleteLinkRequest) (*topopb.DeleteLinkResponse, error) { +func (t *TopologyServer) DeleteLink(ctx context.Context, request *topopb.DeleteLinkRequest) (*topopb.DeleteLinkResponse, error) { linkID, err := uuid.Parse(request.Id) if err != nil { return &topopb.DeleteLinkResponse{ @@ -148,7 +148,7 @@ func (t *Topology) DeleteLink(ctx context.Context, request *topopb.DeleteLinkReq }, nil } -func (t *Topology) ensureNodeAndPortExists(incomingNode *topopb.Node, incomingPort *topopb.Port) (nodes.Node, ports.Port, error) { +func (t *TopologyServer) ensureNodeAndPortExists(incomingNode *topopb.Node, incomingPort *topopb.Port) (nodes.Node, ports.Port, error) { node, err := t.nodeService.EnsureExists( nodes.Node{ ID: getExistingOrCreateNilUUIDFromString(incomingNode.Id), diff --git a/controller/northbound/server/topology_test.go b/controller/northbound/server/topology_test.go index 7f447baf884101e040f892f5e836eb52c86ad590..0067a18a7293d1a050c934cffe022c6bf0d0287f 100644 --- a/controller/northbound/server/topology_test.go +++ b/controller/northbound/server/topology_test.go @@ -55,7 +55,7 @@ func getTestTopologyServer( nodesToAdd []nodes.Node, portsToAdd []ports.Port, linksToAdd []links.Link, -) *Topology { +) *TopologyServer { eventService := eventservice.NewMockEventService() nodeStore := getTestStoreWithNodes(t, nodesToAdd) @@ -192,7 +192,7 @@ func TestNewTopologyServer(t *testing.T) { tests := []struct { name string args args - want *Topology + want *TopologyServer }{ { name: "should create a new topology service", @@ -201,7 +201,7 @@ func TestNewTopologyServer(t *testing.T) { nodeService: getTestNodeService(), portService: getTestPortService(), }, - want: &Topology{ + want: &TopologyServer{ topologyService: getTestTopologyService(), nodeService: getTestNodeService(), portService: getTestPortService(), diff --git a/controller/northbound/server/user.go b/controller/northbound/server/user.go index 88ff3410801ee1a0dc4e0b111d3d714a644a4390..f7a4ce57c18d152b414a0a4787a960146f0522de 100644 --- a/controller/northbound/server/user.go +++ b/controller/northbound/server/user.go @@ -22,23 +22,23 @@ import ( rbacInterfaces "code.fbi.h-da.de/danet/gosdn/controller/interfaces/rbac" ) -// User holds a JWTManager and represents a UserServiceServer. -type User struct { +// UserServer holds a JWTManager and represents a UserServiceServer. +type UserServer struct { apb.UnimplementedUserServiceServer jwtManager *rbac.JWTManager userService rbacInterfaces.UserService } // NewUserServer receives a JWTManager and a UserService and returns a new UserServer. -func NewUserServer(jwtManager *rbac.JWTManager, userService rbacInterfaces.UserService) *User { - return &User{ +func NewUserServer(jwtManager *rbac.JWTManager, userService rbacInterfaces.UserService) *UserServer { + return &UserServer{ jwtManager: jwtManager, userService: userService, } } // CreateUsers creates new users, can be 1 or more -func (u User) CreateUsers(ctx context.Context, request *apb.CreateUsersRequest) (*apb.CreateUsersResponse, error) { +func (u UserServer) CreateUsers(ctx context.Context, request *apb.CreateUsersRequest) (*apb.CreateUsersResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -78,7 +78,7 @@ func (u User) CreateUsers(ctx context.Context, request *apb.CreateUsersRequest) } // GetUser returns one user by name. -func (u User) GetUser(ctx context.Context, request *apb.GetUserRequest) (*apb.GetUserResponse, error) { +func (u UserServer) GetUser(ctx context.Context, request *apb.GetUserRequest) (*apb.GetUserResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -107,7 +107,7 @@ func (u User) GetUser(ctx context.Context, request *apb.GetUserRequest) (*apb.Ge } // GetUsers returns all availbale users -func (u User) GetUsers(ctx context.Context, request *apb.GetUsersRequest) (*apb.GetUsersResponse, error) { +func (u UserServer) GetUsers(ctx context.Context, request *apb.GetUsersRequest) (*apb.GetUsersResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "get"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -134,7 +134,7 @@ func (u User) GetUsers(ctx context.Context, request *apb.GetUsersRequest) (*apb. } // UpdateUsers updates the user data of one or more users provided in the request -func (u User) UpdateUsers(ctx context.Context, request *apb.UpdateUsersRequest) (*apb.UpdateUsersResponse, error) { +func (u UserServer) UpdateUsers(ctx context.Context, request *apb.UpdateUsersRequest) (*apb.UpdateUsersResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "post"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) @@ -167,7 +167,7 @@ func (u User) UpdateUsers(ctx context.Context, request *apb.UpdateUsersRequest) } // DeleteUsers deletes one or more users provided in the request -func (u User) DeleteUsers(ctx context.Context, request *apb.DeleteUsersRequest) (*apb.DeleteUsersResponse, error) { +func (u UserServer) DeleteUsers(ctx context.Context, request *apb.DeleteUsersRequest) (*apb.DeleteUsersResponse, error) { labels := prometheus.Labels{"service": "auth", "rpc": "delete"} start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) diff --git a/controller/northbound/server/user_test.go b/controller/northbound/server/user_test.go index 83a9c081390a16e961aa7c6b7185f4e0c9de07bd..1e447266e3c8503ceccaa6afd87794eddf40cfcc 100644 --- a/controller/northbound/server/user_test.go +++ b/controller/northbound/server/user_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" ) -func getTestUserServer(t *testing.T) *User { +func getTestUserServer(t *testing.T) *UserServer { jwtManager := rbac.NewJWTManager("test", time.Second) eventService := eventservice.NewMockEventService()