Documentation ¶
Overview ¶
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
Index ¶
- type EventBus
- type EventBusAPI
- type EventBusConfiguration
- type PatternRule
- func (rule *PatternRule) AddTarget(target RuleTarget) error
- func (rule *PatternRule) GetID() string
- func (rule PatternRule) MarshalJSON() ([]byte, error)
- func (rule PatternRule) Matches() bool
- func (rule PatternRule) Targets() []RuleTarget
- func (rule PatternRule) ToJSON() string
- func (rule PatternRule) ToYAML() (string, error)
- func (rule PatternRule) Type() string
- func (rule *PatternRule) UnmarshalJSON(data []byte) error
- type Rule
- type RuleTarget
- type RuleType
- type RulesEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is the implementation of the Lightweight Event Bus that holds and manages the current registered events. EventBus is thread safe
func NewEventBus ¶
func NewEventBus(eventBusConfig EventBusConfiguration) *EventBus
NewEventBus creates a new EventBus and returns the reference to the object
func (*EventBus) AddRule ¶
AddRule adds a rule to the rules engine and return the rule id, otherwise an empty string is returned
func (*EventBus) AddRuleWithTarget ¶
AddRuleWithTarget adds a rule to the rules engine and adds a target for the rule. It returns the rule id, otherwise an error is returned
func (*EventBus) Start ¶
func (bus *EventBus) Start()
Start starts all of the processes/services used by the EventBus
func (*EventBus) UpdateRule ¶
UpdateRule updates the definition of an existing rule using the passed in rule id and ruleJSON. an error is returned if one occurred
type EventBusAPI ¶
type EventBusAPI struct {
// contains filtered or unexported fields
}
EventBusAPI is an API container that holds all of the logic for managing the API interface for Event Bus
func NewEventBusAPI ¶
func NewEventBusAPI(bus *EventBus) *EventBusAPI
NewEventBusAPI creates a new instance of the EventBusAPI and returns a reference to the new object. Otherwise an error is returned if one occurred.
func (*EventBusAPI) GetState ¶
func (api *EventBusAPI) GetState() goapi.State
GetState interrogates the service to understand its current state for status reporting purpopses. This is a RESTService interface implementation
func (*EventBusAPI) Start ¶
func (api *EventBusAPI) Start() error
Start starts the running version of the API and is ready to receive requests
func (*EventBusAPI) Stop ¶
func (api *EventBusAPI) Stop()
Stop initiaties the graceful shutdown of the API's underlying rest service
type EventBusConfiguration ¶
type EventBusConfiguration struct { DataAccessConfig dataaccess.DataSourceConfiguration `json:"dataaccessconfig" yaml:"dataaccessconfig"` APIConfiguration config.ListenerConfig `json:"apiconfig" yaml:"apiconfig"` }
EventBusConfiguration holds all of the configuration information for the EventBus
type PatternRule ¶
type PatternRule struct { Pattern map[string]interface{} `json:"pattern" yaml:"pattern"` RuleTargets []RuleTarget `json:"ruletargets" yaml:"ruletargets"` Created time.Time `json:"created" yaml:"created"` Modified time.Time `json:"modified" yaml:"modified"` RuleID string `json:"id" yaml:"id"` Name string `json:"name" yaml:"name"` Description string `json:"description" yaml:"description"` RuleType RuleType `json:"ruletype" yaml:"ruletype"` }
PatternRule represents rule criteria to be evaluated in order to determine if an event satisifes the requirments fo the rule. The rule itself will be a representation of any object and will use the key value pairs extracted from a JSON Map to determine the rule parameters
func NewRule ¶
func NewRule(rulePattern interface{}) *PatternRule
NewRule generates a new Rule based on the passed in parameters object
func (*PatternRule) AddTarget ¶
func (rule *PatternRule) AddTarget(target RuleTarget) error
AddTarget provides a mechanism for add an additional target to the rule
func (*PatternRule) GetID ¶
func (rule *PatternRule) GetID() string
GetID returns the ID for the rule
func (PatternRule) MarshalJSON ¶
func (rule PatternRule) MarshalJSON() ([]byte, error)
MarshalJSON is a method implemented allowing JSON serialization of the PatternRulelogLevel values from an enumerated type to a string
func (PatternRule) Matches ¶
func (rule PatternRule) Matches() bool
Matches determines if the event passed to the function is a match for the pattern rule
func (PatternRule) Targets ¶
func (rule PatternRule) Targets() []RuleTarget
Targets returns the list of registered targets for this particular rule
func (PatternRule) ToJSON ¶
func (rule PatternRule) ToJSON() string
ToJSON returns the JSON string for the rule
func (PatternRule) ToYAML ¶
func (rule PatternRule) ToYAML() (string, error)
ToYAML returns the YAML string for the rule
func (PatternRule) Type ¶
func (rule PatternRule) Type() string
Type returns the rule type for this particular rule (PATTERN)
func (*PatternRule) UnmarshalJSON ¶
func (rule *PatternRule) UnmarshalJSON(data []byte) error
UnmarshalJSON is a method implemented allowing de-serialization of the PatternRule JSON to a PatternRule
type Rule ¶
Rule is an interface that defines a Rule and establishes the different functions that can be execute against a rule to determine if it matches an event
type RuleTarget ¶
type RuleTarget struct {
TargetURL string `json:"targeturl" yaml:"targeturl"`
}
RuleTarget defines the target for an event that has a matching rule
func NewRuleTarget ¶
func NewRuleTarget(targetURL string) RuleTarget
NewRuleTarget creates and returns a new RuleTarget with the passed in target URL
type RuleType ¶
type RuleType int
RuleType represents an enumeration of the different types of rules that are allowed by the rules engine
func RuleTypeFromString ¶
RuleTypeFromString converts a string to the appropriate RuleType. If not found, a default of 'NOOP' is returned
type RulesEngine ¶
type RulesEngine struct { Rules []Rule Configuration dataaccess.DataSourceConfiguration // contains filtered or unexported fields }
RulesEngine is the piece of functionality that determines if a specific rule applies to an event being evaluated
func NewRulesEngine ¶
func NewRulesEngine(configuration dataaccess.DataSourceConfiguration) *RulesEngine
NewRulesEngine creates and returns a reference to a new rules engine object
Directories ¶
Path | Synopsis |
---|---|
********************************************************************************** The MIT License (MIT) Copyright (c) 2022 Sean Beard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
********************************************************************************** The MIT License (MIT) Copyright (c) 2022 Sean Beard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |