reject resync start on misconfigured replication rules (#15041)

we expect resync to start on buckets with replication
rule ExistingObjects enabled, if not we reject such
calls.
This commit is contained in:
Harshavardhana
2022-06-06 02:54:39 -07:00
committed by GitHub
parent fd02492cb7
commit 48e367ff7d
8 changed files with 519 additions and 383 deletions

View File

@@ -146,6 +146,18 @@ type ObjectOpts struct {
TargetArn string
}
// HasExistingObjectReplication returns true if any of the rule returns 'ExistingObjects' replication.
func (c Config) HasExistingObjectReplication(arn string) bool {
for _, rule := range c.Rules {
if rule.Destination.ARN == arn || c.RoleArn == arn {
if rule.ExistingObjectReplication.Status == Enabled {
return true
}
}
}
return false
}
// FilterActionableRules returns the rules actions that need to be executed
// after evaluating prefix/tag filtering
func (c Config) FilterActionableRules(obj ObjectOpts) []Rule {