Add Post to events service
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
api "github.com/containerd/containerd/api/services/events/v1"
|
||||
"github.com/containerd/containerd/events"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
@@ -52,3 +54,11 @@ func (s *Service) Stream(req *api.StreamEventsRequest, srv api.Events_StreamServ
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) Post(ctx context.Context, r *api.PostEventRequest) (*empty.Empty, error) {
|
||||
ctx = events.WithTopic(ctx, r.Envelope.Topic)
|
||||
if err := s.emitter.Post(ctx, r.Envelope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user