func (s Server) resourceGetHandler(w http.ResponseWriter, r *http.Request, id string, resourceType ResourceType) {
	resource, getErr := resourceType.Handler.Get(r, id)
	if getErr != nil {
		scimErr := errors.CheckScimError(getErr, http.MethodGet)
		errorHandler(w, r, &scimErr)
		return
	}
	raw, err := json.Marshal(resource.response(resourceType))
	if err != nil {
		errorHandler(w, r, &errors.ScimErrorInternal)
		log.Fatalf("failed marshaling resource: %v", err)
		return
	}
	if resource.Meta.Version != "" {
		w.Header().Set("Etag", resource.Meta.Version)
	}
	_, err = w.Write(raw)
	if err != nil {
		log.Printf("failed writing response: %v", err)
	}
}
resourceGetHandler receives an HTTP GET request to the resource endpoint, e.g., "/Users/{id}" or "/Groups/{id}",
where "{id}" is a resource identifier to retrieve a known resource.
package scim
import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"
	"github.com/elimity-com/scim/errors"
	f "github.com/elimity-com/scim/internal/filter"
	"github.com/elimity-com/scim/schema"
)
func errorHandler(w http.ResponseWriter, _ *http.Request, scimErr *errors.ScimError) {
	raw, err := json.Marshal(scimErr)
	if err != nil {
		log.Fatalf("failed marshaling scim error: %v", err)
	}
	w.WriteHeader(scimErr.Status)
	_, err = w.Write(raw)
	if err != nil {
		log.Printf("failed writing response: %v", err)
	}
}
func (s Server) resourceDeleteHandler(w http.ResponseWriter, r *http.Request, id string, resourceType ResourceType) {
	deleteErr := resourceType.Handler.Delete(r, id)
	if deleteErr != nil {
		scimErr := errors.CheckScimError(deleteErr, http.MethodDelete)
		errorHandler(w, r, &scimErr)
		return
	}
	w.WriteHeader(http.StatusNoContent)
}