GetFile implements RuntimeService.
(ctx context.Context, req *runtimev1.GetFileRequest)
| 102 | |
| 103 | // GetFile implements RuntimeService. |
| 104 | func (s *Server) GetFile(ctx context.Context, req *runtimev1.GetFileRequest) (*runtimev1.GetFileResponse, error) { |
| 105 | observability.AddRequestAttributes(ctx, |
| 106 | attribute.String("args.instance_id", req.InstanceId), |
| 107 | attribute.String("args.path", req.Path), |
| 108 | ) |
| 109 | |
| 110 | s.addInstanceRequestAttributes(ctx, req.InstanceId) |
| 111 | |
| 112 | if !auth.GetClaims(ctx, req.InstanceId).Can(runtime.ReadRepo) { |
| 113 | return nil, ErrForbidden |
| 114 | } |
| 115 | |
| 116 | blob, lastUpdated, err := s.runtime.GetFile(ctx, req.InstanceId, req.Path) |
| 117 | if err != nil { |
| 118 | return nil, err |
| 119 | } |
| 120 | |
| 121 | return &runtimev1.GetFileResponse{Blob: blob, UpdatedOn: timestamppb.New(lastUpdated)}, nil |
| 122 | } |
| 123 | |
| 124 | // PutFile implements RuntimeService. |
| 125 | func (s *Server) PutFile(ctx context.Context, req *runtimev1.PutFileRequest) (*runtimev1.PutFileResponse, error) { |
nothing calls this directly
no test coverage detected