zitadel/pkg/admin/api/grpc/administrator.go
Fabi 8bfa1a083c
feat: administrator (#271)
* feat: get views and failed events

* feat: get views and failed events

* feat: get views and failed events

* Update internal/view/repository/sequence.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/view/repository/general_query.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2020-06-25 08:01:13 +02:00

34 lines
1.1 KiB
Go

package grpc
import (
"context"
view_model "github.com/caos/zitadel/internal/view/model"
"github.com/golang/protobuf/ptypes/empty"
)
func (s *Server) GetViews(ctx context.Context, _ *empty.Empty) (_ *Views, err error) {
views, err := s.administrator.GetViews(ctx)
if err != nil {
return nil, err
}
return &Views{Views: viewsFromModel(views)}, nil
}
func (s *Server) ClearView(ctx context.Context, viewID *ViewID) (_ *empty.Empty, err error) {
err = s.administrator.ClearView(ctx, viewID.Database, viewID.ViewName)
return &empty.Empty{}, err
}
func (s *Server) GetFailedEvents(ctx context.Context, _ *empty.Empty) (_ *FailedEvents, err error) {
failedEvents, err := s.administrator.GetFailedEvents(ctx)
if err != nil {
return nil, err
}
return &FailedEvents{FailedEvents: failedEventsFromModel(failedEvents)}, nil
}
func (s *Server) RemoveFailedEvent(ctx context.Context, failedEventID *FailedEventID) (_ *empty.Empty, err error) {
err = s.administrator.RemoveFailedEvent(ctx, &view_model.FailedEvent{Database: failedEventID.Database, ViewName: failedEventID.ViewName, FailedSequence: failedEventID.FailedSequence})
return &empty.Empty{}, err
}