func HandleSetFileRule(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		token := utils.GetTokenFromHeader(r)
		vars := mux.Vars(r)
		projectID := vars["project"]
		ruleName := vars["id"]
		value := new(config.FileRule)
		_ = json.NewDecoder(r.Body).Decode(value)
		defer utils.CloseTheCloser(r.Body)
		ctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)
		defer cancel()
		reqParams, err := adminMan.IsTokenValid(ctx, token, "filestore-rule", "modify", map[string]string{"project": projectID, "id": ruleName})
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)
			return
		}
		reqParams = utils.ExtractRequestParams(r, reqParams, value)
		status, err := syncMan.SetFileRule(ctx, projectID, ruleName, value, reqParams)
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, status, err)
			return
		}
		_ = helpers.Response.SendOkayResponse(ctx, status, w)
	}
}
HandleSetFileRule sets file rule
package handlers
import (
	"context"
	"encoding/json"
	"net/http"
	"time"
	"github.com/spaceuptech/helpers"
	"github.com/spaceuptech/space-cloud/gateway/model"
	"github.com/spaceuptech/space-cloud/gateway/modules"
	"github.com/gorilla/mux"
	"github.com/spaceuptech/space-cloud/gateway/config"
	"github.com/spaceuptech/space-cloud/gateway/managers/admin"
	"github.com/spaceuptech/space-cloud/gateway/managers/syncman"
	"github.com/spaceuptech/space-cloud/gateway/utils"
)
func HandleSetFileStore(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		token := utils.GetTokenFromHeader(r)
		vars := mux.Vars(r)
		projectID := vars["project"]
		value := new(config.FileStoreConfig)
		_ = json.NewDecoder(r.Body).Decode(value)
		defer utils.CloseTheCloser(r.Body)
		ctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)
		defer cancel()
		reqParams, err := adminMan.IsTokenValid(ctx, token, "filestore-config", "modify", map[string]string{"project": projectID})
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)
			return
		}
		reqParams = utils.ExtractRequestParams(r, reqParams, value)
		status, err := syncMan.SetFileStore(ctx, projectID, value, reqParams)
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, status, err)
			return
		}
		_ = helpers.Response.SendOkayResponse(ctx, status, w)
	}
}
func HandleGetFileStore(adminMan *admin.Manager, syncMan *syncman.Manager) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		token := utils.GetTokenFromHeader(r)
		vars := mux.Vars(r)
		projectID := vars["project"]
		ctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)
		defer cancel()
		reqParams, err := adminMan.IsTokenValid(ctx, token, "filestore-config", "read", map[string]string{"project": projectID})
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)
			return
		}
		reqParams = utils.ExtractRequestParams(r, reqParams, nil)
		status, fileConfig, err := syncMan.GetFileStoreConfig(ctx, projectID, reqParams)
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, status, err)
			return
		}
		_ = helpers.Response.SendResponse(ctx, w, status, model.Response{Result: fileConfig})
	}
}
func HandleGetFileState(adminMan *admin.Manager, modules *modules.Modules) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		vars := mux.Vars(r)
		projectID := vars["project"]
		token := utils.GetTokenFromHeader(r)
		defer utils.CloseTheCloser(r.Body)
		ctx, cancel := context.WithTimeout(r.Context(), time.Duration(utils.DefaultContextTime)*time.Second)
		defer cancel()
		_, err := adminMan.IsTokenValid(ctx, token, "filestore-config", "read", map[string]string{"project": projectID})
		if err != nil {
			_ = helpers.Response.SendErrorResponse(ctx, w, http.StatusUnauthorized, err)
			return
		}
		file, err := modules.File(projectID)
		if err != nil {
			w.Header().Set("Content-Type", "application/json")
			w.WriteHeader(http.StatusBadRequest)
			_ = json.NewEncoder(w).Encode(map[string]string{"error": err.Error()})
			return
		}
		if err := file.GetState(ctx); err != nil {
			_ = helpers.Response.SendResponse(ctx, w, http.StatusOK, model.Response{Result: false, Error: err.Error()})
			return
		}
		_ = helpers.Response.SendResponse(ctx, w, http.StatusOK, model.Response{Result: true})
	}
}