summaryrefslogtreecommitdiff
path: root/vendor/github.com/minio/minio-go/v7/api-bucket-replication.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-07-04 11:22:40 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-04 11:22:40 +0200
commit1218f97e011f47fd8fa861e76c37b2738063348d (patch)
tree886489c9afb3876a676572de63e2f8fe9e189273 /vendor/github.com/minio/minio-go/v7/api-bucket-replication.go
parent[bugfix] Try to fix the webfinger test, again (#1931) (diff)
downloadgotosocial-1218f97e011f47fd8fa861e76c37b2738063348d.tar.xz
[chore]: Bump github.com/minio/minio-go/v7 from 7.0.58 to 7.0.59 (#1941)
Bumps [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) from 7.0.58 to 7.0.59. - [Release notes](https://github.com/minio/minio-go/releases) - [Commits](https://github.com/minio/minio-go/compare/v7.0.58...v7.0.59) --- updated-dependencies: - dependency-name: github.com/minio/minio-go/v7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.go64
1 files changed, 64 insertions, 0 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 d5895dfe0..73c751ff8 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
@@ -289,3 +289,67 @@ func (c *Client) GetBucketReplicationResyncStatus(ctx context.Context, bucketNam
}
return rinfo, nil
}
+
+// GetBucketReplicationMetricsV2 fetches bucket replication status metrics
+func (c *Client) GetBucketReplicationMetricsV2(ctx context.Context, bucketName string) (s replication.MetricsV2, err error) {
+ // Input validation.
+ if err := s3utils.CheckValidBucketName(bucketName); err != nil {
+ return s, err
+ }
+ // Get resources properly escaped and lined up before
+ // using them in http request.
+ urlValues := make(url.Values)
+ urlValues.Set("replication-metrics", "2")
+
+ // Execute GET on bucket to get replication metrics.
+ resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
+ bucketName: bucketName,
+ queryValues: urlValues,
+ })
+
+ defer closeResponse(resp)
+ if err != nil {
+ return s, err
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ return s, httpRespToErrorResponse(resp, bucketName, "")
+ }
+ respBytes, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return s, err
+ }
+
+ if err := json.Unmarshal(respBytes, &s); err != nil {
+ return s, err
+ }
+ return s, nil
+}
+
+// CheckBucketReplication validates if replication is set up properly for a bucket
+func (c *Client) CheckBucketReplication(ctx context.Context, bucketName string) (err error) {
+ // Input validation.
+ if err := s3utils.CheckValidBucketName(bucketName); err != nil {
+ return err
+ }
+ // Get resources properly escaped and lined up before
+ // using them in http request.
+ urlValues := make(url.Values)
+ urlValues.Set("replication-check", "")
+
+ // 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 err
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ return httpRespToErrorResponse(resp, bucketName, "")
+ }
+ return nil
+}