diff options
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/pkg')
11 files changed, 24 insertions, 88 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go index c9a52252a..0c83fc7fa 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_aws_credentials.go @@ -18,6 +18,7 @@ package credentials import ( + "encoding/json" "errors" "os" "os/exec" @@ -26,7 +27,6 @@ import ( "time" "github.com/go-ini/ini" - "github.com/minio/minio-go/v7/internal/json" ) // A externalProcessCredentials stores the output of a credential_process diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go index 398952ee9..b78dcaccf 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/file_minio_client.go @@ -18,11 +18,10 @@ package credentials import ( + "encoding/json" "os" "path/filepath" "runtime" - - "github.com/minio/minio-go/v7/internal/json" ) // A FileMinioClient retrieves credentials from the current user's home diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/iam_aws.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/iam_aws.go index edc988467..f4f7c8f7e 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/iam_aws.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/iam_aws.go @@ -20,6 +20,7 @@ package credentials import ( "bufio" "context" + "encoding/json" "errors" "fmt" "io" @@ -30,8 +31,6 @@ import ( "path" "strings" "time" - - "github.com/minio/minio-go/v7/internal/json" ) // DefaultExpiryWindow - Default expiry window. diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_custom_identity.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_custom_identity.go index 162f460ee..e9e7a1151 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_custom_identity.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_custom_identity.go @@ -132,7 +132,7 @@ func (c *CustomTokenIdentity) RetrieveWithCredContext(cc *CredContext) (value Va r := AssumeRoleWithCustomTokenResponse{} if err = xml.NewDecoder(resp.Body).Decode(&r); err != nil { - return + return value, err } cr := r.Result.Credentials diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_ldap_identity.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_ldap_identity.go index 31fe10ae0..7e80cd6a2 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_ldap_identity.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/sts_ldap_identity.go @@ -74,6 +74,9 @@ type LDAPIdentity struct { // requested from LDAP. RequestedExpiry time.Duration + // Optional, if empty applies to default config + ConfigName string + // Optional, used for token revokation TokenRevokeType string } @@ -110,6 +113,13 @@ func LDAPIdentityExpiryOpt(d time.Duration) LDAPIdentityOpt { } } +// LDAPIdentityConfigNameOpt sets the config name for requested credentials. +func LDAPIdentityConfigNameOpt(name string) LDAPIdentityOpt { + return func(k *LDAPIdentity) { + k.ConfigName = name + } +} + // NewLDAPIdentityWithSessionPolicy returns new credentials object that uses // LDAP Identity with a specified session policy. The `policy` parameter must be // a JSON string specifying the policy document. @@ -158,6 +168,9 @@ func (k *LDAPIdentity) RetrieveWithCredContext(cc *CredContext) (value Value, er if k.TokenRevokeType != "" { v.Set("TokenRevokeType", k.TokenRevokeType) } + if k.ConfigName != "" { + v.Set("ConfigName", k.ConfigName) + } req, err := http.NewRequest(http.MethodPost, u.String(), strings.NewReader(v.Encode())) if err != nil { @@ -201,7 +214,7 @@ func (k *LDAPIdentity) RetrieveWithCredContext(cc *CredContext) (value Value, er r := AssumeRoleWithLDAPResponse{} if err = xml.NewDecoder(resp.Body).Decode(&r); err != nil { - return + return value, err } cr := r.Result.Credentials diff --git a/vendor/github.com/minio/minio-go/v7/pkg/encrypt/server-side.go b/vendor/github.com/minio/minio-go/v7/pkg/encrypt/server-side.go index 1fc510ae0..0a8a7baa2 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/encrypt/server-side.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/encrypt/server-side.go @@ -20,10 +20,10 @@ package encrypt import ( "crypto/md5" "encoding/base64" + "encoding/json" "errors" "net/http" - "github.com/minio/minio-go/v7/internal/json" "golang.org/x/crypto/argon2" ) diff --git a/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go b/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go index cf1ba038f..7ed98b0d1 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go @@ -19,11 +19,10 @@ package lifecycle import ( + "encoding/json" "encoding/xml" "errors" "time" - - "github.com/minio/minio-go/v7/internal/json" ) var errMissingStorageClass = errors.New("storage-class cannot be empty") diff --git a/vendor/github.com/minio/minio-go/v7/pkg/peeker/peek-reader-closer.go b/vendor/github.com/minio/minio-go/v7/pkg/peeker/peek-reader-closer.go deleted file mode 100644 index 26c9cf637..000000000 --- a/vendor/github.com/minio/minio-go/v7/pkg/peeker/peek-reader-closer.go +++ /dev/null @@ -1,73 +0,0 @@ -/* - * MinIO Go Library for Amazon S3 Compatible Cloud Storage - * Copyright 2015-2025 MinIO, Inc. - * - * 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 peeker - -import ( - "bytes" - "errors" - "io" -) - -// PeekReadCloser offers a way to peek a ReadCloser stream and then -// return the exact stream of the underlying ReadCloser -type PeekReadCloser struct { - io.ReadCloser - - recordMode bool - recordMaxBuf int - recordBuf *bytes.Buffer -} - -// ReplayFromStart ensures next Read() will restart to stream the -// underlying ReadCloser stream from the beginning -func (prc *PeekReadCloser) ReplayFromStart() { - prc.recordMode = false -} - -func (prc *PeekReadCloser) Read(p []byte) (int, error) { - if prc.recordMode { - if prc.recordBuf.Len() > prc.recordMaxBuf { - return 0, errors.New("maximum peek buffer exceeded") - } - n, err := prc.ReadCloser.Read(p) - prc.recordBuf.Write(p[:n]) - return n, err - } - // Replay mode - if prc.recordBuf.Len() > 0 { - pn, _ := prc.recordBuf.Read(p) - return pn, nil - } - return prc.ReadCloser.Read(p) -} - -// Close releases the record buffer memory and close the underlying ReadCloser -func (prc *PeekReadCloser) Close() error { - prc.recordBuf.Reset() - return prc.ReadCloser.Close() -} - -// NewPeekReadCloser returns a new peek reader -func NewPeekReadCloser(rc io.ReadCloser, maxBufSize int) *PeekReadCloser { - return &PeekReadCloser{ - ReadCloser: rc, - recordMode: true, // recording mode by default - recordBuf: bytes.NewBuffer(make([]byte, 0, 1024)), - recordMaxBuf: maxBufSize, - } -} diff --git a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go index 2f7993f4b..cc17a3531 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/replication/replication.go @@ -1014,7 +1014,7 @@ func (q ReplQueueStats) QStats() (r ReplQStats) { if len(q.Nodes) > 0 { r.Uptime /= int64(len(q.Nodes)) // average uptime } - return + return r } // MetricsV2 represents replication metrics for a bucket. diff --git a/vendor/github.com/minio/minio-go/v7/pkg/set/stringset.go b/vendor/github.com/minio/minio-go/v7/pkg/set/stringset.go index 8aa92212b..c12651b54 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/set/stringset.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/set/stringset.go @@ -18,10 +18,9 @@ package set import ( + "encoding/json" "fmt" "sort" - - "github.com/minio/minio-go/v7/internal/json" ) // StringSet - uses map as set of strings. diff --git a/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v2.go b/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v2.go index f65c36c7d..d15c99ad7 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v2.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v2.go @@ -48,11 +48,11 @@ func encodeURL2Path(req *http.Request, virtualHost bool) (path string) { path = "/" + bucketName path += req.URL.Path path = s3utils.EncodePath(path) - return + return path } } path = s3utils.EncodePath(req.URL.Path) - return + return path } // PreSignV2 - presign the request in following style. |
