code: func (s *Service) GetBuildbotBuildJSON(c context.Context, req *milo.BuildbotBuildRequest) (
  	*milo.BuildbotBuildJSON, error) {
  
  	apiUsage.Add(c, 1, "GetBuildbotBuildJSON", req.Master, req.Builder, req.ExcludeDeprecated, false)
  
  	if req.Master == "" {
  		return nil, status.Errorf(codes.InvalidArgument, "No master specified")
  	}
  	if req.Builder == "" {
  		return nil, status.Errorf(codes.InvalidArgument, "No builder specified")
  	}
  	cu := auth.CurrentUser(c)
  	logging.Debugf(c, "%s is requesting %s/%s/%d",
  		cu.Identity, req.Master, req.Builder, req.BuildNum)
  
  	if err := buildstore.CanAccessMaster(c, req.Master); err != nil {
  		return nil, err
  	}
  
  	b, err := buildstore.GetBuild(c, buildbot.BuildID{
  		Master:  req.Master,
  		Builder: req.Builder,
  		Number:  int(req.BuildNum),
  	})
  	switch code := grpcutil.Code(err); {
  	case code == codes.PermissionDenied, code == codes.NotFound:
  		return nil, errNotFoundGRPC
  	case err != nil:
  		return nil, err
  	case b == nil:
  		return nil, errNotFoundGRPC
  	}
  
  	if req.ExcludeDeprecated {
  		excludeDeprecatedFromBuild(b)
  	}
  
  	bs, err := json.Marshal(b)
  	if err != nil {
  		return nil, err
  	}
  
  	// Marshal the build back into JSON format.
  	return &milo.BuildbotBuildJSON{Data: bs}, nil
  }
docs: // GetBuildbotBuildJSON implements milo.BuildbotServer.