@@ -290,6 +290,42 @@ func (c *Client) GetBucketReplicationResyncStatus(ctx context.Context, bucketNam
290
290
return rinfo , nil
291
291
}
292
292
293
+ // CancelBucketReplicationResync cancels in progress replication resync
294
+ func (c * Client ) CancelBucketReplicationResync (ctx context.Context , bucketName string , tgtArn string ) (id string , err error ) {
295
+ // Input validation.
296
+ if err = s3utils .CheckValidBucketName (bucketName ); err != nil {
297
+ return
298
+ }
299
+ // Get resources properly escaped and lined up before
300
+ // using them in http request.
301
+ urlValues := make (url.Values )
302
+ urlValues .Set ("replication-reset-cancel" , "" )
303
+ if tgtArn != "" {
304
+ urlValues .Set ("arn" , tgtArn )
305
+ }
306
+ // Execute GET on bucket to get replication config.
307
+ resp , err := c .executeMethod (ctx , http .MethodPut , requestMetadata {
308
+ bucketName : bucketName ,
309
+ queryValues : urlValues ,
310
+ })
311
+
312
+ defer closeResponse (resp )
313
+ if err != nil {
314
+ return id , err
315
+ }
316
+
317
+ if resp .StatusCode != http .StatusOK {
318
+ return id , httpRespToErrorResponse (resp , bucketName , "" )
319
+ }
320
+ strBuf , err := io .ReadAll (resp .Body )
321
+ if err != nil {
322
+ return "" , err
323
+ }
324
+
325
+ id = string (strBuf )
326
+ return id , nil
327
+ }
328
+
293
329
// GetBucketReplicationMetricsV2 fetches bucket replication status metrics
294
330
func (c * Client ) GetBucketReplicationMetricsV2 (ctx context.Context , bucketName string ) (s replication.MetricsV2 , err error ) {
295
331
// Input validation.
0 commit comments