move madmin to github.com/minio/madmin-go (#12239)

This commit is contained in:
Harshavardhana
2021-05-06 08:52:02 -07:00
committed by GitHub
parent ddc1e4b5b3
commit 1aa5858543
146 changed files with 668 additions and 9918 deletions

View File

@@ -24,9 +24,9 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -27,6 +27,7 @@ import (
"strings"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/config/cache"
"github.com/minio/minio/cmd/config/etcd"
@@ -37,7 +38,6 @@ import (
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
func validateAdminReqConfigKV(ctx context.Context, w http.ResponseWriter, r *http.Request) (auth.Credentials, ObjectLayer) {

View File

@@ -18,6 +18,7 @@
package cmd
import (
"bytes"
"context"
"encoding/json"
"errors"
@@ -27,11 +28,11 @@ import (
"sort"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config/dns"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
func validateAdminUsersReq(ctx context.Context, w http.ResponseWriter, r *http.Request, action iampolicy.AdminAction) (ObjectLayer, auth.Credentials) {
@@ -533,7 +534,20 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque
targetGroups = cred.Groups
}
opts := newServiceAccountOpts{sessionPolicy: createReq.Policy, accessKey: createReq.AccessKey, secretKey: createReq.SecretKey}
var sp *iampolicy.Policy
if len(createReq.Policy) > 0 {
sp, err = iampolicy.ParseConfig(bytes.NewReader(createReq.Policy))
if err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
}
opts := newServiceAccountOpts{
accessKey: createReq.AccessKey,
secretKey: createReq.SecretKey,
sessionPolicy: sp,
}
newCred, err := globalIAMSys.NewServiceAccount(ctx, targetUser, targetGroups, opts)
if err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
@@ -549,7 +563,7 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque
}
var createResp = madmin.AddServiceAccountResp{
Credentials: auth.Credentials{
Credentials: madmin.Credentials{
AccessKey: newCred.AccessKey,
SecretKey: newCred.SecretKey,
},
@@ -632,7 +646,19 @@ func (a adminAPIHandlers) UpdateServiceAccount(w http.ResponseWriter, r *http.Re
return
}
opts := updateServiceAccountOpts{sessionPolicy: updateReq.NewPolicy, secretKey: updateReq.NewSecretKey, status: updateReq.NewStatus}
var sp *iampolicy.Policy
if len(updateReq.NewPolicy) > 0 {
sp, err = iampolicy.ParseConfig(bytes.NewReader(updateReq.NewPolicy))
if err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
}
opts := updateServiceAccountOpts{
secretKey: updateReq.NewSecretKey,
status: updateReq.NewStatus,
sessionPolicy: sp,
}
err = globalIAMSys.UpdateServiceAccount(ctx, accessKey, opts)
if err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
@@ -988,9 +1014,16 @@ func (a adminAPIHandlers) AccountInfoHandler(w http.ResponseWriter, r *http.Requ
return
}
p := globalIAMSys.GetCombinedPolicy(policies...)
buf, err := json.Marshal(p)
if err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
acctInfo := madmin.AccountInfo{
AccountName: accountName,
Policy: globalIAMSys.GetCombinedPolicy(policies...),
Policy: buf,
}
for _, bucket := range buckets {

View File

@@ -37,6 +37,7 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/crypto"
xhttp "github.com/minio/minio/cmd/http"
@@ -47,9 +48,7 @@ import (
"github.com/minio/minio/pkg/handlers"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
trace "github.com/minio/minio/pkg/trace"
)
const (
@@ -1061,13 +1060,13 @@ func toAdminAPIErr(ctx context.Context, err error) APIError {
return apiErr
}
// Returns true if the trace.Info should be traced,
// Returns true if the madmin.TraceInfo should be traced,
// false if certain conditions are not met.
// - input entry is not of the type *trace.Info*
// - input entry is not of the type *madmin.TraceInfo*
// - errOnly entries are to be traced, not status code 2xx, 3xx.
// - trace.Info type is asked by opts
// - madmin.TraceInfo type is asked by opts
func mustTrace(entry interface{}, opts madmin.ServiceTraceOpts) (shouldTrace bool) {
trcInfo, ok := entry.(trace.Info)
trcInfo, ok := entry.(madmin.TraceInfo)
if !ok {
return false
}
@@ -1082,11 +1081,11 @@ func mustTrace(entry interface{}, opts madmin.ServiceTraceOpts) (shouldTrace boo
if opts.Threshold > 0 {
var latency time.Duration
switch trcInfo.TraceType {
case trace.OS:
case madmin.TraceOS:
latency = trcInfo.OSStats.Duration
case trace.Storage:
case madmin.TraceStorage:
latency = trcInfo.StorageStats.Duration
case trace.HTTP:
case madmin.TraceHTTP:
latency = trcInfo.CallStats.Latency
}
if latency < opts.Threshold {
@@ -1094,19 +1093,19 @@ func mustTrace(entry interface{}, opts madmin.ServiceTraceOpts) (shouldTrace boo
}
}
if opts.Internal && trcInfo.TraceType == trace.HTTP && HasPrefix(trcInfo.ReqInfo.Path, minioReservedBucketPath+SlashSeparator) {
if opts.Internal && trcInfo.TraceType == madmin.TraceHTTP && HasPrefix(trcInfo.ReqInfo.Path, minioReservedBucketPath+SlashSeparator) {
return true
}
if opts.S3 && trcInfo.TraceType == trace.HTTP && !HasPrefix(trcInfo.ReqInfo.Path, minioReservedBucketPath+SlashSeparator) {
if opts.S3 && trcInfo.TraceType == madmin.TraceHTTP && !HasPrefix(trcInfo.ReqInfo.Path, minioReservedBucketPath+SlashSeparator) {
return true
}
if opts.Storage && trcInfo.TraceType == trace.Storage {
if opts.Storage && trcInfo.TraceType == madmin.TraceStorage {
return true
}
return opts.OS && trcInfo.TraceType == trace.OS
return opts.OS && trcInfo.TraceType == madmin.TraceOS
}
func extractTraceOptions(r *http.Request) (opts madmin.ServiceTraceOpts, err error) {

View File

@@ -30,8 +30,8 @@ import (
"testing"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/madmin"
)
// adminErasureTestBed - encapsulates subsystems that need to be setup for

View File

@@ -26,8 +26,8 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/madmin"
)
// healStatusSummary - overall short summary of a healing sequence

View File

@@ -21,7 +21,7 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
const (

View File

@@ -23,8 +23,8 @@ import (
"runtime"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/madmin"
)
// getLocalServerProperty - returns madmin.ServerProperties for only the

View File

@@ -21,8 +21,8 @@ import (
"context"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/madmin"
)
// healTask represents what to heal along with options

View File

@@ -30,11 +30,11 @@ import (
"time"
"github.com/dustin/go-humanize"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/color"
"github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -24,6 +24,7 @@ import (
"fmt"
"sync"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/cmd/crypto"
"github.com/minio/minio/cmd/logger"
@@ -34,7 +35,6 @@ import (
"github.com/minio/minio/pkg/bucket/replication"
"github.com/minio/minio/pkg/bucket/versioning"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -29,6 +29,7 @@ import (
"path"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/cmd/crypto"
"github.com/minio/minio/cmd/logger"
@@ -41,7 +42,6 @@ import (
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/fips"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/sio"
)

View File

@@ -23,9 +23,9 @@ import (
"fmt"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/madmin"
)
// BucketQuotaSys - map of bucket and quota configuration.

View File

@@ -26,6 +26,7 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
minio "github.com/minio/minio-go/v7"
miniogo "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/encrypt"
@@ -38,7 +39,6 @@ import (
"github.com/minio/minio/pkg/bucket/replication"
"github.com/minio/minio/pkg/event"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
// gets replication config associated to a given bucket name.

View File

@@ -26,13 +26,13 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
minio "github.com/minio/minio-go/v7"
miniogo "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio/cmd/crypto"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/bucket/versioning"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -24,6 +24,7 @@ import (
"strings"
"sync"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/config/api"
"github.com/minio/minio/cmd/config/cache"
@@ -43,7 +44,6 @@ import (
"github.com/minio/minio/cmd/logger/target/http"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
)
func initHelp() {

View File

@@ -25,11 +25,11 @@ import (
"time"
"unicode/utf8"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
etcd "go.etcd.io/etcd/clientv3"
)

View File

@@ -21,8 +21,8 @@ import (
"bytes"
"testing"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/madmin"
)
func TestDecryptData(t *testing.T) {

View File

@@ -27,6 +27,7 @@ import (
"strings"
"unicode/utf8"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/config/cache"
"github.com/minio/minio/cmd/config/compress"
@@ -40,7 +41,6 @@ import (
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/event/target"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
"github.com/minio/minio/pkg/quick"
)

View File

@@ -26,9 +26,9 @@ import (
"unicode/utf8"
jsoniter "github.com/json-iterator/go"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -24,10 +24,10 @@ import (
"regexp"
"strings"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin"
)
// Error config error type

View File

@@ -20,7 +20,7 @@ package config
import (
"testing"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
func TestKVFields(t *testing.T) {

View File

@@ -31,6 +31,7 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config/heal"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/logger/message/audit"
@@ -40,7 +41,6 @@ import (
"github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
"github.com/willf/bloom"
)

View File

@@ -30,10 +30,10 @@ import (
"github.com/cespare/xxhash/v2"
"github.com/klauspost/compress/zstd"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/bucket/lifecycle"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
"github.com/tinylib/msgp/msgp"
)

View File

@@ -24,9 +24,9 @@ import (
"net/http"
jsoniter "github.com/json-iterator/go"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -22,8 +22,8 @@ import (
"context"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/bucket/lifecycle"
"github.com/minio/minio/pkg/madmin"
)
// commonTime returns a maximally occurring time from a list of time.

View File

@@ -26,7 +26,7 @@ import (
"testing"
"time"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// validates functionality provided to find most common

View File

@@ -26,9 +26,9 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/bucket/lifecycle"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -28,7 +28,7 @@ import (
"time"
"github.com/dustin/go-humanize"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// Tests both object and bucket healing.

View File

@@ -28,6 +28,7 @@ import (
"strings"
"sync"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/tags"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
@@ -35,7 +36,6 @@ import (
"github.com/minio/minio/pkg/bucket/replication"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/mimedb"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -30,11 +30,11 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/cmd/config/storageclass"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
"github.com/minio/minio/pkg/wildcard"
)

View File

@@ -32,6 +32,7 @@ import (
"github.com/dchest/siphash"
"github.com/dustin/go-humanize"
"github.com/google/uuid"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/cmd/logger"
@@ -39,7 +40,6 @@ import (
"github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/dsync"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -27,11 +27,11 @@ import (
"sync"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/bpool"
"github.com/minio/minio/pkg/color"
"github.com/minio/minio/pkg/dsync"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -34,6 +34,7 @@ import (
"time"
jsoniter "github.com/json-iterator/go"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/s3utils"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/cmd/config"
@@ -43,7 +44,6 @@ import (
"github.com/minio/minio/pkg/color"
xioutil "github.com/minio/minio/pkg/ioutil"
"github.com/minio/minio/pkg/lock"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/mimedb"
"github.com/minio/minio/pkg/mountinfo"
)

View File

@@ -23,7 +23,7 @@ import (
"path/filepath"
"testing"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// Tests for if parent directory is object

View File

@@ -29,7 +29,7 @@ import (
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/bucket/versioning"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// GatewayUnsupported list of unsupported call stubs for gateway.

View File

@@ -40,6 +40,7 @@ import (
"github.com/Azure/azure-storage-blob-go/azblob"
humanize "github.com/dustin/go-humanize"
"github.com/minio/cli"
"github.com/minio/madmin-go"
miniogopolicy "github.com/minio/minio-go/v7/pkg/policy"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/cmd/logger"
@@ -47,7 +48,6 @@ import (
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/bucket/policy/condition"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -37,6 +37,7 @@ import (
"cloud.google.com/go/storage"
humanize "github.com/dustin/go-humanize"
"github.com/minio/cli"
"github.com/minio/madmin-go"
miniogopolicy "github.com/minio/minio-go/v7/pkg/policy"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/cmd/logger"
@@ -44,7 +45,6 @@ import (
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/bucket/policy/condition"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"google.golang.org/api/option"

View File

@@ -38,12 +38,12 @@ import (
"github.com/jcmturner/gokrb5/v8/credentials"
"github.com/jcmturner/gokrb5/v8/keytab"
"github.com/minio/cli"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/s3utils"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
)

View File

@@ -20,9 +20,9 @@ import (
"context"
"github.com/minio/cli"
"github.com/minio/madmin-go"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/madmin"
)
func init() {

View File

@@ -27,6 +27,7 @@ import (
"time"
"github.com/minio/cli"
"github.com/minio/madmin-go"
miniogo "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7/pkg/encrypt"
@@ -37,7 +38,6 @@ import (
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/madmin"
)
func init() {

View File

@@ -24,10 +24,10 @@ import (
"sort"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/color"
"github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/wildcard"
)

View File

@@ -32,11 +32,11 @@ import (
"regexp"
"strings"
"github.com/minio/madmin-go"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/handlers"
"github.com/minio/minio/pkg/madmin"
)
const (

View File

@@ -25,8 +25,8 @@ import (
"sync"
"syscall"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/disk"
"github.com/minio/minio/pkg/madmin"
cpuhw "github.com/shirou/gopsutil/v3/cpu"
memhw "github.com/shirou/gopsutil/v3/mem"
"github.com/shirou/gopsutil/v3/process"

View File

@@ -25,7 +25,7 @@ import (
"net/http"
"strings"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/smart"
diskhw "github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/host"

View File

@@ -24,7 +24,7 @@ import (
"net/http"
"runtime"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskHwInfo {

View File

@@ -31,9 +31,9 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/handlers"
trace "github.com/minio/minio/pkg/trace"
jsonrpc "github.com/minio/rpc"
)
@@ -111,7 +111,7 @@ func getOpName(name string) (op string) {
}
// WebTrace gets trace of web request
func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
func WebTrace(ri *jsonrpc.RequestInfo) madmin.TraceInfo {
r := ri.Request
w := ri.ResponseWriter
@@ -126,7 +126,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
}
now := time.Now().UTC()
t := trace.Info{TraceType: trace.HTTP, FuncName: name, Time: now}
t := madmin.TraceInfo{TraceType: madmin.TraceHTTP, FuncName: name, Time: now}
t.NodeName = r.Host
if globalIsDistErasure {
t.NodeName = globalLocalNodeName
@@ -143,7 +143,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
}
vars := mux.Vars(r)
rq := trace.RequestInfo{
rq := madmin.TraceRequestInfo{
Time: now,
Proto: r.Proto,
Method: r.Method,
@@ -155,7 +155,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
rw, ok := w.(*logger.ResponseWriter)
if ok {
rs := trace.ResponseInfo{
rs := madmin.TraceResponseInfo{
Time: time.Now().UTC(),
Headers: rw.Header().Clone(),
StatusCode: rw.StatusCode,
@@ -167,7 +167,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
}
t.RespInfo = rs
t.CallStats = trace.CallStats{
t.CallStats = madmin.TraceCallStats{
Latency: rs.Time.Sub(rw.StartTime),
InputBytes: int(r.ContentLength),
OutputBytes: rw.Size(),
@@ -180,7 +180,7 @@ func WebTrace(ri *jsonrpc.RequestInfo) trace.Info {
}
// Trace gets trace of http request
func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Request) trace.Info {
func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Request) madmin.TraceInfo {
name := getOpName(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name())
// Setup a http request body recorder
@@ -196,7 +196,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
r.Body = ioutil.NopCloser(reqBodyRecorder)
now := time.Now().UTC()
t := trace.Info{TraceType: trace.HTTP, FuncName: name, Time: now}
t := madmin.TraceInfo{TraceType: madmin.TraceHTTP, FuncName: name, Time: now}
t.NodeName = r.Host
if globalIsDistErasure {
@@ -214,7 +214,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
}
}
rq := trace.RequestInfo{
rq := madmin.TraceRequestInfo{
Time: now,
Proto: r.Proto,
Method: r.Method,
@@ -231,7 +231,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
// Execute call.
f(rw, r)
rs := trace.ResponseInfo{
rs := madmin.TraceResponseInfo{
Time: time.Now().UTC(),
Headers: rw.Header().Clone(),
StatusCode: rw.StatusCode,
@@ -248,7 +248,7 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ
t.ReqInfo = rq
t.RespInfo = rs
t.CallStats = trace.CallStats{
t.CallStats = madmin.TraceCallStats{
Latency: rs.Time.Sub(rw.StartTime),
InputBytes: reqBodyRecorder.Size(),
OutputBytes: rw.Size(),

View File

@@ -29,13 +29,13 @@ import (
"unicode/utf8"
jwtgo "github.com/dgrijalva/jwt-go"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
etcd "go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
)

View File

@@ -28,12 +28,12 @@ import (
"time"
"unicode/utf8"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/kms"
"github.com/minio/minio/pkg/madmin"
)
// IAMObjectStore implements IAMStorageAPI

View File

@@ -30,11 +30,11 @@ import (
"time"
humanize "github.com/dustin/go-humanize"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
// UsersSysType - defines the type of users and groups system that is

View File

@@ -23,9 +23,9 @@ import (
"sync/atomic"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

View File

@@ -18,7 +18,7 @@
package cmd
import (
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// GetTotalCapacity gets the total capacity in the cluster.

View File

@@ -33,6 +33,7 @@ import (
"github.com/cespare/xxhash/v2"
"github.com/klauspost/compress/zip"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/cmd/crypto"
xhttp "github.com/minio/minio/cmd/http"
@@ -40,7 +41,6 @@ import (
bucketBandwidth "github.com/minio/minio/pkg/bucket/bandwidth"
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
"github.com/minio/minio/pkg/sync/errgroup"
"github.com/willf/bloom"

View File

@@ -23,9 +23,9 @@ import (
"time"
humanize "github.com/dustin/go-humanize"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/bucket/replication"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
)
// BackendType - represents different backend types.

View File

@@ -23,10 +23,10 @@ import (
"net/http"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio-go/v7/pkg/encrypt"
"github.com/minio/minio-go/v7/pkg/tags"
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/madmin"
)
// CheckPreconditionFn returns true if precondition check failed.

View File

@@ -22,8 +22,8 @@ import (
"strings"
"time"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/disk"
trace "github.com/minio/minio/pkg/trace"
)
//go:generate stringer -type=osMetric -trimprefix=osMetric $GOFILE
@@ -46,13 +46,13 @@ const (
osMetricLast
)
func osTrace(s osMetric, startTime time.Time, duration time.Duration, path string) trace.Info {
return trace.Info{
TraceType: trace.OS,
func osTrace(s osMetric, startTime time.Time, duration time.Duration, path string) madmin.TraceInfo {
return madmin.TraceInfo{
TraceType: madmin.TraceOS,
Time: startTime,
NodeName: globalLocalNodeName,
FuncName: "os." + s.String(),
OSStats: trace.OSStats{
OSStats: madmin.TraceOSStats{
Duration: duration,
Path: path,
},

View File

@@ -33,14 +33,13 @@ import (
"time"
"github.com/dustin/go-humanize"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/http"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/rest"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
"github.com/minio/minio/pkg/trace"
"github.com/tinylib/msgp/msgp"
)
@@ -740,7 +739,7 @@ func (client *peerRESTClient) doTrace(traceCh chan interface{}, doneCh <-chan st
dec := gob.NewDecoder(respBody)
for {
var info trace.Info
var info madmin.TraceInfo
if err = dec.Decode(&info); err != nil {
return
}

View File

@@ -30,11 +30,10 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
b "github.com/minio/minio/pkg/bucket/bandwidth"
"github.com/minio/minio/pkg/event"
"github.com/minio/minio/pkg/madmin"
trace "github.com/minio/minio/pkg/trace"
"github.com/tinylib/msgp/msgp"
)
@@ -981,7 +980,7 @@ func (s *peerRESTServer) TraceHandler(w http.ResponseWriter, r *http.Request) {
}
w.(http.Flusher).Flush()
case <-keepAliveTicker.C:
if err := enc.Encode(&trace.Info{}); err != nil {
if err := enc.Encode(&madmin.TraceInfo{}); err != nil {
return
}
w.(http.Flusher).Flush()

View File

@@ -32,6 +32,7 @@ import (
"time"
"github.com/minio/cli"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
@@ -42,7 +43,6 @@ import (
"github.com/minio/minio/pkg/color"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/fips"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup"
)

View File

@@ -25,10 +25,10 @@ import (
"strings"
humanize "github.com/dustin/go-humanize"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/config"
"github.com/minio/minio/cmd/logger"
color "github.com/minio/minio/pkg/color"
"github.com/minio/minio/pkg/madmin"
xnet "github.com/minio/minio/pkg/net"
)

View File

@@ -23,7 +23,7 @@ import (
"strings"
"testing"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// Tests if we generate storage info.

View File

@@ -23,9 +23,9 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
"github.com/minio/minio/cmd/logger"
iampolicy "github.com/minio/minio/pkg/iam/policy"
"github.com/minio/minio/pkg/madmin"
)
var (

View File

@@ -28,8 +28,8 @@ import (
"strings"
"sync"
"github.com/minio/madmin-go"
"github.com/minio/minio/pkg/hash"
"github.com/minio/minio/pkg/madmin"
)
//go:generate msgp -file $GOFILE

View File

@@ -3,7 +3,7 @@ package cmd
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
import (
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
"github.com/tinylib/msgp/msgp"
)

View File

@@ -43,12 +43,12 @@ import (
humanize "github.com/dustin/go-humanize"
"github.com/gorilla/mux"
"github.com/minio/madmin-go"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/rest"
"github.com/minio/minio/pkg/certs"
"github.com/minio/minio/pkg/handlers"
"github.com/minio/minio/pkg/madmin"
"golang.org/x/net/http2"
)

View File

@@ -28,7 +28,7 @@ import (
"strings"
"github.com/Azure/azure-storage-blob-go/azblob"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
type warmBackendAzure struct {

View File

@@ -23,7 +23,7 @@ import (
"io"
"cloud.google.com/go/storage"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"google.golang.org/api/option"

View File

@@ -25,10 +25,10 @@ import (
"strings"
"time"
"github.com/minio/madmin-go"
minio "github.com/minio/minio-go/v7"
miniogo "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio/pkg/madmin"
)
type warmBackendS3 struct {

View File

@@ -24,7 +24,7 @@ import (
"fmt"
"io"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go"
)
// WarmBackendGetOpts is used to express byte ranges within an object. The zero

View File

@@ -26,7 +26,7 @@ import (
"time"
ewma "github.com/VividCortex/ewma"
trace "github.com/minio/minio/pkg/trace"
"github.com/minio/madmin-go"
)
//go:generate stringer -type=storageMetric -trimprefix=storageMetric $GOFILE
@@ -607,13 +607,13 @@ func (p *xlStorageDiskIDCheck) ReadAll(ctx context.Context, volume string, path
return p.storage.ReadAll(ctx, volume, path)
}
func storageTrace(s storageMetric, startTime time.Time, duration time.Duration, path string) trace.Info {
return trace.Info{
TraceType: trace.Storage,
func storageTrace(s storageMetric, startTime time.Time, duration time.Duration, path string) madmin.TraceInfo {
return madmin.TraceInfo{
TraceType: madmin.TraceStorage,
Time: startTime,
NodeName: globalLocalNodeName,
FuncName: "storage." + s.String(),
StorageStats: trace.StorageStats{
StorageStats: madmin.TraceStorageStats{
Duration: duration,
Path: path,
},