diff options
author | Wim <wim@42.be> | 2022-05-02 00:10:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 00:10:54 +0200 |
commit | 81e6f75aa491c7bfa11780dd622587cf5fff3c8f (patch) | |
tree | 817bca1b4071842029af876ab622bfdcb0360cca /vendor/github.com/minio/minio-go/v7/api-bucket-replication.go | |
parent | 888c8b9a845866730485a3a88c27027d0960d521 (diff) | |
download | matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.gz matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.bz2 matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.zip |
Update dependencies (#1822)
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/api-bucket-replication.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/v7/api-bucket-replication.go | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/api-bucket-replication.go b/vendor/github.com/minio/minio-go/v7/api-bucket-replication.go index b39211ec..461984e3 100644 --- a/vendor/github.com/minio/minio-go/v7/api-bucket-replication.go +++ b/vendor/github.com/minio/minio-go/v7/api-bucket-replication.go @@ -246,12 +246,42 @@ func (c *Client) resetBucketReplicationOnTarget(ctx context.Context, bucketName if resp.StatusCode != http.StatusOK { return rinfo, httpRespToErrorResponse(resp, bucketName, "") } - respBytes, err := ioutil.ReadAll(resp.Body) + + if err = json.NewDecoder(resp.Body).Decode(&rinfo); err != nil { + return rinfo, err + } + return rinfo, nil +} + +// GetBucketReplicationResyncStatus gets the status of replication resync +func (c *Client) GetBucketReplicationResyncStatus(ctx context.Context, bucketName, arn string) (rinfo replication.ResyncTargetsInfo, err error) { + // Input validation. + if err := s3utils.CheckValidBucketName(bucketName); err != nil { + return rinfo, err + } + // Get resources properly escaped and lined up before + // using them in http request. + urlValues := make(url.Values) + urlValues.Set("replication-reset-status", "") + if arn != "" { + urlValues.Set("arn", arn) + } + // Execute GET on bucket to get replication config. + resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ + bucketName: bucketName, + queryValues: urlValues, + }) + + defer closeResponse(resp) if err != nil { return rinfo, err } - if err := json.Unmarshal(respBytes, &rinfo); err != nil { + if resp.StatusCode != http.StatusOK { + return rinfo, httpRespToErrorResponse(resp, bucketName, "") + } + + if err = json.NewDecoder(resp.Body).Decode(&rinfo); err != nil { return rinfo, err } return rinfo, nil |