func (c Client) GetBucketEncryptionWithContext(ctx context.Context, bucketName string) (ServerSideEncryptionConfiguration, error) {
	if err := s3utils.CheckValidBucketName(bucketName); err != nil {
		return ServerSideEncryptionConfiguration{}, err
	}
	urlValues := make(url.Values)
	urlValues.Set("encryption", "")
	resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
		bucketName:  bucketName,
		queryValues: urlValues,
	})
	defer closeResponse(resp)
	if err != nil {
		return ServerSideEncryptionConfiguration{}, err
	}
	if resp.StatusCode != http.StatusOK {
		return ServerSideEncryptionConfiguration{}, httpRespToErrorResponse(resp, bucketName, "")
	}
	bucketEncryptionBuf, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return ServerSideEncryptionConfiguration{}, err
	}
	encryptionConfig := ServerSideEncryptionConfiguration{}
	if err := xml.Unmarshal(bucketEncryptionBuf, &encryptionConfig); err != nil {
		return ServerSideEncryptionConfiguration{}, err
	}
	return encryptionConfig, nil
}
GetBucketEncryptionWithContext gets the default encryption configuration on an existing bucket with a context to control cancellations and timeouts.
package minio
import (
	"context"
	"encoding/xml"
	"io/ioutil"
	"net/http"
	"net/url"
	"github.com/minio/minio-go/v6/pkg/s3utils"
)
func (c Client) GetBucketEncryption(bucketName string) (ServerSideEncryptionConfiguration, error) {
	return c.GetBucketEncryptionWithContext(context.Background(), bucketName)
}