Skip to content

Commit af8eb9a

Browse files
fix: rename mcS3Client to mcClient (#214)
Co-authored-by: Minio Trusted <trusted@minio.io>
1 parent 1201dcf commit af8eb9a

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

restapi/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ func (c minioClient) getBucketPolicy(ctx context.Context, bucketName string) (st
9393
return c.client.GetBucketPolicy(ctx, bucketName)
9494
}
9595

96-
// MCS3Client interface with all functions to be implemented
96+
// MCClient interface with all functions to be implemented
9797
// by mock when testing, it should include all mc/S3Client respective api calls
9898
// that are used within this project.
99-
type MCS3Client interface {
99+
type MCClient interface {
100100
addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error
101101
removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error
102102
watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error)
@@ -106,21 +106,21 @@ type MCS3Client interface {
106106
//
107107
// Define the structure of a mc S3Client and define the functions that are actually used
108108
// from mcS3client api.
109-
type mcS3Client struct {
109+
type mcClient struct {
110110
client *mc.S3Client
111111
}
112112

113113
// implements S3Client.AddNotificationConfig()
114-
func (c mcS3Client) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error {
114+
func (c mcClient) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error {
115115
return c.client.AddNotificationConfig(ctx, arn, events, prefix, suffix, ignoreExisting)
116116
}
117117

118118
// implements S3Client.RemoveNotificationConfig()
119-
func (c mcS3Client) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error {
119+
func (c mcClient) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error {
120120
return c.client.RemoveNotificationConfig(ctx, arn, event, prefix, suffix)
121121
}
122122

123-
func (c mcS3Client) watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) {
123+
func (c mcClient) watch(ctx context.Context, options mc.WatchOptions) (*mc.WatchObject, *probe.Error) {
124124
return c.client.Watch(ctx, options)
125125
}
126126

restapi/user_buckets_events.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func getListBucketEventsResponse(session *models.Principal, params user_api.List
153153
// If notificationEvents is empty, by default will set [get, put, delete], else the provided
154154
// ones will be set.
155155
// this function follows same behavior as minio/mc for adding a bucket event
156-
func createBucketEvent(ctx context.Context, client MCS3Client, arn string, notificationEvents []models.NotificationEventType, prefix, suffix string, ignoreExisting bool) error {
156+
func createBucketEvent(ctx context.Context, client MCClient, arn string, notificationEvents []models.NotificationEventType, prefix, suffix string, ignoreExisting bool) error {
157157
var events []string
158158
if len(notificationEvents) == 0 {
159159
// default event values are [get, put, delete]
@@ -187,8 +187,8 @@ func getCreateBucketEventsResponse(session *models.Principal, bucketName string,
187187
}
188188
// create a mc S3Client interface implementation
189189
// defining the client to be used
190-
mcS3Client := mcS3Client{client: s3Client}
191-
err = createBucketEvent(ctx, mcS3Client, *eventReq.Configuration.Arn, eventReq.Configuration.Events, eventReq.Configuration.Prefix, eventReq.Configuration.Suffix, eventReq.IgnoreExisting)
190+
mcClient := mcClient{client: s3Client}
191+
err = createBucketEvent(ctx, mcClient, *eventReq.Configuration.Arn, eventReq.Configuration.Events, eventReq.Configuration.Prefix, eventReq.Configuration.Suffix, eventReq.IgnoreExisting)
192192
if err != nil {
193193
log.Println("error creating bucket event:", err)
194194
return err
@@ -197,7 +197,7 @@ func getCreateBucketEventsResponse(session *models.Principal, bucketName string,
197197
}
198198

199199
// deleteBucketEventNotification calls S3Client.RemoveNotificationConfig to remove a bucket event notification
200-
func deleteBucketEventNotification(ctx context.Context, client MCS3Client, arn string, events []models.NotificationEventType, prefix, suffix *string) error {
200+
func deleteBucketEventNotification(ctx context.Context, client MCClient, arn string, events []models.NotificationEventType, prefix, suffix *string) error {
201201
eventSingleString := joinNotificationEvents(events)
202202
perr := client.removeNotificationConfig(ctx, arn, eventSingleString, *prefix, *suffix)
203203
if perr != nil {
@@ -224,8 +224,8 @@ func getDeleteBucketEventsResponse(session *models.Principal, bucketName string,
224224
}
225225
// create a mc S3Client interface implementation
226226
// defining the client to be used
227-
mcS3Client := mcS3Client{client: s3Client}
228-
err = deleteBucketEventNotification(ctx, mcS3Client, arn, events, prefix, suffix)
227+
mcClient := mcClient{client: s3Client}
228+
err = deleteBucketEventNotification(ctx, mcClient, arn, events, prefix, suffix)
229229
if err != nil {
230230
log.Println("error deleting bucket event:", err)
231231
return err

restapi/user_watch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type watchOptions struct {
3434
mc.WatchOptions
3535
}
3636

37-
func startWatch(ctx context.Context, conn WSConn, wsc MCS3Client, options watchOptions) error {
37+
func startWatch(ctx context.Context, conn WSConn, wsc MCClient, options watchOptions) error {
3838
wo, pErr := wsc.watch(ctx, options.WatchOptions)
3939
if pErr != nil {
4040
fmt.Println("error initializing watch:", pErr.Cause)

restapi/ws_handle.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ type ConsoleWebsocket interface {
6161
type wsS3Client struct {
6262
// websocket connection.
6363
conn wsConn
64-
// mcS3Client
65-
client MCS3Client
64+
// mcClient
65+
client MCClient
6666
}
6767

6868
// WSConn interface with all functions to be implemented
@@ -197,7 +197,7 @@ func newWebSocketS3Client(conn *websocket.Conn, claims *models.Principal, bucket
197197
wsConnection := wsConn{conn: conn}
198198
// create a s3Client interface implementation
199199
// defining the client to be used
200-
mcS3C := mcS3Client{client: s3Client}
200+
mcS3C := mcClient{client: s3Client}
201201
// create websocket client and handle request
202202
wsS3Client := &wsS3Client{conn: wsConnection, client: mcS3C}
203203
return wsS3Client, nil

0 commit comments

Comments
 (0)