summaryrefslogtreecommitdiff
path: root/vendor/github.com/minio/minio-go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-06-26 20:45:49 +0000
committerLibravatar GitHub <noreply@github.com>2023-06-26 20:45:49 +0000
commite3e0f673ccc1bb862a5c0eaa537a5cf37aeb2b88 (patch)
tree1e361710c67c8c8104dfc6e1774339c144d20335 /vendor/github.com/minio/minio-go
parent[chore]: Bump github.com/miekg/dns from 1.1.54 to 1.1.55 (#1929) (diff)
downloadgotosocial-e3e0f673ccc1bb862a5c0eaa537a5cf37aeb2b88.tar.xz
[chore]: Bump github.com/minio/minio-go/v7 from 7.0.56 to 7.0.58 (#1928)
Diffstat (limited to 'vendor/github.com/minio/minio-go')
-rw-r--r--vendor/github.com/minio/minio-go/v7/api-error-response.go10
-rw-r--r--vendor/github.com/minio/minio-go/v7/api-put-object-fan-out.go2
-rw-r--r--vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go5
-rw-r--r--vendor/github.com/minio/minio-go/v7/api.go32
-rw-r--r--vendor/github.com/minio/minio-go/v7/functional_tests.go24
-rw-r--r--vendor/github.com/minio/minio-go/v7/pkg/notification/notification.go39
6 files changed, 82 insertions, 30 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/api-error-response.go b/vendor/github.com/minio/minio-go/v7/api-error-response.go
index 4ec0c87c2..7df211fda 100644
--- a/vendor/github.com/minio/minio-go/v7/api-error-response.go
+++ b/vendor/github.com/minio/minio-go/v7/api-error-response.go
@@ -23,6 +23,7 @@ import (
"fmt"
"io"
"net/http"
+ "strings"
)
/* **** SAMPLE ERROR RESPONSE ****
@@ -188,6 +189,15 @@ func httpRespToErrorResponse(resp *http.Response, bucketName, objectName string)
}
}
+ code := resp.Header.Get("x-minio-error-code")
+ if code != "" {
+ errResp.Code = code
+ }
+ desc := resp.Header.Get("x-minio-error-desc")
+ if desc != "" {
+ errResp.Message = strings.Trim(desc, `"`)
+ }
+
// Save hostID, requestID and region information
// from headers if not available through error XML.
if errResp.RequestID == "" {
diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-fan-out.go b/vendor/github.com/minio/minio-go/v7/api-put-object-fan-out.go
index 9016ec4b4..0ae9142e1 100644
--- a/vendor/github.com/minio/minio-go/v7/api-put-object-fan-out.go
+++ b/vendor/github.com/minio/minio-go/v7/api-put-object-fan-out.go
@@ -62,7 +62,7 @@ type PutObjectFanOutResponse struct {
ETag string `json:"etag,omitempty"`
VersionID string `json:"versionId,omitempty"`
LastModified *time.Time `json:"lastModified,omitempty"`
- Error error `json:"error,omitempty"`
+ Error string `json:"error,omitempty"`
}
// PutObjectFanOut - is a variant of PutObject instead of writing a single object from a single
diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go
index 85d6c70a2..5f117afa4 100644
--- a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go
+++ b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go
@@ -389,8 +389,9 @@ func (c *Client) completeMultipartUpload(ctx context.Context, bucketName, object
headers := opts.Header()
if s3utils.IsAmazonEndpoint(*c.endpointURL) {
- headers.Del(encrypt.SseKmsKeyID) // Remove X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id not supported in CompleteMultipartUpload
- headers.Del(encrypt.SseGenericHeader) // Remove X-Amz-Server-Side-Encryption not supported in CompleteMultipartUpload
+ headers.Del(encrypt.SseKmsKeyID) // Remove X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id not supported in CompleteMultipartUpload
+ headers.Del(encrypt.SseGenericHeader) // Remove X-Amz-Server-Side-Encryption not supported in CompleteMultipartUpload
+ headers.Del(encrypt.SseEncryptionContext) // Remove X-Amz-Server-Side-Encryption-Context not supported in CompleteMultipartUpload
}
// Instantiate all the complete multipart buffer.
diff --git a/vendor/github.com/minio/minio-go/v7/api.go b/vendor/github.com/minio/minio-go/v7/api.go
index 749be8d5a..fa1d60824 100644
--- a/vendor/github.com/minio/minio-go/v7/api.go
+++ b/vendor/github.com/minio/minio-go/v7/api.go
@@ -124,7 +124,7 @@ type Options struct {
// Global constants.
const (
libraryName = "minio-go"
- libraryVersion = "v7.0.56"
+ libraryVersion = "v7.0.58"
)
// User Agent should always following the below style.
@@ -363,7 +363,8 @@ const (
online = 1
)
-// IsOnline returns true if healthcheck enabled and client is online
+// IsOnline returns true if healthcheck enabled and client is online.
+// If HealthCheck function has not been called this will always return true.
func (c *Client) IsOnline() bool {
return !c.IsOffline()
}
@@ -374,22 +375,37 @@ func (c *Client) markOffline() {
}
// IsOffline returns true if healthcheck enabled and client is offline
+// If HealthCheck function has not been called this will always return false.
func (c *Client) IsOffline() bool {
return atomic.LoadInt32(&c.healthStatus) == offline
}
-// HealthCheck starts a healthcheck to see if endpoint is up. Returns a context cancellation function
-// and and error if health check is already started
+// HealthCheck starts a healthcheck to see if endpoint is up.
+// Returns a context cancellation function, to stop the health check,
+// and an error if health check is already started.
func (c *Client) HealthCheck(hcDuration time.Duration) (context.CancelFunc, error) {
- if atomic.LoadInt32(&c.healthStatus) == online {
+ if atomic.LoadInt32(&c.healthStatus) != unknown {
return nil, fmt.Errorf("health check is running")
}
if hcDuration < 1*time.Second {
- return nil, fmt.Errorf("health check duration should be atleast 1 second")
+ return nil, fmt.Errorf("health check duration should be at least 1 second")
}
- ctx, cancelFn := context.WithCancel(context.Background())
- atomic.StoreInt32(&c.healthStatus, online)
probeBucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "probe-health-")
+ ctx, cancelFn := context.WithCancel(context.Background())
+ atomic.StoreInt32(&c.healthStatus, offline)
+ {
+ // Change to online, if we can connect.
+ gctx, gcancel := context.WithTimeout(ctx, 3*time.Second)
+ _, err := c.getBucketLocation(gctx, probeBucketName)
+ gcancel()
+ if !IsNetworkOrHostDown(err, false) {
+ switch ToErrorResponse(err).Code {
+ case "NoSuchBucket", "AccessDenied", "":
+ atomic.CompareAndSwapInt32(&c.healthStatus, offline, online)
+ }
+ }
+ }
+
go func(duration time.Duration) {
timer := time.NewTimer(duration)
defer timer.Stop()
diff --git a/vendor/github.com/minio/minio-go/v7/functional_tests.go b/vendor/github.com/minio/minio-go/v7/functional_tests.go
index b8a96e3f4..2bc6b8645 100644
--- a/vendor/github.com/minio/minio-go/v7/functional_tests.go
+++ b/vendor/github.com/minio/minio-go/v7/functional_tests.go
@@ -4821,6 +4821,11 @@ func testPresignedPostPolicy() {
policy.SetContentType("binary/octet-stream")
policy.SetContentLengthRange(10, 1024*1024)
policy.SetUserMetadata(metadataKey, metadataValue)
+
+ // Add CRC32C
+ checksum := minio.ChecksumCRC32C.ChecksumBytes(buf)
+ policy.SetChecksum(checksum)
+
args["policy"] = policy.String()
presignedPostPolicyURL, formData, err := c.PresignedPostPolicy(context.Background(), policy)
@@ -4888,6 +4893,7 @@ func testPresignedPostPolicy() {
Timeout: 30 * time.Second,
Transport: transport,
}
+ args["url"] = presignedPostPolicyURL.String()
req, err := http.NewRequest(http.MethodPost, presignedPostPolicyURL.String(), bytes.NewReader(formBuf.Bytes()))
if err != nil {
@@ -4920,13 +4926,21 @@ func testPresignedPostPolicy() {
expectedLocation := scheme + os.Getenv(serverEndpoint) + "/" + bucketName + "/" + objectName
expectedLocationBucketDNS := scheme + bucketName + "." + os.Getenv(serverEndpoint) + "/" + objectName
- if val, ok := res.Header["Location"]; ok {
- if val[0] != expectedLocation && val[0] != expectedLocationBucketDNS {
- logError(testName, function, args, startTime, "", "Location in header response is incorrect", err)
+ if !strings.Contains(expectedLocation, "s3.amazonaws.com/") {
+ // Test when not against AWS S3.
+ if val, ok := res.Header["Location"]; ok {
+ if val[0] != expectedLocation && val[0] != expectedLocationBucketDNS {
+ logError(testName, function, args, startTime, "", fmt.Sprintf("Location in header response is incorrect. Want %q or %q, got %q", expectedLocation, expectedLocationBucketDNS, val[0]), err)
+ return
+ }
+ } else {
+ logError(testName, function, args, startTime, "", "Location not found in header response", err)
return
}
- } else {
- logError(testName, function, args, startTime, "", "Location not found in header response", err)
+ }
+ want := checksum.Encoded()
+ if got := res.Header.Get("X-Amz-Checksum-Crc32c"); got != want {
+ logError(testName, function, args, startTime, "", fmt.Sprintf("Want checksum %q, got %q", want, got), nil)
return
}
diff --git a/vendor/github.com/minio/minio-go/v7/pkg/notification/notification.go b/vendor/github.com/minio/minio-go/v7/pkg/notification/notification.go
index fd034fdc8..01cc26fc2 100644
--- a/vendor/github.com/minio/minio-go/v7/pkg/notification/notification.go
+++ b/vendor/github.com/minio/minio-go/v7/pkg/notification/notification.go
@@ -33,20 +33,31 @@ type EventType string
//
// http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations
const (
- ObjectCreatedAll EventType = "s3:ObjectCreated:*"
- ObjectCreatedPut EventType = "s3:ObjectCreated:Put"
- ObjectCreatedPost EventType = "s3:ObjectCreated:Post"
- ObjectCreatedCopy EventType = "s3:ObjectCreated:Copy"
- ObjectCreatedCompleteMultipartUpload EventType = "s3:ObjectCreated:CompleteMultipartUpload"
- ObjectAccessedGet EventType = "s3:ObjectAccessed:Get"
- ObjectAccessedHead EventType = "s3:ObjectAccessed:Head"
- ObjectAccessedAll EventType = "s3:ObjectAccessed:*"
- ObjectRemovedAll EventType = "s3:ObjectRemoved:*"
- ObjectRemovedDelete EventType = "s3:ObjectRemoved:Delete"
- ObjectRemovedDeleteMarkerCreated EventType = "s3:ObjectRemoved:DeleteMarkerCreated"
- ObjectReducedRedundancyLostObject EventType = "s3:ReducedRedundancyLostObject"
- BucketCreatedAll EventType = "s3:BucketCreated:*"
- BucketRemovedAll EventType = "s3:BucketRemoved:*"
+ ObjectCreatedAll EventType = "s3:ObjectCreated:*"
+ ObjectCreatedPut EventType = "s3:ObjectCreated:Put"
+ ObjectCreatedPost EventType = "s3:ObjectCreated:Post"
+ ObjectCreatedCopy EventType = "s3:ObjectCreated:Copy"
+ ObjectCreatedCompleteMultipartUpload EventType = "s3:ObjectCreated:CompleteMultipartUpload"
+ ObjectAccessedGet EventType = "s3:ObjectAccessed:Get"
+ ObjectAccessedHead EventType = "s3:ObjectAccessed:Head"
+ ObjectAccessedAll EventType = "s3:ObjectAccessed:*"
+ ObjectRemovedAll EventType = "s3:ObjectRemoved:*"
+ ObjectRemovedDelete EventType = "s3:ObjectRemoved:Delete"
+ ObjectRemovedDeleteMarkerCreated EventType = "s3:ObjectRemoved:DeleteMarkerCreated"
+ ObjectReducedRedundancyLostObject EventType = "s3:ReducedRedundancyLostObject"
+ ObjectTransitionAll EventType = "s3:ObjectTransition:*"
+ ObjectTransitionFailed EventType = "s3:ObjectTransition:Failed"
+ ObjectTransitionComplete EventType = "s3:ObjectTransition:Complete"
+ ObjectTransitionPost EventType = "s3:ObjectRestore:Post"
+ ObjectTransitionCompleted EventType = "s3:ObjectRestore:Completed"
+ ObjectReplicationAll EventType = "s3:Replication:*"
+ ObjectReplicationOperationCompletedReplication EventType = "s3:Replication:OperationCompletedReplication"
+ ObjectReplicationOperationFailedReplication EventType = "s3:Replication:OperationFailedReplication"
+ ObjectReplicationOperationMissedThreshold EventType = "s3:Replication:OperationMissedThreshold"
+ ObjectReplicationOperationNotTracked EventType = "s3:Replication:OperationNotTracked"
+ ObjectReplicationOperationReplicatedAfterThreshold EventType = "s3:Replication:OperationReplicatedAfterThreshold"
+ BucketCreatedAll EventType = "s3:BucketCreated:*"
+ BucketRemovedAll EventType = "s3:BucketRemoved:*"
)
// FilterRule - child of S3Key, a tag in the notification xml which