code: func (s *Server) UpdateResource(ctx context.Context, request *api.UpdateResourceRequest) (*api.UpdateResourceResponse, error) {
  	if request.ResourceID == "" || request.ResourceVersion == nil {
  		return nil, status.Errorf(codes.InvalidArgument, "must include ID and version")
  	}
  	var r *api.Resource
  	err := s.store.Update(func(tx store.Tx) error {
  		r = store.GetResource(tx, request.ResourceID)
  		if r == nil {
  			return status.Errorf(codes.NotFound, "resource %v not found", request.ResourceID)
  		}
  
  		if request.Annotations != nil {
  			if r.Annotations.Name != request.Annotations.Name {
  				return status.Errorf(codes.InvalidArgument, "cannot change resource name")
  			}
  			r.Annotations = *request.Annotations
  		}
  		r.Meta.Version = *request.ResourceVersion
  		// only alter the payload if the
  		if request.Payload != nil {
  			r.Payload = request.Payload
  		}
  
  		return store.UpdateResource(tx, r)
  	})
  	switch err {
  	case store.ErrSequenceConflict:
  		return nil, status.Errorf(codes.InvalidArgument, "update out of sequence")
  	case nil:
  		return &api.UpdateResourceResponse{
  			Resource: r,
  		}, nil
  	default:
  		return nil, err
  	}
  }
docs: // UpdateResource updates the resource with the given `UpdateResourceRequest.Resource.Id` using the given `UpdateResourceRequest.Resource` and returns a `UpdateResourceResponse`.
  // - Returns `NotFound` if the Resource with the given `UpdateResourceRequest.Resource.Id` is not found.
  // - Returns `InvalidArgument` if the UpdateResourceRequest.Resource.Id` is empty.
  // - Returns an error if updating fails.