func (store *Store) UpdateStreamRule(prms *graylog.StreamRuleUpdateParams) error {
	if prms == nil {
		return fmt.Errorf("rule is nil")
	}
	store.imutex.Lock()
	defer store.imutex.Unlock()
	rules, ok := store.streamRules[prms.StreamID]
	if !ok {
		return fmt.Errorf("no stream with id <%s> is found", prms.StreamID)
	}
	rule, ok := rules[prms.ID]
	if !ok {
		return fmt.Errorf("no stream rule with id <%s> is found", prms.ID)
	}
	if prms.Field != "" {
		rule.Field = prms.Field
	}
	if prms.Description != "" {
		rule.Description = prms.Description
	}
	if prms.Value != "" {
		rule.Value = prms.Value
	}
	if prms.Type != nil {
		rule.Type = *prms.Type
	}
	if prms.Inverted != nil {
		rule.Inverted = *prms.Inverted
	}
	rules[rule.ID] = rule
	store.streamRules[rule.StreamID] = rules
	return nil
}
// UpdateStreamRule updates a stream rule.
UpdateStreamRule updates a stream rule.
// UpdateStreamRule updates a stream rule .
func (store *Store) UpdateStreamRule(prms *graylog.StreamRuleUpdateParams) error {
	if prms == nil {
		return fmt.Errorf("rule is nil")
	}
	store.imutex.Lock()
	defer store.imutex.Unlock()
	rules, ok := store.streamRules[prms.StreamID]
	if !ok {
		return fmt.Errorf("no stream with id <%s> is found", prms.StreamID)
	}
	rule, ok := rules[prms.ID]
	if !ok {
		return fmt.Errorf("no stream rule with id <%s> is found", prms.ID)
	}
	if prms.Field != "" {
		rule.Field = prms.Field
	}
	if prms.Description != "" {
		rule.Description = prms.Description
	}
	if prms.Value != "" {
		rule.Value = prms.Value
	}
	if prms.Type != nil {
		rule.Type = *prms.Type
	}
	if prms.Inverted != nil {
		rule.Inverted = *prms.Inverted
	}
	rules[rule.ID] = rule
	store.streamRules[rule.StreamID] = rules
	return nil
}
func ( store * Store ) UpdateStreamRule ( prms * graylog . StreamRuleUpdateParams ) error { if prms == nil { return fmt . Errorf ( " " ) } store . imutex . Lock ( ) defer store . imutex . Unlock ( ) rules , ok := store . streamRules [ prms . StreamID ] if ! ok { return fmt . Errorf ( " " , prms . StreamID ) } rule , ok := rules [ prms . ID ] if ! ok { return fmt . Errorf ( " " , prms . ID ) } if prms . Field != " " { rule . Field = prms . Field } if prms . Description != " " { rule . Description = prms . Description } if prms . Value != " " { rule . Value = prms . Value } if prms . Type != nil { rule . Type = * prms . Type } if prms . Inverted != nil { rule . Inverted = * prms . Inverted } rules [ rule . ID ] = rule store . streamRules [ rule . StreamID ] = rules return nil }
UpdateStreamRule updates a stream rule.
UpdateStreamRule updates a stream rule .