github.com/percona/percona-xtradb-cluster-operator@v1.14.0/pkg/pxc/backup/storage/fake/storage.go (about) 1 package fake 2 3 import ( 4 "context" 5 "errors" 6 "io" 7 8 "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/backup/storage" 9 ) 10 11 func NewFakeClient(ctx context.Context, opts storage.Options) (storage.Storage, error) { 12 switch opts := opts.(type) { 13 case *storage.S3Options: 14 if opts.BucketName == "" { 15 return nil, errors.New("bucket name is empty") 16 } 17 case *storage.AzureOptions: 18 if opts.Container == "" { 19 return nil, errors.New("container name is empty") 20 } 21 } 22 return &FakeStorageClient{}, nil 23 } 24 25 type FakeStorageClient struct{} 26 27 func (c *FakeStorageClient) GetObject(ctx context.Context, objectName string) (io.ReadCloser, error) { 28 return nil, nil 29 } 30 31 func (c *FakeStorageClient) PutObject(ctx context.Context, name string, data io.Reader, size int64) error { 32 return nil 33 } 34 35 func (c *FakeStorageClient) ListObjects(ctx context.Context, prefix string) ([]string, error) { 36 return nil, nil 37 } 38 func (c *FakeStorageClient) DeleteObject(ctx context.Context, objectName string) error { return nil } 39 func (c *FakeStorageClient) SetPrefix(prefix string) {} 40 func (c *FakeStorageClient) GetPrefix() string { return "" }