From 6f7cae2a7aae471c8161bd1e596a31fa89c48ae1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:51:12 -0400 Subject: [PATCH] fix(deps): update module github.com/baidubce/bce-sdk-go to v0.9.192 (#14337) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +-- .../baidubce/bce-sdk-go/bce/config.go | 2 +- .../baidubce/bce-sdk-go/http/constants.go | 1 + .../bce-sdk-go/services/bos/api/model.go | 1 + .../bce-sdk-go/services/bos/api/multipart.go | 2 +- .../bce-sdk-go/services/bos/api/object.go | 3 ++ .../bce-sdk-go/services/bos/api/util.go | 29 +++++++++++++++++++ .../bce-sdk-go/services/bos/client.go | 10 +++---- vendor/modules.txt | 2 +- 10 files changed, 45 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 4febc6ff85a12..7b86bb550839e 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/alicebob/miniredis/v2 v2.30.4 github.com/aliyun/aliyun-oss-go-sdk v2.2.10+incompatible github.com/aws/aws-sdk-go v1.54.19 - github.com/baidubce/bce-sdk-go v0.9.189 + github.com/baidubce/bce-sdk-go v0.9.192 github.com/bmatcuk/doublestar v1.3.4 github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 github.com/cespare/xxhash v1.1.0 diff --git a/go.sum b/go.sum index 12cb1e9a09203..f7dad595948f8 100644 --- a/go.sum +++ b/go.sum @@ -383,8 +383,8 @@ github.com/aws/smithy-go v1.11.1 h1:IQ+lPZVkSM3FRtyaDox41R8YS6iwPMYIreejOgPW49g= github.com/aws/smithy-go v1.11.1/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= github.com/axiomhq/hyperloglog v0.0.0-20240507144631-af9851f82b27 h1:60m4tnanN1ctzIu4V3bfCNJ39BiOPSm1gHFlFjTkRE0= github.com/axiomhq/hyperloglog v0.0.0-20240507144631-af9851f82b27/go.mod h1:k08r+Yj1PRAmuayFiRK6MYuR5Ve4IuZtTfxErMIh0+c= -github.com/baidubce/bce-sdk-go v0.9.189 h1:Dz0EAdM9wgbGHY4jeXFyQea8KeOdrRlbqwCbDLudcYw= -github.com/baidubce/bce-sdk-go v0.9.189/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= +github.com/baidubce/bce-sdk-go v0.9.192 h1:cnSFxCiwAZ2ZMEpxeDi2DVvrzq65gRH4TakSoWQJeC4= +github.com/baidubce/bce-sdk-go v0.9.192/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 h1:6df1vn4bBlDDo4tARvBm7l6KA9iVMnE3NWizDeWSrps= github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3/go.mod h1:CIWtjkly68+yqLPbvwwR/fjNJA/idrtULjZWh2v1ys0= diff --git a/vendor/github.com/baidubce/bce-sdk-go/bce/config.go b/vendor/github.com/baidubce/bce-sdk-go/bce/config.go index 44f7b2fab77d5..f4871a3c92b5f 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/bce/config.go +++ b/vendor/github.com/baidubce/bce-sdk-go/bce/config.go @@ -26,7 +26,7 @@ import ( // Constants and default values for the package bce const ( - SDK_VERSION = "0.9.189" + SDK_VERSION = "0.9.192" URI_PREFIX = "/" // now support uri without prefix "v1" so just set root path DEFAULT_DOMAIN = "baidubce.com" DEFAULT_PROTOCOL = "http" diff --git a/vendor/github.com/baidubce/bce-sdk-go/http/constants.go b/vendor/github.com/baidubce/bce-sdk-go/http/constants.go index f362a19ddd0ba..fbbea847db9c4 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/http/constants.go +++ b/vendor/github.com/baidubce/bce-sdk-go/http/constants.go @@ -85,4 +85,5 @@ const ( BCE_TRAFFIC_LIMIT = "x-bce-traffic-limit" BCE_BUCKET_TYPE = "x-bce-bucket-type" BCE_OBJECT_TAGGING = "x-bce-tagging" + BCE_FETCH_CALLBACK_ADDRESS = "x-bce-callback-address" ) diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go index 914fa21d16d4b..8a529cbd8d65a 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go @@ -394,6 +394,7 @@ type EndMessage struct { type FetchObjectArgs struct { FetchMode string StorageClass string + FetchCallBackAddress string } // FetchObjectResult defines the result json structure for the fetch object api. diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/multipart.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/multipart.go index 0f86fa6404515..94294093c292f 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/multipart.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/multipart.go @@ -202,7 +202,7 @@ func UploadPartFromBytes(cli bce.Client, bucket, object, uploadId string, partNu } // Send request and get the result resp := &bce.BceResponse{} - if err := cli.SendRequestFromBytes(req, resp, content); err != nil { + if err := SendRequestFromBytes(cli, req, resp, ctx, content); err != nil { return "", err } if resp.IsFail() { diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go index b4f2269b9ffb8..68b7ca1ec986b 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go @@ -530,6 +530,9 @@ func FetchObject(cli bce.Client, bucket, object, source string, args.StorageClass) } } + if len(args.FetchCallBackAddress) != 0 { + req.SetHeader(http.BCE_FETCH_CALLBACK_ADDRESS, args.FetchCallBackAddress) + } } // Send request and get the result diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/util.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/util.go index 31ba002b7e089..13a0399503cd4 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/util.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/util.go @@ -300,6 +300,35 @@ func SendRequest(cli bce.Client, req *bce.BceRequest, resp *bce.BceResponse, ctx return err } +func SendRequestFromBytes(cli bce.Client, req *bce.BceRequest, resp *bce.BceResponse, ctx *BosContext, content []byte) error { + var ( + err error + need_retry bool + ) + setUriAndEndpoint(cli, req, ctx, cli.GetBceClientConfig().Endpoint) + if err = cli.SendRequestFromBytes(req, resp, content); err != nil { + if serviceErr, isServiceErr := err.(*bce.BceServiceError); isServiceErr { + if serviceErr.StatusCode == net_http.StatusInternalServerError || + serviceErr.StatusCode == net_http.StatusBadGateway || + serviceErr.StatusCode == net_http.StatusServiceUnavailable || + (serviceErr.StatusCode == net_http.StatusBadRequest && serviceErr.Code == "Http400") { + need_retry = true + } + } + if _, isClientErr := err.(*bce.BceClientError); isClientErr { + need_retry = true + } + // retry backup endpoint + if need_retry && cli.GetBceClientConfig().BackupEndpoint != "" { + setUriAndEndpoint(cli, req, ctx, cli.GetBceClientConfig().BackupEndpoint) + if err = cli.SendRequestFromBytes(req, resp, content); err != nil { + return err + } + } + } + return err +} + func isVirtualHost(host string) bool { domain := getDomainWithoutPort(host) arr := strings.Split(domain, ".") diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/client.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/client.go index aec79b24b2f06..2c4f44c9bd656 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/client.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/client.go @@ -850,7 +850,7 @@ func (c *Client) PutObject(bucket, object string, body *bce.Body, // - string: etag of the uploaded object // - error: the uploaded error if any occurs func (c *Client) BasicPutObject(bucket, object string, body *bce.Body) (string, error) { - etag , _, err := api.PutObject(c, bucket, object, body, nil, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, nil, c.BosContext) return etag, err } @@ -891,7 +891,7 @@ func (c *Client) PutObjectFromString(bucket, object, content string, if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } @@ -912,7 +912,7 @@ func (c *Client) PutObjectFromFile(bucket, object, fileName string, if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } @@ -932,7 +932,7 @@ func (c *Client) PutObjectFromStream(bucket, object string, reader io.Reader, if err != nil { return "", err } - etag , _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) + etag, _, err := api.PutObject(c, bucket, object, body, args, c.BosContext) return etag, err } @@ -1113,7 +1113,7 @@ func (c *Client) BasicFetchObject(bucket, object, source string) (*api.FetchObje // - error: any error if it occurs func (c *Client) SimpleFetchObject(bucket, object, source, mode, storageClass string) (*api.FetchObjectResult, error) { - args := &api.FetchObjectArgs{mode, storageClass} + args := &api.FetchObjectArgs{mode, storageClass, ""} return api.FetchObject(c, bucket, object, source, args, c.BosContext) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5ccf6f1740db1..be0a3df924a88 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -476,7 +476,7 @@ github.com/aws/smithy-go/transport/http/internal/io # github.com/axiomhq/hyperloglog v0.0.0-20240507144631-af9851f82b27 ## explicit; go 1.12 github.com/axiomhq/hyperloglog -# github.com/baidubce/bce-sdk-go v0.9.189 +# github.com/baidubce/bce-sdk-go v0.9.192 ## explicit; go 1.11 github.com/baidubce/bce-sdk-go/auth github.com/baidubce/bce-sdk-go/bce