add missing STS accounts loading (#20279)

PR #20268 missed loading STS accounts map properly
This commit is contained in:
Harshavardhana
2024-08-16 18:24:54 -07:00
committed by GitHub
parent a5702f978e
commit 72cff79c8a
4 changed files with 28 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ import (
"os"
"time"
"github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7"
cr "github.com/minio/minio-go/v7/pkg/credentials"
)
@@ -112,6 +113,11 @@ func main() {
Secure: stsEndpointURL.Scheme == "https",
}
mopts := &madmin.Options{
Creds: li,
Secure: stsEndpointURL.Scheme == "https",
}
v, err := li.Get()
if err != nil {
log.Fatalf("Error retrieving STS credentials: %v", err)
@@ -125,6 +131,18 @@ func main() {
return
}
// API requests are secure (HTTPS) if secure=true and insecure (HTTP) otherwise.
// New returns an MinIO Admin client object.
madmClnt, err := madmin.NewWithOptions(stsEndpointURL.Host, mopts)
if err != nil {
log.Fatalln(err)
}
err = madmClnt.ServiceRestart(context.Background())
if err != nil {
log.Fatalln(err)
}
// Use generated credentials to authenticate with MinIO server
minioClient, err := minio.New(stsEndpointURL.Host, opts)
if err != nil {