MCPcopy
hub / github.com/minio/minio-go / SetBucketReplication

Method SetBucketReplication

api-bucket-replication.go:55–67  ·  view source on GitHub ↗

SetBucketReplication sets the replication configuration on an existing bucket. If the provided configuration is empty, this method removes the existing replication configuration. Parameters: - ctx: Context for request cancellation and timeout - bucketName: Name of the bucket - cfg: Replication conf

(ctx context.Context, bucketName string, cfg replication.Config)

Source from the content-addressed store, hash-verified

53//
54// Returns an error if the operation fails.
55func (c *Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
56 // Input validation.
57 if err := s3utils.CheckValidBucketName(bucketName); err != nil {
58 return err
59 }
60
61 // If replication is empty then delete it.
62 if cfg.Empty() {
63 return c.removeBucketReplication(ctx, bucketName)
64 }
65 // Save the updated replication.
66 return c.putBucketReplication(ctx, bucketName, cfg)
67}
68
69// Saves a new bucket replication.
70func (c *Client) putBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {

Callers 1

mainFunction · 0.80

Calls 4

putBucketReplicationMethod · 0.95
CheckValidBucketNameFunction · 0.92
EmptyMethod · 0.45

Tested by

no test coverage detected