2019-03-15 00:27:31 +01:00
|
|
|
/*
|
2019-04-09 20:39:42 +02:00
|
|
|
* MinIO Cloud Storage, (C) 2019 MinIO, Inc.
|
2019-03-15 00:27:31 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"encoding/gob"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
2019-08-19 04:56:32 +02:00
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
2019-03-15 00:27:31 +01:00
|
|
|
"net/http"
|
2019-06-07 02:46:22 +02:00
|
|
|
"strconv"
|
2019-03-15 00:27:31 +01:00
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
"github.com/minio/minio/cmd/logger"
|
2020-02-05 10:42:34 +01:00
|
|
|
bucketsse "github.com/minio/minio/pkg/bucket/encryption"
|
2020-01-27 23:12:34 +01:00
|
|
|
"github.com/minio/minio/pkg/bucket/lifecycle"
|
|
|
|
objectlock "github.com/minio/minio/pkg/bucket/object/lock"
|
|
|
|
"github.com/minio/minio/pkg/bucket/policy"
|
2019-03-15 00:27:31 +01:00
|
|
|
"github.com/minio/minio/pkg/event"
|
2020-03-27 05:07:39 +01:00
|
|
|
"github.com/minio/minio/pkg/madmin"
|
2019-06-09 00:54:41 +02:00
|
|
|
trace "github.com/minio/minio/pkg/trace"
|
2019-03-15 00:27:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// To abstract a node over network.
|
|
|
|
type peerRESTServer struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func getServerInfo() (*ServerInfoData, error) {
|
2019-11-09 18:27:23 +01:00
|
|
|
objLayer := newObjectLayerWithoutSafeModeFn()
|
|
|
|
if objLayer == nil {
|
2019-03-15 00:27:31 +01:00
|
|
|
return nil, errServerNotInitialized
|
|
|
|
}
|
2019-10-23 06:01:14 +02:00
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
// Server info data.
|
|
|
|
return &ServerInfoData{
|
2019-10-23 06:01:14 +02:00
|
|
|
ConnStats: globalConnStats.toServerConnStats(),
|
|
|
|
HTTPStats: globalHTTPStats.toServerHTTPStats(),
|
2019-03-15 00:27:31 +01:00
|
|
|
Properties: ServerProperties{
|
2019-12-12 02:56:02 +01:00
|
|
|
Uptime: UTCNow().Unix() - globalBootTime.Unix(),
|
2019-03-25 19:55:28 +01:00
|
|
|
Version: Version,
|
|
|
|
CommitID: CommitID,
|
|
|
|
DeploymentID: globalDeploymentID,
|
2020-04-21 18:38:32 +02:00
|
|
|
SQSARN: globalNotificationSys.GetARNList(false),
|
2019-10-23 07:59:13 +02:00
|
|
|
Region: globalServerRegion,
|
2019-03-15 00:27:31 +01:00
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetLocksHandler - returns list of older lock from the server.
|
|
|
|
func (s *peerRESTServer) GetLocksHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := newContext(r, w, "GetLocks")
|
2019-11-13 21:17:45 +01:00
|
|
|
|
|
|
|
var llockers []map[string][]lockRequesterInfo
|
|
|
|
for _, llocker := range globalLockServers {
|
|
|
|
llockers = append(llockers, llocker.DupLockMap())
|
|
|
|
}
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(llockers))
|
2019-03-15 00:27:31 +01:00
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
// DeletePolicyHandler - deletes a policy on the server.
|
|
|
|
func (s *peerRESTServer) DeletePolicyHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-06-07 02:46:22 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
policyName := vars[peerRESTPolicy]
|
|
|
|
if policyName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("policyName is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := globalIAMSys.DeletePolicy(policyName); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadPolicyHandler - reloads a policy on the server.
|
|
|
|
func (s *peerRESTServer) LoadPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-06-07 02:46:22 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
policyName := vars[peerRESTPolicy]
|
|
|
|
if policyName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("policyName is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := globalIAMSys.LoadPolicy(objAPI, policyName); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-08-13 22:41:06 +02:00
|
|
|
// LoadPolicyMappingHandler - reloads a policy mapping on the server.
|
|
|
|
func (s *peerRESTServer) LoadPolicyMappingHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-08-13 22:41:06 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-08-13 22:41:06 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
userOrGroup := vars[peerRESTUserOrGroup]
|
|
|
|
if userOrGroup == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("user-or-group is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
_, isGroup := vars[peerRESTIsGroup]
|
|
|
|
|
|
|
|
if err := globalIAMSys.LoadPolicyMapping(objAPI, userOrGroup, isGroup); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2020-04-24 21:10:09 +02:00
|
|
|
// DeleteServiceAccountHandler - deletes a service account on the server.
|
|
|
|
func (s *peerRESTServer) DeleteServiceAccountHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
accessKey := vars[peerRESTUser]
|
|
|
|
if accessKey == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("service account name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := globalIAMSys.DeleteServiceAccount(context.Background(), accessKey); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadServiceAccountHandler - reloads a service account on the server.
|
|
|
|
func (s *peerRESTServer) LoadServiceAccountHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
accessKey := vars[peerRESTUser]
|
|
|
|
if accessKey == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("service account parameter is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := globalIAMSys.LoadServiceAccount(accessKey); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
// DeleteUserHandler - deletes a user on the server.
|
|
|
|
func (s *peerRESTServer) DeleteUserHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-06-07 02:46:22 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
accessKey := vars[peerRESTUser]
|
|
|
|
if accessKey == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("username is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := globalIAMSys.DeleteUser(accessKey); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadUserHandler - reloads a user on the server.
|
|
|
|
func (s *peerRESTServer) LoadUserHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-06-07 02:46:22 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-06-07 02:46:22 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
accessKey := vars[peerRESTUser]
|
|
|
|
if accessKey == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("username is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
temp, err := strconv.ParseBool(vars[peerRESTUserTemp])
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-03-17 18:36:13 +01:00
|
|
|
var userType = regularUser
|
|
|
|
if temp {
|
|
|
|
userType = stsUser
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = globalIAMSys.LoadUser(objAPI, accessKey, userType); err != nil {
|
2019-06-07 02:46:22 +02:00
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-08-02 23:25:00 +02:00
|
|
|
// LoadGroupHandler - reloads group along with members list.
|
|
|
|
func (s *peerRESTServer) LoadGroupHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-08-02 23:25:00 +02:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-12 05:46:57 +01:00
|
|
|
if globalIAMSys == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-08-02 23:25:00 +02:00
|
|
|
vars := mux.Vars(r)
|
|
|
|
group := vars[peerRESTGroup]
|
|
|
|
err := globalIAMSys.LoadGroup(objAPI, group)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
// StartProfilingHandler - Issues the start profiling command.
|
|
|
|
func (s *peerRESTServer) StartProfilingHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
2020-01-11 02:19:58 +01:00
|
|
|
profiles := strings.Split(vars[peerRESTProfiler], ",")
|
|
|
|
if len(profiles) == 0 {
|
2019-03-15 00:27:31 +01:00
|
|
|
s.writeErrorResponse(w, errors.New("profiler name is missing"))
|
|
|
|
return
|
|
|
|
}
|
2020-01-11 02:19:58 +01:00
|
|
|
globalProfilerMu.Lock()
|
|
|
|
defer globalProfilerMu.Unlock()
|
|
|
|
if globalProfiler == nil {
|
|
|
|
globalProfiler = make(map[string]minioProfiler, 10)
|
|
|
|
}
|
2019-03-15 00:27:31 +01:00
|
|
|
|
2020-01-11 02:19:58 +01:00
|
|
|
// Stop profiler of all types if already running
|
|
|
|
for k, v := range globalProfiler {
|
|
|
|
for _, p := range profiles {
|
|
|
|
if p == k {
|
|
|
|
v.Stop()
|
|
|
|
delete(globalProfiler, k)
|
|
|
|
}
|
|
|
|
}
|
2019-03-15 00:27:31 +01:00
|
|
|
}
|
|
|
|
|
2020-01-11 02:19:58 +01:00
|
|
|
for _, profiler := range profiles {
|
|
|
|
prof, err := startProfiler(profiler)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
globalProfiler[profiler] = prof
|
2019-03-15 00:27:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2020-01-11 02:19:58 +01:00
|
|
|
// DownloadProfilingDataHandler - returns profiled data.
|
|
|
|
func (s *peerRESTServer) DownloadProfilingDataHandler(w http.ResponseWriter, r *http.Request) {
|
2019-03-15 00:27:31 +01:00
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := newContext(r, w, "DownloadProfiling")
|
|
|
|
profileData, err := getProfileData()
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(profileData))
|
|
|
|
}
|
|
|
|
|
2019-12-11 23:27:03 +01:00
|
|
|
// ServerInfoHandler - returns Server Info
|
|
|
|
func (s *peerRESTServer) ServerInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := newContext(r, w, "ServerInfo")
|
|
|
|
info := getLocalServerProperty(globalEndpoints, r)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
2020-03-27 05:07:39 +01:00
|
|
|
func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
ctx := newContext(r, w, "NetOBDInfo")
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use this trailer to send additional headers after sending body
|
|
|
|
w.Header().Set("Trailer", "FinalStatus")
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/octet-stream")
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
|
|
|
|
n, err := io.Copy(ioutil.Discard, r.Body)
|
|
|
|
if err == io.ErrUnexpectedEOF {
|
|
|
|
w.Header().Set("FinalStatus", err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if err != nil && err != io.EOF {
|
|
|
|
logger.LogIf(ctx, err)
|
|
|
|
w.Header().Set("FinalStatus", err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if n != r.ContentLength {
|
|
|
|
err := fmt.Errorf("OBD: short read: expected %d found %d", r.ContentLength, n)
|
|
|
|
|
|
|
|
logger.LogIf(ctx, err)
|
|
|
|
w.Header().Set("FinalStatus", err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.Header().Set("FinalStatus", "Success")
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *peerRESTServer) DispatchNetOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-04-18 20:06:11 +02:00
|
|
|
done := keepHTTPResponseAlive(w)
|
|
|
|
|
2020-03-27 05:07:39 +01:00
|
|
|
ctx := newContext(r, w, "DispatchNetOBDInfo")
|
|
|
|
info := globalNotificationSys.NetOBDInfo(ctx)
|
|
|
|
|
2020-04-18 20:06:11 +02:00
|
|
|
done()
|
2020-03-27 05:07:39 +01:00
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// DriveOBDInfoHandler - returns Drive OBD info.
|
|
|
|
func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "DriveOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
infoSerial := getLocalDrivesOBD(ctx, false, globalEndpoints, r)
|
|
|
|
infoParallel := getLocalDrivesOBD(ctx, true, globalEndpoints, r)
|
|
|
|
|
|
|
|
errStr := ""
|
|
|
|
if infoSerial.Error != "" {
|
|
|
|
errStr = "serial: " + infoSerial.Error
|
|
|
|
}
|
|
|
|
if infoParallel.Error != "" {
|
|
|
|
errStr = errStr + " parallel: " + infoParallel.Error
|
|
|
|
}
|
|
|
|
info := madmin.ServerDrivesOBDInfo{
|
|
|
|
Addr: infoSerial.Addr,
|
|
|
|
Serial: infoSerial.Serial,
|
|
|
|
Parallel: infoParallel.Parallel,
|
|
|
|
Error: errStr,
|
|
|
|
}
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
|
|
|
// CPUOBDInfoHandler - returns CPU OBD info.
|
|
|
|
func (s *peerRESTServer) CPUOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "CpuOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
info := getLocalCPUOBDInfo(ctx)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
|
|
|
// DiskHwOBDInfoHandler - returns Disk HW OBD info.
|
|
|
|
func (s *peerRESTServer) DiskHwOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "DiskHwOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
info := getLocalDiskHwOBD(ctx)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
|
|
|
// OsOBDInfoHandler - returns Os OBD info.
|
|
|
|
func (s *peerRESTServer) OsOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "OsOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
info := getLocalOsInfoOBD(ctx)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProcOBDInfoHandler - returns Proc OBD info.
|
|
|
|
func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "ProcOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
info := getLocalProcOBD(ctx)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
|
|
|
// MemOBDInfoHandler - returns Mem OBD info.
|
|
|
|
func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(newContext(r, w, "MemOBDInfo"))
|
|
|
|
defer cancel()
|
|
|
|
info := getLocalMemOBD(ctx)
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
|
|
}
|
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
// DeleteBucketHandler - Delete notification and policies related to the bucket.
|
|
|
|
func (s *peerRESTServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalNotificationSys.RemoveNotification(bucketName)
|
|
|
|
globalPolicySys.Remove(bucketName)
|
2019-11-21 22:18:32 +01:00
|
|
|
globalBucketObjectLockConfig.Remove(bucketName)
|
2020-05-01 00:55:54 +02:00
|
|
|
globalBucketQuotaSys.Remove(bucketName)
|
2019-11-21 22:18:32 +01:00
|
|
|
globalLifecycleSys.Remove(bucketName)
|
2019-03-15 00:27:31 +01:00
|
|
|
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReloadFormatHandler - Reload Format.
|
|
|
|
func (s *peerRESTServer) ReloadFormatHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
dryRunString := vars[peerRESTDryRun]
|
|
|
|
if dryRunString == "" {
|
2020-01-10 11:35:06 +01:00
|
|
|
s.writeErrorResponse(w, errors.New("dry-run parameter is missing"))
|
2019-03-15 00:27:31 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var dryRun bool
|
|
|
|
switch strings.ToLower(dryRunString) {
|
|
|
|
case "true":
|
|
|
|
dryRun = true
|
|
|
|
case "false":
|
|
|
|
dryRun = false
|
|
|
|
default:
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-09 18:27:23 +01:00
|
|
|
objAPI := newObjectLayerWithoutSafeModeFn()
|
2019-03-15 00:27:31 +01:00
|
|
|
if objAPI == nil {
|
|
|
|
s.writeErrorResponse(w, errServerNotInitialized)
|
|
|
|
return
|
|
|
|
}
|
2020-01-10 11:35:06 +01:00
|
|
|
|
2020-04-09 18:30:02 +02:00
|
|
|
err := objAPI.ReloadFormat(GlobalContext, dryRun)
|
2019-03-15 00:27:31 +01:00
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// RemoveBucketPolicyHandler - Remove bucket policy.
|
|
|
|
func (s *peerRESTServer) RemoveBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalPolicySys.Remove(bucketName)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBucketPolicyHandler - Set bucket policy.
|
|
|
|
func (s *peerRESTServer) SetBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
2020-05-04 18:42:58 +02:00
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-05-04 18:42:58 +02:00
|
|
|
var policyData = &policy.Policy{}
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(policyData)
|
2019-03-15 00:27:31 +01:00
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
globalPolicySys.Set(bucketName, policyData)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-07-19 22:20:33 +02:00
|
|
|
// RemoveBucketLifecycleHandler - Remove bucket lifecycle.
|
|
|
|
func (s *peerRESTServer) RemoveBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalLifecycleSys.Remove(bucketName)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBucketLifecycleHandler - Set bucket lifecycle.
|
|
|
|
func (s *peerRESTServer) SetBucketLifecycleHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-05-04 18:42:58 +02:00
|
|
|
var lifecycleData = &lifecycle.Lifecycle{}
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(lifecycleData)
|
2019-07-19 22:20:33 +02:00
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
globalLifecycleSys.Set(bucketName, lifecycleData)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2020-02-05 10:42:34 +01:00
|
|
|
// RemoveBucketSSEConfigHandler - Remove bucket encryption.
|
|
|
|
func (s *peerRESTServer) RemoveBucketSSEConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalBucketSSEConfigSys.Remove(bucketName)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBucketSSEConfigHandler - Set bucket encryption.
|
|
|
|
func (s *peerRESTServer) SetBucketSSEConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-05-04 18:42:58 +02:00
|
|
|
var encConfig = &bucketsse.BucketSSEConfig{}
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(encConfig)
|
2020-02-05 10:42:34 +01:00
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalBucketSSEConfigSys.Set(bucketName, encConfig)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2020-04-27 19:06:21 +02:00
|
|
|
// CycleServerBloomFilterHandler cycles bllom filter on server.
|
|
|
|
func (s *peerRESTServer) CycleServerBloomFilterHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := newContext(r, w, "CycleServerBloomFilter")
|
|
|
|
|
|
|
|
var req bloomFilterRequest
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(&req)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
bf, err := intDataUpdateTracker.cycleFilter(ctx, req.Oldest, req.Current)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(bf))
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
// PutBucketNotificationHandler - Set bucket policy.
|
|
|
|
func (s *peerRESTServer) PutBucketNotificationHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var rulesMap event.RulesMap
|
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(&rulesMap)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalNotificationSys.AddRulesMap(bucketName, rulesMap)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-11-21 22:18:32 +01:00
|
|
|
// RemoveBucketObjectLockConfigHandler - handles DELETE bucket object lock configuration.
|
|
|
|
func (s *peerRESTServer) RemoveBucketObjectLockConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalBucketObjectLockConfig.Remove(bucketName)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-11-12 23:50:18 +01:00
|
|
|
// PutBucketObjectLockConfigHandler - handles PUT bucket object lock configuration.
|
|
|
|
func (s *peerRESTServer) PutBucketObjectLockConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-05-04 18:42:58 +02:00
|
|
|
var retention = &objectlock.Retention{}
|
|
|
|
err := gob.NewDecoder(r.Body).Decode(retention)
|
2019-11-12 23:50:18 +01:00
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-11-20 22:18:09 +01:00
|
|
|
globalBucketObjectLockConfig.Set(bucketName, retention)
|
2019-11-12 23:50:18 +01:00
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2020-05-01 00:55:54 +02:00
|
|
|
// PutBucketQuotaConfigHandler - handles PUT bucket quota configuration.
|
|
|
|
func (s *peerRESTServer) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var quota madmin.BucketQuota
|
|
|
|
if r.ContentLength < 0 {
|
|
|
|
s.writeErrorResponse(w, errInvalidArgument)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err := gob.NewDecoder(r.Body).Decode("a)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalBucketQuotaSys.Set(bucketName, quota)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
// RemoveBucketQuotaConfigHandler - handles DELETE bucket quota configuration.
|
|
|
|
func (s *peerRESTServer) RemoveBucketQuotaConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
bucketName := vars[peerRESTBucket]
|
|
|
|
if bucketName == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("Bucket name is missing"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
globalBucketQuotaSys.Remove(bucketName)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
|
2019-08-29 00:04:43 +02:00
|
|
|
// ServerUpdateHandler - updates the current server.
|
|
|
|
func (s *peerRESTServer) ServerUpdateHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
updateURL := vars[peerRESTUpdateURL]
|
|
|
|
sha256Hex := vars[peerRESTSha256Hex]
|
|
|
|
var latestReleaseTime time.Time
|
|
|
|
var err error
|
|
|
|
if latestRelease := vars[peerRESTLatestRelease]; latestRelease != "" {
|
|
|
|
latestReleaseTime, err = time.Parse(latestRelease, time.RFC3339)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
us, err := updateServer(updateURL, sha256Hex, latestReleaseTime)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if us.CurrentVersion != us.UpdatedVersion {
|
|
|
|
globalServiceSignalCh <- serviceRestart
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
var errUnsupportedSignal = fmt.Errorf("unsupported signal: only restart and stop signals are supported")
|
|
|
|
|
|
|
|
// SignalServiceHandler - signal service handler.
|
|
|
|
func (s *peerRESTServer) SignalServiceHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
vars := mux.Vars(r)
|
|
|
|
signalString := vars[peerRESTSignal]
|
|
|
|
if signalString == "" {
|
|
|
|
s.writeErrorResponse(w, errors.New("signal name is missing"))
|
|
|
|
return
|
|
|
|
}
|
2019-08-27 20:37:47 +02:00
|
|
|
si, err := strconv.Atoi(signalString)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
signal := serviceSignal(si)
|
2019-03-15 00:27:31 +01:00
|
|
|
defer w.(http.Flusher).Flush()
|
2019-08-29 00:04:43 +02:00
|
|
|
switch signal {
|
|
|
|
case serviceRestart:
|
|
|
|
globalServiceSignalCh <- signal
|
|
|
|
case serviceStop:
|
2019-03-15 00:27:31 +01:00
|
|
|
globalServiceSignalCh <- signal
|
|
|
|
default:
|
|
|
|
s.writeErrorResponse(w, errUnsupportedSignal)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-12 19:01:23 +01:00
|
|
|
// ListenHandler sends http trace messages back to peer rest client
|
|
|
|
func (s *peerRESTServer) ListenHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-12-17 05:30:57 +01:00
|
|
|
values := r.URL.Query()
|
|
|
|
|
|
|
|
var prefix string
|
|
|
|
if len(values[peerRESTListenPrefix]) > 1 {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(values[peerRESTListenPrefix]) == 1 {
|
|
|
|
if err := event.ValidateFilterRuleValue(values[peerRESTListenPrefix][0]); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix = values[peerRESTListenPrefix][0]
|
|
|
|
}
|
|
|
|
|
|
|
|
var suffix string
|
|
|
|
if len(values[peerRESTListenSuffix]) > 1 {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(values[peerRESTListenSuffix]) == 1 {
|
|
|
|
if err := event.ValidateFilterRuleValue(values[peerRESTListenSuffix][0]); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
suffix = values[peerRESTListenSuffix][0]
|
|
|
|
}
|
|
|
|
|
|
|
|
pattern := event.NewPattern(prefix, suffix)
|
|
|
|
|
|
|
|
var eventNames []event.Name
|
|
|
|
for _, ev := range values[peerRESTListenEvents] {
|
|
|
|
eventName, err := event.ParseName(ev)
|
|
|
|
if err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
eventNames = append(eventNames, eventName)
|
|
|
|
}
|
|
|
|
|
|
|
|
rulesMap := event.NewRulesMap(eventNames, pattern, event.TargetID{ID: mustGetUUID()})
|
|
|
|
|
2019-12-12 19:01:23 +01:00
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
|
|
|
|
doneCh := make(chan struct{})
|
|
|
|
defer close(doneCh)
|
|
|
|
|
|
|
|
// Listen Publisher uses nonblocking publish and hence does not wait for slow subscribers.
|
|
|
|
// Use buffered channel to take care of burst sends or slow w.Write()
|
|
|
|
ch := make(chan interface{}, 2000)
|
|
|
|
|
2019-12-17 05:30:57 +01:00
|
|
|
globalHTTPListen.Subscribe(ch, doneCh, func(evI interface{}) bool {
|
|
|
|
ev, ok := evI.(event.Event)
|
|
|
|
if !ok {
|
|
|
|
return false
|
|
|
|
}
|
2019-12-20 20:45:03 +01:00
|
|
|
if ev.S3.Bucket.Name != values.Get(peerRESTListenBucket) {
|
|
|
|
return false
|
|
|
|
}
|
2020-04-27 15:25:05 +02:00
|
|
|
return rulesMap.MatchSimple(ev.EventName, ev.S3.Object.Key)
|
2019-12-12 19:01:23 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
keepAliveTicker := time.NewTicker(500 * time.Millisecond)
|
|
|
|
defer keepAliveTicker.Stop()
|
|
|
|
|
|
|
|
enc := gob.NewEncoder(w)
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case ev := <-ch:
|
|
|
|
if err := enc.Encode(ev); err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
case <-keepAliveTicker.C:
|
|
|
|
if err := enc.Encode(&event.Event{}); err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-09 00:54:41 +02:00
|
|
|
// TraceHandler sends http trace messages back to peer rest client
|
|
|
|
func (s *peerRESTServer) TraceHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
trcAll := r.URL.Query().Get(peerRESTTraceAll) == "true"
|
2019-07-20 02:38:26 +02:00
|
|
|
trcErr := r.URL.Query().Get(peerRESTTraceErr) == "true"
|
2019-06-09 00:54:41 +02:00
|
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
|
2019-06-27 07:41:12 +02:00
|
|
|
doneCh := make(chan struct{})
|
|
|
|
defer close(doneCh)
|
|
|
|
|
|
|
|
// Trace Publisher uses nonblocking publish and hence does not wait for slow subscribers.
|
|
|
|
// Use buffered channel to take care of burst sends or slow w.Write()
|
|
|
|
ch := make(chan interface{}, 2000)
|
2019-07-31 20:08:39 +02:00
|
|
|
|
|
|
|
globalHTTPTrace.Subscribe(ch, doneCh, func(entry interface{}) bool {
|
|
|
|
return mustTrace(entry, trcAll, trcErr)
|
|
|
|
})
|
|
|
|
|
|
|
|
keepAliveTicker := time.NewTicker(500 * time.Millisecond)
|
|
|
|
defer keepAliveTicker.Stop()
|
2019-06-27 07:41:12 +02:00
|
|
|
|
|
|
|
enc := gob.NewEncoder(w)
|
2019-06-09 00:54:41 +02:00
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case entry := <-ch:
|
2019-06-27 07:41:12 +02:00
|
|
|
if err := enc.Encode(entry); err != nil {
|
2019-06-09 00:54:41 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
2019-07-31 20:08:39 +02:00
|
|
|
case <-keepAliveTicker.C:
|
|
|
|
if err := enc.Encode(&trace.Info{}); err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
2019-06-09 00:54:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-26 01:42:24 +02:00
|
|
|
func (s *peerRESTServer) BackgroundHealStatusHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx := newContext(r, w, "BackgroundHealStatus")
|
|
|
|
|
|
|
|
state := getLocalBackgroundHealStatus()
|
|
|
|
|
|
|
|
defer w.(http.Flusher).Flush()
|
|
|
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(state))
|
|
|
|
}
|
|
|
|
|
2019-09-03 20:10:48 +02:00
|
|
|
// ConsoleLogHandler sends console logs of this node back to peer rest client
|
|
|
|
func (s *peerRESTServer) ConsoleLogHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
if !s.IsValid(w, r) {
|
|
|
|
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.Header().Set("Connection", "close")
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
|
|
|
|
doneCh := make(chan struct{})
|
|
|
|
defer close(doneCh)
|
|
|
|
|
|
|
|
ch := make(chan interface{}, 2000)
|
2019-10-12 03:50:54 +02:00
|
|
|
globalConsoleSys.Subscribe(ch, doneCh, "", 0, string(logger.All), nil)
|
2019-09-03 20:10:48 +02:00
|
|
|
|
|
|
|
enc := gob.NewEncoder(w)
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case entry := <-ch:
|
2019-09-22 10:24:32 +02:00
|
|
|
if err := enc.Encode(entry); err != nil {
|
2019-09-03 20:10:48 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
w.(http.Flusher).Flush()
|
|
|
|
case <-r.Context().Done():
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-15 00:27:31 +01:00
|
|
|
func (s *peerRESTServer) writeErrorResponse(w http.ResponseWriter, err error) {
|
|
|
|
w.WriteHeader(http.StatusForbidden)
|
|
|
|
w.Write([]byte(err.Error()))
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsValid - To authenticate and verify the time difference.
|
|
|
|
func (s *peerRESTServer) IsValid(w http.ResponseWriter, r *http.Request) bool {
|
|
|
|
if err := storageServerRequestValidate(r); err != nil {
|
|
|
|
s.writeErrorResponse(w, err)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// registerPeerRESTHandlers - register peer rest router.
|
|
|
|
func registerPeerRESTHandlers(router *mux.Router) {
|
|
|
|
server := &peerRESTServer{}
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter := router.PathPrefix(peerRESTPrefix).Subrouter()
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodGetLocks).HandlerFunc(httpTraceHdrs(server.GetLocksHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodServerInfo).HandlerFunc(httpTraceHdrs(server.ServerInfoHandler))
|
2020-03-27 05:07:39 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcOBDInfo).HandlerFunc(httpTraceHdrs(server.ProcOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemOBDInfo).HandlerFunc(httpTraceHdrs(server.MemOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfoOBDInfo).HandlerFunc(httpTraceHdrs(server.OsOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwOBDInfo).HandlerFunc(httpTraceHdrs(server.DiskHwOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCPUOBDInfo).HandlerFunc(httpTraceHdrs(server.CPUOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDriveOBDInfo).HandlerFunc(httpTraceHdrs(server.DriveOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodNetOBDInfo).HandlerFunc(httpTraceHdrs(server.NetOBDInfoHandler))
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDispatchNetOBDInfo).HandlerFunc(httpTraceHdrs(server.DispatchNetOBDInfoHandler))
|
2020-04-27 19:06:21 +02:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCycleBloom).HandlerFunc(httpTraceHdrs(server.CycleServerBloomFilterHandler))
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDeleteBucket).HandlerFunc(httpTraceHdrs(server.DeleteBucketHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodSignalService).HandlerFunc(httpTraceHdrs(server.SignalServiceHandler)).Queries(restQueries(peerRESTSignal)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodServerUpdate).HandlerFunc(httpTraceHdrs(server.ServerUpdateHandler)).Queries(restQueries(peerRESTUpdateURL, peerRESTSha256Hex, peerRESTLatestRelease)...)
|
|
|
|
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketPolicyRemove).HandlerFunc(httpTraceAll(server.RemoveBucketPolicyHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketPolicySet).HandlerFunc(httpTraceHdrs(server.SetBucketPolicyHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDeletePolicy).HandlerFunc(httpTraceAll(server.DeletePolicyHandler)).Queries(restQueries(peerRESTPolicy)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadPolicy).HandlerFunc(httpTraceAll(server.LoadPolicyHandler)).Queries(restQueries(peerRESTPolicy)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadPolicyMapping).HandlerFunc(httpTraceAll(server.LoadPolicyMappingHandler)).Queries(restQueries(peerRESTUserOrGroup)...)
|
2020-04-21 17:35:19 +02:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDeleteUser).HandlerFunc(httpTraceAll(server.DeleteUserHandler)).Queries(restQueries(peerRESTUser)...)
|
2020-04-24 21:10:09 +02:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDeleteServiceAccount).HandlerFunc(httpTraceAll(server.DeleteServiceAccountHandler)).Queries(restQueries(peerRESTUser)...)
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadUser).HandlerFunc(httpTraceAll(server.LoadUserHandler)).Queries(restQueries(peerRESTUser, peerRESTUserTemp)...)
|
2020-04-24 21:10:09 +02:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadServiceAccount).HandlerFunc(httpTraceAll(server.LoadServiceAccountHandler)).Queries(restQueries(peerRESTUser)...)
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadGroup).HandlerFunc(httpTraceAll(server.LoadGroupHandler)).Queries(restQueries(peerRESTGroup)...)
|
|
|
|
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodStartProfiling).HandlerFunc(httpTraceAll(server.StartProfilingHandler)).Queries(restQueries(peerRESTProfiler)...)
|
2020-01-11 02:19:58 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDownloadProfilingData).HandlerFunc(httpTraceHdrs(server.DownloadProfilingDataHandler))
|
2019-11-04 18:30:59 +01:00
|
|
|
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketNotificationPut).HandlerFunc(httpTraceHdrs(server.PutBucketNotificationHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodReloadFormat).HandlerFunc(httpTraceHdrs(server.ReloadFormatHandler)).Queries(restQueries(peerRESTDryRun)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketLifecycleSet).HandlerFunc(httpTraceHdrs(server.SetBucketLifecycleHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketLifecycleRemove).HandlerFunc(httpTraceHdrs(server.RemoveBucketLifecycleHandler)).Queries(restQueries(peerRESTBucket)...)
|
2020-02-05 10:42:34 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketEncryptionSet).HandlerFunc(httpTraceHdrs(server.SetBucketSSEConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketEncryptionRemove).HandlerFunc(httpTraceHdrs(server.RemoveBucketSSEConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodTrace).HandlerFunc(server.TraceHandler)
|
2019-12-17 05:30:57 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodListen).HandlerFunc(httpTraceHdrs(server.ListenHandler))
|
2019-11-04 18:30:59 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBackgroundHealStatus).HandlerFunc(server.BackgroundHealStatusHandler)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLog).HandlerFunc(server.ConsoleLogHandler)
|
2019-11-21 22:18:32 +01:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodPutBucketObjectLockConfig).HandlerFunc(httpTraceHdrs(server.PutBucketObjectLockConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketObjectLockConfigRemove).HandlerFunc(httpTraceHdrs(server.RemoveBucketObjectLockConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
2020-05-01 00:55:54 +02:00
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodPutBucketQuotaConfig).HandlerFunc(httpTraceHdrs(server.PutBucketQuotaConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
|
|
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodBucketQuotaConfigRemove).HandlerFunc(httpTraceHdrs(server.RemoveBucketQuotaConfigHandler)).Queries(restQueries(peerRESTBucket)...)
|
2019-03-15 00:27:31 +01:00
|
|
|
}
|