Skip to content

Commit

Permalink
add missing GetClusterAccessV2 implementation (#253)
Browse files Browse the repository at this point in the history
Signed-off-by: HaniAlshikh <[email protected]>

Signed-off-by: HaniAlshikh <[email protected]>
  • Loading branch information
HaniAlshikh authored Sep 30, 2022
1 parent 6fe4267 commit ec5f62c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/queryhandler/cluster_access_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ func (s *clusterAccessServer) GetClusterAccess(_ *emptypb.Empty, stream api.Clus
return nil
}

func (s *clusterAccessServer) GetClusterAccessV2(_ *emptypb.Empty, stream api.ClusterAccess_GetClusterAccessV2Server) error {
metadataManager, err := metadata.NewDomainMetadataManager(stream.Context())
if err != nil {
return err
}
userInfo := metadataManager.GetUserInformation()

clusters, err := s.clusterAccessRepo.GetClustersAccessibleByUserIdV2(stream.Context(), userInfo.Id)
if err != nil {
return errors.TranslateToGrpcError(err)
}

for _, c := range clusters {
err := stream.Send(c)
if err != nil {
return errors.TranslateToGrpcError(err)
}
}
return nil
}

func (s *clusterAccessServer) GetTenantClusterMappingsByTenantId(id *wrapperspb.StringValue, stream api.ClusterAccess_GetTenantClusterMappingsByTenantIdServer) error {
tenantId, err := uuid.Parse(id.GetValue())
if err != nil {
Expand Down

0 comments on commit ec5f62c

Please sign in to comment.