// SetRules takes an external Rules structure and overwrite one of the
// internal Rules as designated by ruleSource parameter.
965624
func (qri *Map) SetRules(ruleSource string, newRules *Rules) error {
	if newRules == nil {
		newRules = New()
	}
	qri.mu.Lock()
	defer qri.mu.Unlock()
	if _, ok := qri.queryRulesMap[ruleSource]; ok {
		qri.queryRulesMap[ruleSource] = newRules.Copy()
		return nil
	}
	return errors.New("Rule source identifier " + ruleSource + " is not valid")
}
429352
func (s *CreateLicenseConfigurationInput) SetLicenseRules(v []*string) *CreateLicenseConfigurationInput {
	s.LicenseRules = v
	return s
}
721920
func (s *FindingFilter) SetRulesPackageArns(v []*string) *FindingFilter {
	s.RulesPackageArns = v
	return s
}
975740
func (s *GetRateBasedRuleOutput) SetRule(v *RateBasedRule) *GetRateBasedRuleOutput {
	s.Rule = v
	return s
}
1057012
func (s *ListRulesOutput) SetRules(v []*RuleSummary) *ListRulesOutput {
	s.Rules = v
	return s
}
1030454
func (s *AuthorizeIpRulesInput) SetUserRules(v []*IpRuleItem) *AuthorizeIpRulesInput {
	s.UserRules = v
	return s
}
1270466
func (api *API) SetFirewallRules(args params.FirewallRuleArgs) (params.ErrorResults, error) {
	var errResults params.ErrorResults
	if err := api.checkAdmin(); err != nil {
		return errResults, errors.Trace(err)
	}
	if err := api.check.ChangeAllowed(); err != nil {
		return errResults, errors.Trace(err)
	}

	results := make([]params.ErrorResult, len(args.Args))
	for i, arg := range args.Args {
		logger.Debugf("saving firewall rule %+v", arg)
		err := api.backend.SaveFirewallRule(state.FirewallRule{
			WellKnownService: state.WellKnownServiceType(arg.KnownService),
			WhitelistCIDRs:   arg.WhitelistCIDRS,
		})
		results[i].Error = common.ServerError(err)
	}
	errResults.Results = results
	return errResults, nil
}
1301555
func (dr *dnsRedirect) setRules(wg *completion.WaitGroup, newRules policy.L7DataMap) error {
	var toRemove, toAdd []string

	for _, rule := range dr.currentRules {
		for _, dnsRule := range rule.DNS {
			if len(dnsRule.MatchName) > 0 {
				dnsName := strings.ToLower(dns.Fqdn(dnsRule.MatchName))
				dnsNameAsRE := matchpattern.ToRegexp(dnsName)
				toRemove = append(toRemove, dnsNameAsRE)
			}
			if len(dnsRule.MatchPattern) > 0 {
				dnsPattern := matchpattern.Sanitize(dnsRule.MatchPattern)
				dnsPatternAsRE := matchpattern.ToRegexp(dnsPattern)
				toRemove = append(toRemove, dnsPatternAsRE)
			}
		}
	}

	for _, rule := range dr.redirect.rules {
		for _, dnsRule := range rule.DNS {
			if len(dnsRule.MatchName) > 0 {
				dnsName := strings.ToLower(dns.Fqdn(dnsRule.MatchName))
				dnsNameAsRE := matchpattern.ToRegexp(dnsName)
				toAdd = append(toAdd, dnsNameAsRE)
			}
			if len(dnsRule.MatchPattern) > 0 {
				dnsPattern := matchpattern.Sanitize(dnsRule.MatchPattern)
				dnsPatternAsRE := matchpattern.ToRegexp(dnsPattern)
				toAdd = append(toAdd, dnsPatternAsRE)
			}
		}
	}

	log.WithFields(logrus.Fields{
		"add":                toAdd,
		"remove":             toRemove,
		logfields.EndpointID: dr.redirect.endpointID,
	}).Debug("DNS Proxy updating matchNames in allowed list during UpdateRules")
	DefaultDNSProxy.UpdateAllowed(toAdd, toRemove, fmt.Sprintf("%d", dr.redirect.endpointID))
	dr.currentRules = copyRules(dr.redirect.rules)

	return nil
}
1119381
func (s *LicenseConfiguration) SetLicenseRules(v []*string) *LicenseConfiguration {
	s.LicenseRules = v
	return s
}
106577
func (s *CreateRuleInput) SetConditions(v []*RuleCondition) *CreateRuleInput {
	s.Conditions = v
	return s
}
1073041
func (s *ModifyRuleInput) SetConditions(v []*RuleCondition) *ModifyRuleInput {
	s.Conditions = v
	return s
}
1114827
func (s *DescribeActiveReceiptRuleSetOutput) SetRules(v []*ReceiptRule) *DescribeActiveReceiptRuleSetOutput {
	s.Rules = v
	return s
}
532706
func (s *Task) SetOverrides(v *TaskOverride) *Task {
	s.Overrides = v
	return s
}
381294
func (s *LifecycleConfiguration) SetRules(v []*Rule) *LifecycleConfiguration {
	s.Rules = v
	return s
}
415073
func (s *CreateRuleOutput) SetRule(v *Rule) *CreateRuleOutput {
	s.Rule = v
	return s
}
868028
func (s *ValidationError) SetErrors(v []*string) *ValidationError {
	s.Errors = v
	return s
}
74573
func (s *GetBucketLifecycleOutput) SetRules(v []*Rule) *GetBucketLifecycleOutput {
	s.Rules = v
	return s
}