filer.remote.gateway: add options to include or exclude new bucket names to mirror

This commit is contained in:
Chris Lu
2021-09-15 23:04:16 -07:00
parent b5f4910412
commit 94a01fcfcb
2 changed files with 15 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/golang/protobuf/proto"
"math"
"math/rand"
"path/filepath"
"strings"
"time"
)
@@ -75,6 +76,16 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour
}
bucketName := strings.ToLower(entry.Name)
if *option.include != "" {
if ok, _ := filepath.Match(*option.include, entry.Name); !ok {
return nil
}
}
if *option.exclude != "" {
if ok, _ := filepath.Match(*option.exclude, entry.Name); ok {
return nil
}
}
if *option.createBucketRandomSuffix {
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
if len(bucketName)+5 > 63 {