Skip to content

Commit

Permalink
Add v4 Admin APIs, older APIs move to v3 (#333)
Browse files Browse the repository at this point in the history
* Add v4 Admin APIs, older APIs move to v3

- ClusterInfo
- PoolList -> []PoolInfo
- PoolInfo(index) -> PoolInfo

* remove all deprecated APIs since we are moving to v4

with major breaking changes
  • Loading branch information
harshavardhana authored Feb 18, 2025
1 parent c3c7724 commit 60acbd9
Show file tree
Hide file tree
Showing 80 changed files with 2,111 additions and 1,776 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.22.x,1.23.x]
go-version: [1.23.x, 1.24.x]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
Expand All @@ -30,8 +30,6 @@ jobs:

- name: Check lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61

- name: Regenerate, vet and test
run: |
Expand Down
7 changes: 0 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
linters-settings:
golint:
min-confidence: 0

misspell:
locale: US

linters:
disable-all: true
enable:
Expand Down
546 changes: 6 additions & 540 deletions README.md

Large diffs are not rendered by default.

20 changes: 2 additions & 18 deletions api-log.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ import (
type LogMask uint64

const (
// LogMaskMinIO - mask for MinIO type log
LogMaskMinIO LogMask = 1 << iota // Deprecated Jan 2024
// LogMaskApplication - mask for MinIO type log
LogMaskApplication // Deprecated Jan 2024

LogMaskFatal
LogMaskFatal LogMask = 1 << iota
LogMaskWarning
LogMaskError
LogMaskEvent
Expand All @@ -60,13 +55,6 @@ func (m LogMask) Contains(other LogMask) bool {
type LogKind string

const (
// LogKindMinio - MinIO log type
LogKindMinio LogKind = "MINIO" // Deprecated Jan 2024
// LogKindApplication - Application log type
LogKindApplication LogKind = "APPLICATION" // Deprecated Jan 2024
// LogKindAll - all logs type
LogKindAll LogKind = "ALL" // Deprecated Jan 2024

LogKindFatal LogKind = "FATAL"
LogKindWarning LogKind = "WARNING"
LogKindError LogKind = "ERROR"
Expand All @@ -77,10 +65,6 @@ const (
// LogMask returns the mask based on the kind.
func (l LogKind) LogMask() LogMask {
switch l {
case LogKindMinio:
return LogMaskMinIO
case LogKindApplication:
return LogMaskApplication
case LogKindFatal:
return LogMaskFatal
case LogKindWarning:
Expand Down Expand Up @@ -120,7 +104,7 @@ func (adm AdminClient) GetLogs(ctx context.Context, node string, lineCnt int, lo
urlValues.Set("logType", logKind)
for {
reqData := requestData{
relPath: adminAPIPrefix + "/log",
relPath: adminAPIPrefixV3 + "/log",
queryValues: urlValues,
}
// Execute GET to call log handler
Expand Down
22 changes: 0 additions & 22 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,28 +175,6 @@ func (adm *AdminClient) SetAppInfo(appName string, appVersion string) {
}
}

// SetCustomTransport - set new custom transport.
// Deprecated: please use Options{Transport: tr} to provide custom transport.
func (adm *AdminClient) SetCustomTransport(customHTTPTransport http.RoundTripper) {
// Set this to override default transport
// ``http.DefaultTransport``.
//
// This transport is usually needed for debugging OR to add your
// own custom TLS certificates on the client transport, for custom
// CA's and certs which are not part of standard certificate
// authority follow this example :-
//
// tr := &http.Transport{
// TLSClientConfig: &tls.Config{RootCAs: pool},
// DisableCompression: true,
// }
// api.SetTransport(tr)
//
if adm.httpClient != nil {
adm.httpClient.Transport = customHTTPTransport
}
}

// TraceOn - enable HTTP tracing.
func (adm *AdminClient) TraceOn(outputStream io.Writer) {
// if outputStream is nil then default to os.Stdout.
Expand Down
2 changes: 1 addition & 1 deletion api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package madmin_test
import (
"testing"

"github.com/minio/madmin-go/v3"
"github.com/minio/madmin-go/v4"
)

func TestMinioAdminClient(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion bandwidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (adm *AdminClient) GetBucketBandwidth(ctx context.Context, buckets ...strin
}

reqData := requestData{
relPath: adminAPIPrefix + "/bandwidth",
relPath: adminAPIPrefixV3 + "/bandwidth",
queryValues: queryValues,
}
resp, err := adm.executeMethod(ctx, http.MethodGet, reqData)
Expand Down
10 changes: 5 additions & 5 deletions batch-job.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ type BatchJobResult struct {
func (adm *AdminClient) StartBatchJob(ctx context.Context, job string) (BatchJobResult, error) {
resp, err := adm.executeMethod(ctx, http.MethodPost,
requestData{
relPath: adminAPIPrefix + "/start-job",
relPath: adminAPIPrefixV3 + "/start-job",
content: []byte(job),
},
)
Expand Down Expand Up @@ -237,7 +237,7 @@ func (adm *AdminClient) BatchJobStatus(ctx context.Context, jobID string) (Batch

resp, err := adm.executeMethod(ctx, http.MethodGet,
requestData{
relPath: adminAPIPrefix + "/status-job",
relPath: adminAPIPrefixV3 + "/status-job",
queryValues: values,
},
)
Expand Down Expand Up @@ -265,7 +265,7 @@ func (adm *AdminClient) DescribeBatchJob(ctx context.Context, jobID string) (str

resp, err := adm.executeMethod(ctx, http.MethodGet,
requestData{
relPath: adminAPIPrefix + "/describe-job",
relPath: adminAPIPrefixV3 + "/describe-job",
queryValues: values,
},
)
Expand Down Expand Up @@ -327,7 +327,7 @@ func (adm *AdminClient) ListBatchJobs(ctx context.Context, fl *ListBatchJobsFilt

resp, err := adm.executeMethod(ctx, http.MethodGet,
requestData{
relPath: adminAPIPrefix + "/list-jobs",
relPath: adminAPIPrefixV3 + "/list-jobs",
queryValues: values,
},
)
Expand Down Expand Up @@ -356,7 +356,7 @@ func (adm *AdminClient) CancelBatchJob(ctx context.Context, jobID string) error

resp, err := adm.executeMethod(ctx, http.MethodDelete,
requestData{
relPath: adminAPIPrefix + "/cancel-job",
relPath: adminAPIPrefixV3 + "/cancel-job",
queryValues: values,
},
)
Expand Down
4 changes: 2 additions & 2 deletions bucket-metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// ExportBucketMetadata makes an admin call to export bucket metadata of a bucket
func (adm *AdminClient) ExportBucketMetadata(ctx context.Context, bucket string) (io.ReadCloser, error) {
path := adminAPIPrefix + "/export-bucket-metadata"
path := adminAPIPrefixV3 + "/export-bucket-metadata"
queryValues := url.Values{}
queryValues.Set("bucket", bucket)

Expand Down Expand Up @@ -82,7 +82,7 @@ func (adm *AdminClient) ImportBucketMetadata(ctx context.Context, bucket string,
return r, err
}

path := adminAPIPrefix + "/import-bucket-metadata"
path := adminAPIPrefixV3 + "/import-bucket-metadata"
queryValues := url.Values{}
queryValues.Set("bucket", bucket)

Expand Down
30 changes: 15 additions & 15 deletions cluster-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (adm *AdminClient) SiteReplicationAdd(ctx context.Context, sites []PeerSite
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/add",
relPath: adminAPIPrefixV3 + "/site-replication/add",
content: encBytes,
queryValues: q,
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func (adm *AdminClient) SiteReplicationInfo(ctx context.Context) (info SiteRepli
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/info",
relPath: adminAPIPrefixV3 + "/site-replication/info",
queryValues: q,
}

Expand Down Expand Up @@ -207,7 +207,7 @@ func (adm *AdminClient) SRPeerJoin(ctx context.Context, r SRPeerJoinReq) error {
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/join",
relPath: adminAPIPrefixV3 + "/site-replication/peer/join",
content: encBuf,
queryValues: q,
}
Expand Down Expand Up @@ -259,7 +259,7 @@ func (adm *AdminClient) SRPeerBucketOps(ctx context.Context, bucket string, op B

reqData := requestData{
queryValues: v,
relPath: adminAPIPrefix + "/site-replication/peer/bucket-ops",
relPath: adminAPIPrefixV3 + "/site-replication/peer/bucket-ops",
}

resp, err := adm.executeMethod(ctx, http.MethodPut, reqData)
Expand Down Expand Up @@ -446,7 +446,7 @@ func (adm *AdminClient) SRPeerReplicateIAMItem(ctx context.Context, item SRIAMIt
q.Add("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/iam-item",
relPath: adminAPIPrefixV3 + "/site-replication/peer/iam-item",
content: b,
queryValues: q,
}
Expand Down Expand Up @@ -527,7 +527,7 @@ func (adm *AdminClient) SRPeerReplicateBucketMeta(ctx context.Context, item SRBu
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/bucket-meta",
relPath: adminAPIPrefixV3 + "/site-replication/peer/bucket-meta",
content: b,
queryValues: q,
}
Expand Down Expand Up @@ -635,7 +635,7 @@ func (adm *AdminClient) SRPeerGetIDPSettings(ctx context.Context) (info IDPSetti
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/idp-settings",
relPath: adminAPIPrefixV3 + "/site-replication/peer/idp-settings",
queryValues: q,
}

Expand Down Expand Up @@ -704,7 +704,7 @@ func (adm *AdminClient) SRMetaInfo(ctx context.Context, opts SRStatusOptions) (i
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/metainfo",
relPath: adminAPIPrefixV3 + "/site-replication/metainfo",
queryValues: q,
}

Expand Down Expand Up @@ -946,7 +946,7 @@ func (adm *AdminClient) SRStatusInfo(ctx context.Context, opts SRStatusOptions)
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/status",
relPath: adminAPIPrefixV3 + "/site-replication/status",
queryValues: q,
}

Expand Down Expand Up @@ -999,7 +999,7 @@ func (adm *AdminClient) SiteReplicationEdit(ctx context.Context, site PeerInfo,
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/edit",
relPath: adminAPIPrefixV3 + "/site-replication/edit",
content: encBytes,
queryValues: q,
}
Expand Down Expand Up @@ -1031,7 +1031,7 @@ func (adm *AdminClient) SRPeerEdit(ctx context.Context, pi PeerInfo) error {
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/edit",
relPath: adminAPIPrefixV3 + "/site-replication/peer/edit",
content: b,
queryValues: q,
}
Expand Down Expand Up @@ -1061,7 +1061,7 @@ func (adm *AdminClient) SRStateEdit(ctx context.Context, state SRStateEditReq) e
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/state/edit",
relPath: adminAPIPrefixV3 + "/site-replication/state/edit",
content: b,
queryValues: q,
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ func (adm *AdminClient) SiteReplicationRemove(ctx context.Context, removeReq SRR
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/remove",
relPath: adminAPIPrefixV3 + "/site-replication/remove",
content: rmvBytes,
queryValues: q,
}
Expand Down Expand Up @@ -1119,7 +1119,7 @@ func (adm *AdminClient) SRPeerRemove(ctx context.Context, removeReq SRRemoveReq)
q.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/peer/remove",
relPath: adminAPIPrefixV3 + "/site-replication/peer/remove",
content: reqBytes,
queryValues: q,
}
Expand Down Expand Up @@ -1206,7 +1206,7 @@ func (adm *AdminClient) SiteReplicationResyncOp(ctx context.Context, site PeerIn
v.Set("api-version", SiteReplAPIVersion)

reqData := requestData{
relPath: adminAPIPrefix + "/site-replication/resync/op",
relPath: adminAPIPrefixV3 + "/site-replication/resync/op",
content: reqBytes,
queryValues: v,
}
Expand Down
4 changes: 2 additions & 2 deletions config-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (adm *AdminClient) GetConfig(ctx context.Context) ([]byte, error) {
// Execute GET on /minio/admin/v3/config to get config of a setup.
resp, err := adm.executeMethod(ctx,
http.MethodGet,
requestData{relPath: adminAPIPrefix + "/config"})
requestData{relPath: adminAPIPrefixV3 + "/config"})
defer closeResponse(resp)
if err != nil {
return nil, err
Expand Down Expand Up @@ -64,7 +64,7 @@ func (adm *AdminClient) SetConfig(ctx context.Context, config io.Reader) (err er
}

reqData := requestData{
relPath: adminAPIPrefix + "/config",
relPath: adminAPIPrefixV3 + "/config",
content: econfigBytes,
}

Expand Down
2 changes: 1 addition & 1 deletion config-help-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (adm *AdminClient) HelpConfigKV(ctx context.Context, subSys, key string, en
}

reqData := requestData{
relPath: adminAPIPrefix + "/help-config-kv",
relPath: adminAPIPrefixV3 + "/help-config-kv",
queryValues: v,
}

Expand Down
6 changes: 3 additions & 3 deletions config-history-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (adm *AdminClient) ClearConfigHistoryKV(ctx context.Context, restoreID stri
v := url.Values{}
v.Set("restoreId", restoreID)
reqData := requestData{
relPath: adminAPIPrefix + "/clear-config-history-kv",
relPath: adminAPIPrefixV3 + "/clear-config-history-kv",
queryValues: v,
}

Expand All @@ -60,7 +60,7 @@ func (adm *AdminClient) RestoreConfigHistoryKV(ctx context.Context, restoreID st
v := url.Values{}
v.Set("restoreId", restoreID)
reqData := requestData{
relPath: adminAPIPrefix + "/restore-config-history-kv",
relPath: adminAPIPrefixV3 + "/restore-config-history-kv",
queryValues: v,
}

Expand Down Expand Up @@ -104,7 +104,7 @@ func (adm *AdminClient) ListConfigHistoryKV(ctx context.Context, count int) ([]C
resp, err := adm.executeMethod(ctx,
http.MethodGet,
requestData{
relPath: adminAPIPrefix + "/list-config-history-kv",
relPath: adminAPIPrefixV3 + "/list-config-history-kv",
queryValues: v,
})
defer closeResponse(resp)
Expand Down
Loading

0 comments on commit 60acbd9

Please sign in to comment.