|
|
@ -461,8 +461,15 @@ func (a adminAPIHandlers) StartProfilingHandler(w http.ResponseWriter, r *http.R |
|
|
|
|
|
|
|
|
|
|
|
defer logger.AuditLog(w, r, "StartProfiling", mustGetClaimsFromToken(r)) |
|
|
|
defer logger.AuditLog(w, r, "StartProfiling", mustGetClaimsFromToken(r)) |
|
|
|
|
|
|
|
|
|
|
|
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ProfilingAdminAction) |
|
|
|
// Validate request signature.
|
|
|
|
if objectAPI == nil { |
|
|
|
_, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.ProfilingAdminAction, "") |
|
|
|
|
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
|
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if globalNotificationSys == nil { |
|
|
|
|
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -559,8 +566,15 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt |
|
|
|
|
|
|
|
|
|
|
|
defer logger.AuditLog(w, r, "DownloadProfiling", mustGetClaimsFromToken(r)) |
|
|
|
defer logger.AuditLog(w, r, "DownloadProfiling", mustGetClaimsFromToken(r)) |
|
|
|
|
|
|
|
|
|
|
|
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ProfilingAdminAction) |
|
|
|
// Validate request signature.
|
|
|
|
if objectAPI == nil { |
|
|
|
_, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.ProfilingAdminAction, "") |
|
|
|
|
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
|
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if globalNotificationSys == nil { |
|
|
|
|
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -900,7 +914,7 @@ func validateAdminReq(ctx context.Context, w http.ResponseWriter, r *http.Reques |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Validate request signature.
|
|
|
|
// Validate request signature.
|
|
|
|
cred, adminAPIErr = checkAdminRequestAuthType(ctx, r, action, "") |
|
|
|
cred, adminAPIErr = checkAdminRequestAuth(ctx, r, action, "") |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
return nil, cred |
|
|
|
return nil, cred |
|
|
@ -1032,7 +1046,7 @@ func (a adminAPIHandlers) TraceHandler(w http.ResponseWriter, r *http.Request) { |
|
|
|
trcErr := r.URL.Query().Get("err") == "true" |
|
|
|
trcErr := r.URL.Query().Get("err") == "true" |
|
|
|
|
|
|
|
|
|
|
|
// Validate request signature.
|
|
|
|
// Validate request signature.
|
|
|
|
_, adminAPIErr := checkAdminRequestAuthType(ctx, r, iampolicy.TraceAdminAction, "") |
|
|
|
_, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.TraceAdminAction, "") |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
@ -1431,7 +1445,7 @@ func (a adminAPIHandlers) BandwidthMonitorHandler(w http.ResponseWriter, r *http |
|
|
|
defer logger.AuditLog(w, r, "BandwidthMonitor", mustGetClaimsFromToken(r)) |
|
|
|
defer logger.AuditLog(w, r, "BandwidthMonitor", mustGetClaimsFromToken(r)) |
|
|
|
|
|
|
|
|
|
|
|
// Validate request signature.
|
|
|
|
// Validate request signature.
|
|
|
|
_, adminAPIErr := checkAdminRequestAuthType(ctx, r, iampolicy.BandwidthMonitorAction, "") |
|
|
|
_, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.BandwidthMonitorAction, "") |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|