mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-24 22:05:12 +00:00
Add entity information request to system view (#4681)
* Add entity information request to system view * fixing a few comments * sharing types between plugin and logical * sharing types between plugin and logical * fixing output directory for proto * removing extra replacement * adding mount type lookup * empty entities return nil instead of error * adding some comments
This commit is contained in:
@@ -132,6 +132,20 @@ func (s *gRPCSystemViewClient) LocalMount() bool {
|
||||
return reply.Local
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewClient) EntityInfo(entityID string) (*logical.Entity, error) {
|
||||
reply, err := s.client.EntityInfo(context.Background(), &pb.EntityInfoArgs{
|
||||
EntityID: entityID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if reply.Err != "" {
|
||||
return nil, errors.New(reply.Err)
|
||||
}
|
||||
|
||||
return reply.Entity, nil
|
||||
}
|
||||
|
||||
type gRPCSystemViewServer struct {
|
||||
impl logical.SystemView
|
||||
}
|
||||
@@ -216,3 +230,15 @@ func (s *gRPCSystemViewServer) LocalMount(ctx context.Context, _ *pb.Empty) (*pb
|
||||
Local: local,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewServer) EntityInfo(ctx context.Context, args *pb.EntityInfoArgs) (*pb.EntityInfoReply, error) {
|
||||
entity, err := s.impl.EntityInfo(args.EntityID)
|
||||
if err != nil {
|
||||
return &pb.EntityInfoReply{
|
||||
Err: pb.ErrToString(err),
|
||||
}, nil
|
||||
}
|
||||
return &pb.EntityInfoReply{
|
||||
Entity: entity,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user