Skip to content

Commit 174b4c0

Browse files
simplify healthcheck implementation (#1555)
1 parent 4856026 commit 174b4c0

34 files changed

+227
-162
lines changed

api-bucket-encryption.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
// SetBucketEncryption sets the default encryption configuration on an existing bucket.
31-
func (c Client) SetBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error {
31+
func (c *Client) SetBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error {
3232
// Input validation.
3333
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3434
return err
@@ -70,7 +70,7 @@ func (c Client) SetBucketEncryption(ctx context.Context, bucketName string, conf
7070
}
7171

7272
// RemoveBucketEncryption removes the default encryption configuration on a bucket with a context to control cancellations and timeouts.
73-
func (c Client) RemoveBucketEncryption(ctx context.Context, bucketName string) error {
73+
func (c *Client) RemoveBucketEncryption(ctx context.Context, bucketName string) error {
7474
// Input validation.
7575
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
7676
return err
@@ -99,7 +99,7 @@ func (c Client) RemoveBucketEncryption(ctx context.Context, bucketName string) e
9999

100100
// GetBucketEncryption gets the default encryption configuration
101101
// on an existing bucket with a context to control cancellations and timeouts.
102-
func (c Client) GetBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error) {
102+
func (c *Client) GetBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error) {
103103
// Input validation.
104104
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
105105
return nil, err

api-bucket-lifecycle.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
)
3131

3232
// SetBucketLifecycle set the lifecycle on an existing bucket.
33-
func (c Client) SetBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error {
33+
func (c *Client) SetBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error {
3434
// Input validation.
3535
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3636
return err
@@ -51,7 +51,7 @@ func (c Client) SetBucketLifecycle(ctx context.Context, bucketName string, confi
5151
}
5252

5353
// Saves a new bucket lifecycle.
54-
func (c Client) putBucketLifecycle(ctx context.Context, bucketName string, buf []byte) error {
54+
func (c *Client) putBucketLifecycle(ctx context.Context, bucketName string, buf []byte) error {
5555
// Get resources properly escaped and lined up before
5656
// using them in http request.
5757
urlValues := make(url.Values)
@@ -81,7 +81,7 @@ func (c Client) putBucketLifecycle(ctx context.Context, bucketName string, buf [
8181
}
8282

8383
// Remove lifecycle from a bucket.
84-
func (c Client) removeBucketLifecycle(ctx context.Context, bucketName string) error {
84+
func (c *Client) removeBucketLifecycle(ctx context.Context, bucketName string) error {
8585
// Get resources properly escaped and lined up before
8686
// using them in http request.
8787
urlValues := make(url.Values)
@@ -101,7 +101,7 @@ func (c Client) removeBucketLifecycle(ctx context.Context, bucketName string) er
101101
}
102102

103103
// GetBucketLifecycle fetch bucket lifecycle configuration
104-
func (c Client) GetBucketLifecycle(ctx context.Context, bucketName string) (*lifecycle.Configuration, error) {
104+
func (c *Client) GetBucketLifecycle(ctx context.Context, bucketName string) (*lifecycle.Configuration, error) {
105105
// Input validation.
106106
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
107107
return nil, err
@@ -120,7 +120,7 @@ func (c Client) GetBucketLifecycle(ctx context.Context, bucketName string) (*lif
120120
}
121121

122122
// Request server for current bucket lifecycle.
123-
func (c Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]byte, error) {
123+
func (c *Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]byte, error) {
124124
// Get resources properly escaped and lined up before
125125
// using them in http request.
126126
urlValues := make(url.Values)

api-bucket-notification.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
)
3333

3434
// SetBucketNotification saves a new bucket notification with a context to control cancellations and timeouts.
35-
func (c Client) SetBucketNotification(ctx context.Context, bucketName string, config notification.Configuration) error {
35+
func (c *Client) SetBucketNotification(ctx context.Context, bucketName string, config notification.Configuration) error {
3636
// Input validation.
3737
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3838
return err
@@ -73,12 +73,12 @@ func (c Client) SetBucketNotification(ctx context.Context, bucketName string, co
7373
}
7474

7575
// RemoveAllBucketNotification - Remove bucket notification clears all previously specified config
76-
func (c Client) RemoveAllBucketNotification(ctx context.Context, bucketName string) error {
76+
func (c *Client) RemoveAllBucketNotification(ctx context.Context, bucketName string) error {
7777
return c.SetBucketNotification(ctx, bucketName, notification.Configuration{})
7878
}
7979

8080
// GetBucketNotification returns current bucket notification configuration
81-
func (c Client) GetBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) {
81+
func (c *Client) GetBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) {
8282
// Input validation.
8383
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
8484
return notification.Configuration{}, err
@@ -87,7 +87,7 @@ func (c Client) GetBucketNotification(ctx context.Context, bucketName string) (b
8787
}
8888

8989
// Request server for notification rules.
90-
func (c Client) getBucketNotification(ctx context.Context, bucketName string) (notification.Configuration, error) {
90+
func (c *Client) getBucketNotification(ctx context.Context, bucketName string) (notification.Configuration, error) {
9191
urlValues := make(url.Values)
9292
urlValues.Set("notification", "")
9393

@@ -121,12 +121,12 @@ func processBucketNotificationResponse(bucketName string, resp *http.Response) (
121121
}
122122

123123
// ListenNotification listen for all events, this is a MinIO specific API
124-
func (c Client) ListenNotification(ctx context.Context, prefix, suffix string, events []string) <-chan notification.Info {
124+
func (c *Client) ListenNotification(ctx context.Context, prefix, suffix string, events []string) <-chan notification.Info {
125125
return c.ListenBucketNotification(ctx, "", prefix, suffix, events)
126126
}
127127

128128
// ListenBucketNotification listen for bucket events, this is a MinIO specific API
129-
func (c Client) ListenBucketNotification(ctx context.Context, bucketName, prefix, suffix string, events []string) <-chan notification.Info {
129+
func (c *Client) ListenBucketNotification(ctx context.Context, bucketName, prefix, suffix string, events []string) <-chan notification.Info {
130130
notificationInfoCh := make(chan notification.Info, 1)
131131
const notificationCapacity = 4 * 1024 * 1024
132132
notificationEventBuffer := make([]byte, notificationCapacity)

api-bucket-policy.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
// SetBucketPolicy sets the access permissions on an existing bucket.
30-
func (c Client) SetBucketPolicy(ctx context.Context, bucketName, policy string) error {
30+
func (c *Client) SetBucketPolicy(ctx context.Context, bucketName, policy string) error {
3131
// Input validation.
3232
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3333
return err
@@ -43,7 +43,7 @@ func (c Client) SetBucketPolicy(ctx context.Context, bucketName, policy string)
4343
}
4444

4545
// Saves a new bucket policy.
46-
func (c Client) putBucketPolicy(ctx context.Context, bucketName, policy string) error {
46+
func (c *Client) putBucketPolicy(ctx context.Context, bucketName, policy string) error {
4747
// Get resources properly escaped and lined up before
4848
// using them in http request.
4949
urlValues := make(url.Values)
@@ -71,7 +71,7 @@ func (c Client) putBucketPolicy(ctx context.Context, bucketName, policy string)
7171
}
7272

7373
// Removes all policies on a bucket.
74-
func (c Client) removeBucketPolicy(ctx context.Context, bucketName string) error {
74+
func (c *Client) removeBucketPolicy(ctx context.Context, bucketName string) error {
7575
// Get resources properly escaped and lined up before
7676
// using them in http request.
7777
urlValues := make(url.Values)
@@ -91,7 +91,7 @@ func (c Client) removeBucketPolicy(ctx context.Context, bucketName string) error
9191
}
9292

9393
// GetBucketPolicy returns the current policy
94-
func (c Client) GetBucketPolicy(ctx context.Context, bucketName string) (string, error) {
94+
func (c *Client) GetBucketPolicy(ctx context.Context, bucketName string) (string, error) {
9595
// Input validation.
9696
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
9797
return "", err
@@ -108,7 +108,7 @@ func (c Client) GetBucketPolicy(ctx context.Context, bucketName string) (string,
108108
}
109109

110110
// Request server for current bucket policy.
111-
func (c Client) getBucketPolicy(ctx context.Context, bucketName string) (string, error) {
111+
func (c *Client) getBucketPolicy(ctx context.Context, bucketName string) (string, error) {
112112
// Get resources properly escaped and lined up before
113113
// using them in http request.
114114
urlValues := make(url.Values)

api-bucket-replication.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ import (
3333
)
3434

3535
// RemoveBucketReplication removes a replication config on an existing bucket.
36-
func (c Client) RemoveBucketReplication(ctx context.Context, bucketName string) error {
36+
func (c *Client) RemoveBucketReplication(ctx context.Context, bucketName string) error {
3737
return c.removeBucketReplication(ctx, bucketName)
3838
}
3939

4040
// SetBucketReplication sets a replication config on an existing bucket.
41-
func (c Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
41+
func (c *Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
4242
// Input validation.
4343
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
4444
return err
@@ -53,7 +53,7 @@ func (c Client) SetBucketReplication(ctx context.Context, bucketName string, cfg
5353
}
5454

5555
// Saves a new bucket replication.
56-
func (c Client) putBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
56+
func (c *Client) putBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
5757
// Get resources properly escaped and lined up before
5858
// using them in http request.
5959
urlValues := make(url.Values)
@@ -86,7 +86,7 @@ func (c Client) putBucketReplication(ctx context.Context, bucketName string, cfg
8686
}
8787

8888
// Remove replication from a bucket.
89-
func (c Client) removeBucketReplication(ctx context.Context, bucketName string) error {
89+
func (c *Client) removeBucketReplication(ctx context.Context, bucketName string) error {
9090
// Get resources properly escaped and lined up before
9191
// using them in http request.
9292
urlValues := make(url.Values)
@@ -107,7 +107,7 @@ func (c Client) removeBucketReplication(ctx context.Context, bucketName string)
107107

108108
// GetBucketReplication fetches bucket replication configuration.If config is not
109109
// found, returns empty config with nil error.
110-
func (c Client) GetBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
110+
func (c *Client) GetBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
111111
// Input validation.
112112
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
113113
return cfg, err
@@ -124,7 +124,7 @@ func (c Client) GetBucketReplication(ctx context.Context, bucketName string) (cf
124124
}
125125

126126
// Request server for current bucket replication config.
127-
func (c Client) getBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
127+
func (c *Client) getBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
128128
// Get resources properly escaped and lined up before
129129
// using them in http request.
130130
urlValues := make(url.Values)
@@ -153,7 +153,7 @@ func (c Client) getBucketReplication(ctx context.Context, bucketName string) (cf
153153
}
154154

155155
// GetBucketReplicationMetrics fetches bucket replication status metrics
156-
func (c Client) GetBucketReplicationMetrics(ctx context.Context, bucketName string) (s replication.Metrics, err error) {
156+
func (c *Client) GetBucketReplicationMetrics(ctx context.Context, bucketName string) (s replication.Metrics, err error) {
157157
// Input validation.
158158
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
159159
return s, err
@@ -199,7 +199,7 @@ func mustGetUUID() string {
199199

200200
// ResetBucketReplication kicks off replication of previously replicated objects if ExistingObjectReplication
201201
// is enabled in the replication config
202-
func (c Client) ResetBucketReplication(ctx context.Context, bucketName string, olderThan time.Duration) (rID string, err error) {
202+
func (c *Client) ResetBucketReplication(ctx context.Context, bucketName string, olderThan time.Duration) (rID string, err error) {
203203
rID = mustGetUUID()
204204
_, err = c.resetBucketReplicationOnTarget(ctx, bucketName, olderThan, "", rID)
205205
if err != nil {
@@ -210,14 +210,14 @@ func (c Client) ResetBucketReplication(ctx context.Context, bucketName string, o
210210

211211
// ResetBucketReplication kicks off replication of previously replicated objects if ExistingObjectReplication
212212
// is enabled in the replication config
213-
func (c Client) ResetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn string) (rinfo replication.ResyncTargetsInfo, err error) {
213+
func (c *Client) ResetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn string) (rinfo replication.ResyncTargetsInfo, err error) {
214214
rID := mustGetUUID()
215215
return c.resetBucketReplicationOnTarget(ctx, bucketName, olderThan, tgtArn, rID)
216216
}
217217

218218
// ResetBucketReplication kicks off replication of previously replicated objects if ExistingObjectReplication
219219
// is enabled in the replication config
220-
func (c Client) resetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn string, resetID string) (rinfo replication.ResyncTargetsInfo, err error) {
220+
func (c *Client) resetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn string, resetID string) (rinfo replication.ResyncTargetsInfo, err error) {
221221
// Input validation.
222222
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
223223
return

api-bucket-tagging.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
// GetBucketTagging fetch tagging configuration for a bucket with a
3434
// context to control cancellations and timeouts.
35-
func (c Client) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error) {
35+
func (c *Client) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error) {
3636
// Input validation.
3737
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3838
return nil, err
@@ -64,7 +64,7 @@ func (c Client) GetBucketTagging(ctx context.Context, bucketName string) (*tags.
6464

6565
// SetBucketTagging sets tagging configuration for a bucket
6666
// with a context to control cancellations and timeouts.
67-
func (c Client) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error {
67+
func (c *Client) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error {
6868
// Input validation.
6969
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
7070
return err
@@ -107,7 +107,7 @@ func (c Client) SetBucketTagging(ctx context.Context, bucketName string, tags *t
107107

108108
// RemoveBucketTagging removes tagging configuration for a
109109
// bucket with a context to control cancellations and timeouts.
110-
func (c Client) RemoveBucketTagging(ctx context.Context, bucketName string) error {
110+
func (c *Client) RemoveBucketTagging(ctx context.Context, bucketName string) error {
111111
// Input validation.
112112
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
113113
return err

api-bucket-versioning.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
// SetBucketVersioning sets a bucket versioning configuration
30-
func (c Client) SetBucketVersioning(ctx context.Context, bucketName string, config BucketVersioningConfiguration) error {
30+
func (c *Client) SetBucketVersioning(ctx context.Context, bucketName string, config BucketVersioningConfiguration) error {
3131
// Input validation.
3232
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
3333
return err
@@ -67,12 +67,12 @@ func (c Client) SetBucketVersioning(ctx context.Context, bucketName string, conf
6767
}
6868

6969
// EnableVersioning - enable object versioning in given bucket.
70-
func (c Client) EnableVersioning(ctx context.Context, bucketName string) error {
70+
func (c *Client) EnableVersioning(ctx context.Context, bucketName string) error {
7171
return c.SetBucketVersioning(ctx, bucketName, BucketVersioningConfiguration{Status: "Enabled"})
7272
}
7373

7474
// SuspendVersioning - suspend object versioning in given bucket.
75-
func (c Client) SuspendVersioning(ctx context.Context, bucketName string) error {
75+
func (c *Client) SuspendVersioning(ctx context.Context, bucketName string) error {
7676
return c.SetBucketVersioning(ctx, bucketName, BucketVersioningConfiguration{Status: "Suspended"})
7777
}
7878

@@ -102,7 +102,7 @@ func (b BucketVersioningConfiguration) Suspended() bool {
102102

103103
// GetBucketVersioning gets the versioning configuration on
104104
// an existing bucket with a context to control cancellations and timeouts.
105-
func (c Client) GetBucketVersioning(ctx context.Context, bucketName string) (BucketVersioningConfiguration, error) {
105+
func (c *Client) GetBucketVersioning(ctx context.Context, bucketName string) (BucketVersioningConfiguration, error) {
106106
// Input validation.
107107
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
108108
return BucketVersioningConfiguration{}, err

api-compose-object.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (opts CopySrcOptions) validate() (err error) {
201201
}
202202

203203
// Low level implementation of CopyObject API, supports only upto 5GiB worth of copy.
204-
func (c Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string,
204+
func (c *Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string,
205205
metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions) (ObjectInfo, error) {
206206

207207
// Build headers.
@@ -282,7 +282,7 @@ func (c Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBuck
282282
return objInfo, nil
283283
}
284284

285-
func (c Client) copyObjectPartDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string,
285+
func (c *Client) copyObjectPartDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string,
286286
partID int, startOffset int64, length int64, metadata map[string]string) (p CompletePart, err error) {
287287

288288
headers := make(http.Header)
@@ -335,7 +335,7 @@ func (c Client) copyObjectPartDo(ctx context.Context, srcBucket, srcObject, dest
335335
// uploadPartCopy - helper function to create a part in a multipart
336336
// upload via an upload-part-copy request
337337
// https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html
338-
func (c Client) uploadPartCopy(ctx context.Context, bucket, object, uploadID string, partNumber int,
338+
func (c *Client) uploadPartCopy(ctx context.Context, bucket, object, uploadID string, partNumber int,
339339
headers http.Header) (p CompletePart, err error) {
340340

341341
// Build query parameters
@@ -375,7 +375,7 @@ func (c Client) uploadPartCopy(ctx context.Context, bucket, object, uploadID str
375375
// and concatenates them into a new object using only server-side copying
376376
// operations. Optionally takes progress reader hook for applications to
377377
// look at current progress.
378-
func (c Client) ComposeObject(ctx context.Context, dst CopyDestOptions, srcs ...CopySrcOptions) (UploadInfo, error) {
378+
func (c *Client) ComposeObject(ctx context.Context, dst CopyDestOptions, srcs ...CopySrcOptions) (UploadInfo, error) {
379379
if len(srcs) < 1 || len(srcs) > maxPartsCount {
380380
return UploadInfo{}, errInvalidArgument("There must be as least one and up to 10000 source objects.")
381381
}

api-copy-object.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
// CopyObject - copy a source object into a new object
28-
func (c Client) CopyObject(ctx context.Context, dst CopyDestOptions, src CopySrcOptions) (UploadInfo, error) {
28+
func (c *Client) CopyObject(ctx context.Context, dst CopyDestOptions, src CopySrcOptions) (UploadInfo, error) {
2929
if err := src.validate(); err != nil {
3030
return UploadInfo{}, err
3131
}

0 commit comments

Comments
 (0)