@@ -26,6 +26,7 @@ import (
2626 "github.com/percona/percona-backup-mongodb/pbm/storage/azure"
2727 "github.com/percona/percona-backup-mongodb/pbm/storage/fs"
2828 "github.com/percona/percona-backup-mongodb/pbm/storage/gcs"
29+ "github.com/percona/percona-backup-mongodb/pbm/storage/mio"
2930 "github.com/percona/percona-backup-mongodb/pbm/storage/oss"
3031 "github.com/percona/percona-backup-mongodb/pbm/storage/s3"
3132 "github.com/percona/percona-backup-mongodb/pbm/topo"
@@ -142,6 +143,17 @@ func (c *Config) String() string {
142143 c .Storage .S3 .ServerSideEncryption .SseCustomerKey = "***"
143144 }
144145 }
146+ if c .Storage .Minio != nil {
147+ if c .Storage .Minio .Credentials .AccessKeyID != "" {
148+ c .Storage .Minio .Credentials .AccessKeyID = "***"
149+ }
150+ if c .Storage .Minio .Credentials .SecretAccessKey != "" {
151+ c .Storage .Minio .Credentials .SecretAccessKey = "***"
152+ }
153+ if c .Storage .Minio .Credentials .SessionToken != "" {
154+ c .Storage .Minio .Credentials .SessionToken = "***"
155+ }
156+ }
145157 if c .Storage .Azure != nil {
146158 if c .Storage .Azure .Credentials .Key != "" {
147159 c .Storage .Azure .Credentials .Key = "***"
@@ -236,6 +248,7 @@ func (cfg *PITRConf) Clone() *PITRConf {
236248type StorageConf struct {
237249 Type storage.Type `bson:"type" json:"type" yaml:"type"`
238250 S3 * s3.Config `bson:"s3,omitempty" json:"s3,omitempty" yaml:"s3,omitempty"`
251+ Minio * mio.Config `bson:"minio,omitempty" json:"minio,omitempty" yaml:"minio,omitempty"`
239252 GCS * gcs.Config `bson:"gcs,omitempty" json:"gcs,omitempty" yaml:"gcs,omitempty"`
240253 Azure * azure.Config `bson:"azure,omitempty" json:"azure,omitempty" yaml:"azure,omitempty"`
241254 Filesystem * fs.Config `bson:"filesystem,omitempty" json:"filesystem,omitempty" yaml:"filesystem,omitempty"`
@@ -256,6 +269,8 @@ func (s *StorageConf) Clone() *StorageConf {
256269 rv .Filesystem = s .Filesystem .Clone ()
257270 case storage .S3 :
258271 rv .S3 = s .S3 .Clone ()
272+ case storage .Minio :
273+ rv .Minio = s .Minio .Clone ()
259274 case storage .Azure :
260275 rv .Azure = s .Azure .Clone ()
261276 case storage .GCS :
@@ -276,6 +291,8 @@ func (s *StorageConf) Equal(other *StorageConf) bool {
276291 switch s .Type {
277292 case storage .S3 :
278293 return s .S3 .Equal (other .S3 )
294+ case storage .Minio :
295+ return s .Minio .Equal (other .Minio )
279296 case storage .Azure :
280297 return s .Azure .Equal (other .Azure )
281298 case storage .GCS :
@@ -301,6 +318,8 @@ func (s *StorageConf) IsSameStorage(other *StorageConf) bool {
301318 switch s .Type {
302319 case storage .S3 :
303320 return s .S3 .IsSameStorage (other .S3 )
321+ case storage .Minio :
322+ return s .Minio .IsSameStorage (other .Minio )
304323 case storage .Azure :
305324 return s .Azure .IsSameStorage (other .Azure )
306325 case storage .GCS :
@@ -320,6 +339,8 @@ func (s *StorageConf) Cast() error {
320339 return s .Filesystem .Cast ()
321340 case storage .S3 :
322341 return s .S3 .Cast ()
342+ case storage .Minio :
343+ return s .Minio .Cast ()
323344 case storage .OSS :
324345 return s .OSS .Cast ()
325346 case storage .GCS :
@@ -337,6 +358,8 @@ func (s *StorageConf) Typ() string {
337358 switch s .Type {
338359 case storage .S3 :
339360 return "S3"
361+ case storage .Minio :
362+ return "Minio"
340363 case storage .Azure :
341364 return "Azure"
342365 case storage .GCS :
@@ -368,6 +391,19 @@ func (s *StorageConf) Path() string {
368391 if s .S3 .Prefix != "" {
369392 path += "/" + s .S3 .Prefix
370393 }
394+ case storage .Minio :
395+ path = s .Minio .Endpoint
396+ if path == "" {
397+ path = "minio://" + s .Minio .Bucket
398+ } else {
399+ if ! strings .Contains (path , "://" ) {
400+ path = "minio://" + path
401+ }
402+ path += "/" + s .Minio .Bucket
403+ }
404+ if s .Minio .Prefix != "" {
405+ path += "/" + s .Minio .Prefix
406+ }
371407 case storage .Azure :
372408 epURL := s .Azure .EndpointURL
373409 if epURL == "" {
@@ -389,6 +425,19 @@ func (s *StorageConf) Path() string {
389425 return path
390426}
391427
428+ func (s * StorageConf ) Region () string {
429+ region := ""
430+
431+ switch s .Type {
432+ case storage .S3 :
433+ region = s .S3 .Region
434+ case storage .Minio :
435+ region = s .Minio .Region
436+ }
437+
438+ return region
439+ }
440+
392441// RestoreConf is config options for the restore
393442//
394443//nolint:lll
0 commit comments